geometry.f90 Source File


This file depends on

sourcefile~~geometry.f90~~EfferentGraph sourcefile~geometry.f90 geometry.f90 sourcefile~params.f90 params.f90 sourcefile~geometry.f90->sourcefile~params.f90 sourcefile~physical_constants.f90 physical_constants.f90 sourcefile~geometry.f90->sourcefile~physical_constants.f90 sourcefile~physical_constants.f90->sourcefile~params.f90

Files dependent on this one

sourcefile~~geometry.f90~~AfferentGraph sourcefile~geometry.f90 geometry.f90 sourcefile~shortwave_radiation.f90 shortwave_radiation.f90 sourcefile~shortwave_radiation.f90->sourcefile~geometry.f90 sourcefile~implicit.f90 implicit.f90 sourcefile~implicit.f90->sourcefile~geometry.f90 sourcefile~horizontal_diffusion.f90 horizontal_diffusion.f90 sourcefile~implicit.f90->sourcefile~horizontal_diffusion.f90 sourcefile~input_output.f90 input_output.f90 sourcefile~input_output.f90->sourcefile~geometry.f90 sourcefile~spectral.f90 spectral.f90 sourcefile~input_output.f90->sourcefile~spectral.f90 sourcefile~large_scale_condensation.f90 large_scale_condensation.f90 sourcefile~large_scale_condensation.f90->sourcefile~geometry.f90 sourcefile~sea_model.f90 sea_model.f90 sourcefile~sea_model.f90->sourcefile~geometry.f90 sourcefile~sea_model.f90->sourcefile~input_output.f90 sourcefile~boundaries.f90 boundaries.f90 sourcefile~sea_model.f90->sourcefile~boundaries.f90 sourcefile~prognostics.f90 prognostics.f90 sourcefile~prognostics.f90->sourcefile~geometry.f90 sourcefile~prognostics.f90->sourcefile~input_output.f90 sourcefile~prognostics.f90->sourcefile~spectral.f90 sourcefile~diagnostics.f90 diagnostics.f90 sourcefile~prognostics.f90->sourcefile~diagnostics.f90 sourcefile~prognostics.f90->sourcefile~boundaries.f90 sourcefile~fourier.f90 fourier.f90 sourcefile~fourier.f90->sourcefile~geometry.f90 sourcefile~longwave_radiation.f90 longwave_radiation.f90 sourcefile~longwave_radiation.f90->sourcefile~geometry.f90 sourcefile~surface_fluxes.f90 surface_fluxes.f90 sourcefile~surface_fluxes.f90->sourcefile~geometry.f90 sourcefile~land_model.f90 land_model.f90 sourcefile~surface_fluxes.f90->sourcefile~land_model.f90 sourcefile~initialization.f90 initialization.f90 sourcefile~initialization.f90->sourcefile~geometry.f90 sourcefile~initialization.f90->sourcefile~input_output.f90 sourcefile~initialization.f90->sourcefile~sea_model.f90 sourcefile~initialization.f90->sourcefile~prognostics.f90 sourcefile~initialization.f90->sourcefile~spectral.f90 sourcefile~initialization.f90->sourcefile~horizontal_diffusion.f90 sourcefile~physics.f90 physics.f90 sourcefile~initialization.f90->sourcefile~physics.f90 sourcefile~geopotential.f90 geopotential.f90 sourcefile~initialization.f90->sourcefile~geopotential.f90 sourcefile~forcing.f90 forcing.f90 sourcefile~initialization.f90->sourcefile~forcing.f90 sourcefile~coupler.f90 coupler.f90 sourcefile~initialization.f90->sourcefile~coupler.f90 sourcefile~initialization.f90->sourcefile~boundaries.f90 sourcefile~time_stepping.f90 time_stepping.f90 sourcefile~initialization.f90->sourcefile~time_stepping.f90 sourcefile~tendencies.f90 tendencies.f90 sourcefile~tendencies.f90->sourcefile~geometry.f90 sourcefile~tendencies.f90->sourcefile~implicit.f90 sourcefile~tendencies.f90->sourcefile~prognostics.f90 sourcefile~tendencies.f90->sourcefile~spectral.f90 sourcefile~tendencies.f90->sourcefile~physics.f90 sourcefile~tendencies.f90->sourcefile~geopotential.f90 sourcefile~spectral.f90->sourcefile~geometry.f90 sourcefile~spectral.f90->sourcefile~fourier.f90 sourcefile~legendre.f90 legendre.f90 sourcefile~spectral.f90->sourcefile~legendre.f90 sourcefile~legendre.f90->sourcefile~geometry.f90 sourcefile~horizontal_diffusion.f90->sourcefile~geometry.f90 sourcefile~physics.f90->sourcefile~geometry.f90 sourcefile~physics.f90->sourcefile~shortwave_radiation.f90 sourcefile~physics.f90->sourcefile~large_scale_condensation.f90 sourcefile~physics.f90->sourcefile~sea_model.f90 sourcefile~physics.f90->sourcefile~longwave_radiation.f90 sourcefile~physics.f90->sourcefile~surface_fluxes.f90 sourcefile~physics.f90->sourcefile~spectral.f90 sourcefile~convection.f90 convection.f90 sourcefile~physics.f90->sourcefile~convection.f90 sourcefile~vertical_diffusion.f90 vertical_diffusion.f90 sourcefile~physics.f90->sourcefile~vertical_diffusion.f90 sourcefile~physics.f90->sourcefile~boundaries.f90 sourcefile~physics.f90->sourcefile~land_model.f90 sourcefile~sppt.f90 sppt.f90 sourcefile~physics.f90->sourcefile~sppt.f90 sourcefile~convection.f90->sourcefile~geometry.f90 sourcefile~vertical_diffusion.f90->sourcefile~geometry.f90 sourcefile~geopotential.f90->sourcefile~geometry.f90 sourcefile~speedy.f90 speedy.f90 sourcefile~speedy.f90->sourcefile~shortwave_radiation.f90 sourcefile~speedy.f90->sourcefile~input_output.f90 sourcefile~speedy.f90->sourcefile~prognostics.f90 sourcefile~speedy.f90->sourcefile~initialization.f90 sourcefile~speedy.f90->sourcefile~forcing.f90 sourcefile~speedy.f90->sourcefile~coupler.f90 sourcefile~speedy.f90->sourcefile~diagnostics.f90 sourcefile~speedy.f90->sourcefile~time_stepping.f90 sourcefile~forcing.f90->sourcefile~shortwave_radiation.f90 sourcefile~forcing.f90->sourcefile~sea_model.f90 sourcefile~forcing.f90->sourcefile~longwave_radiation.f90 sourcefile~forcing.f90->sourcefile~surface_fluxes.f90 sourcefile~forcing.f90->sourcefile~spectral.f90 sourcefile~forcing.f90->sourcefile~horizontal_diffusion.f90 sourcefile~forcing.f90->sourcefile~boundaries.f90 sourcefile~forcing.f90->sourcefile~land_model.f90 sourcefile~coupler.f90->sourcefile~sea_model.f90 sourcefile~coupler.f90->sourcefile~land_model.f90 sourcefile~diagnostics.f90->sourcefile~spectral.f90 sourcefile~boundaries.f90->sourcefile~input_output.f90 sourcefile~boundaries.f90->sourcefile~spectral.f90 sourcefile~land_model.f90->sourcefile~input_output.f90 sourcefile~land_model.f90->sourcefile~boundaries.f90 sourcefile~sppt.f90->sourcefile~spectral.f90 sourcefile~time_stepping.f90->sourcefile~implicit.f90 sourcefile~time_stepping.f90->sourcefile~prognostics.f90 sourcefile~time_stepping.f90->sourcefile~tendencies.f90 sourcefile~time_stepping.f90->sourcefile~spectral.f90 sourcefile~time_stepping.f90->sourcefile~horizontal_diffusion.f90

Contents

Source Code


Source Code

!> author: Sam Hatfield, Fred Kucharski, Franco Molteni
!  date: 01/05/2019
!  For storing all variables related to the model's grid space.
module geometry
    use params

    implicit none

    private
    public initialize_geometry
    public hsg, dhs, fsg, dhsr, fsgr, radang, coriol, sia, coa, sia_half, coa_half, &
        cosg, cosgr, cosgr2

    ! Vertical level parameters
    real :: hsg(kx+1) !! Half sigma levels
    real :: dhs(kx)   !! Sigma level thicknesses
    real :: fsg(kx)   !! Full sigma levels
    real :: dhsr(kx)  !! 1/(2*sigma level thicknesses)
    real :: fsgr(kx)  !! akap/(2*full sigma levels)

    ! Functions of latitude and longitude
    real, dimension(il) :: radang   !! Latitudes in radians
    real, dimension(il) :: coriol   !! Coriolis parameter as a function of latitude
    real, dimension(il) :: sia      !! sine(latitude)
    real, dimension(il) :: coa      !! cosine(latitude)
    real, dimension(iy) :: sia_half !! sine(latitude) over one hemisphere only
    real, dimension(il) :: coa_half !! cosine(latitude) over one hemisphere only
    real, dimension(il) :: cosg     !! Same as coa (TODO: remove)
    real, dimension(il) :: cosgr    !! 1/coa
    real, dimension(il) :: cosgr2   !! 1/coa^2

contains
    !> Initializes all of the model geometry variables.
    subroutine initialize_geometry
        use physical_constants, only: akap, omega

        integer j, jj, k

        ! Definition of model levels
        ! Half (vertical velocity) levels
        if (kx == 5) then
            hsg(:6) = (/ 0.000, 0.150, 0.350, 0.650, 0.900, 1.000 /)
        else if (kx == 7) then
            hsg(:8) = (/ 0.020, 0.140, 0.260, 0.420, 0.600, 0.770, 0.900, 1.000 /)
        else if (kx == 8) then
            hsg(:9) = (/ 0.000, 0.050, 0.140, 0.260, 0.420, 0.600, 0.770, 0.900, 1.000 /)
        end if

        ! Layer thicknesses and full (u,v,T) levels
        do k = 1, kx
            dhs(k) = hsg(k+1)-hsg(k)
            fsg(k) = 0.5*(hsg(k+1)+hsg(k))
        end do

        ! Additional functions of sigma
        do k = 1, kx
            dhsr(k) = 0.5/dhs(k)
            fsgr(k) = akap/(2.*fsg(k))
        end do

        ! Horizontal functions

        ! Latitudes and functions of latitude
        ! NB: J=1 is Southernmost point!
        do j = 1, iy
            jj = il + 1 - j
            sia_half(j) = cos(3.141592654*(j - 0.25)/(il + 0.5))
            coa_half(j) = sqrt(1.0 - sia_half(j)**2.0)
            sia(j)  = -sia_half(j)
            sia(jj) =  sia_half(j)
            coa(j)  = coa_half(j)
            coa(jj) = coa_half(j)
            radang(j)  = -asin(sia_half(j))
            radang(jj) =  asin(sia_half(j))
        end do

        ! Expand cosine and its reciprocal to cover both hemispheres
        do j=1,iy
            jj=il+1-j
            cosg(j)=coa_half(j)
            cosg(jj)=coa_half(j)
            cosgr(j)=1./coa_half(j)
            cosgr(jj)=1./coa_half(j)
            cosgr2(j)=1./(coa_half(j)*coa_half(j))
            cosgr2(jj)=1./(coa_half(j)*coa_half(j))
        end do

        coriol = 2.0*omega*sia
    end subroutine
end module