Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AdvCore_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ module AdvCore_GridCompMod
use fv_diagnostics_mod, only: prt_maxmin, prt_minmax
use FV_StateMod, only: FV_Atm, setup_fv_dimensions_and_topology
use FV_StateMod, only: AdvCoreTracers => T_TRACERS
use FVdycoreCubed_GridComp, only: field_is_cloud_water_species
use FVdycoreCubed_GridComp, only: get_short_name, is_name_in_list
use fv_shared, only: field_is_cloud_water_species
use fv_shared, only: get_short_name, is_name_in_list

use pflogger, only: logger_t => logger

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set (srcs
GEOS_FV3_Utilities.F90
fv_regridding_utils.F90
fv_regrid_c2c.F90
fv_shared.F90
rs_scaleMod.F90
)
if (BUILD_GEOS_GTFV3_INTERFACE)
Expand Down
81 changes: 2 additions & 79 deletions DynCore_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module FVdycoreCubed_GridComp

! FV Specific Module
use fv_arrays_mod, only: REAL4, REAL8, FVPRC
use fv_shared, only: get_short_name, is_name_in_list
use fv_shared, only: field_is_cloud_water_species
!use fv_grid_tools_mod, only: grid_type
use FV_StateMod, only : &
FV_Atm, &
Expand Down Expand Up @@ -83,9 +85,6 @@ module FVdycoreCubed_GridComp
logical :: DEBUG_TQ_ERRORS

public :: SetServices ! Register component methods
public :: get_short_name
public :: field_is_cloud_water_species
public :: is_name_in_list

!DESCRIPTION: This module implements the Dynamical Core as
! an ESMF gridded component.
Expand Down Expand Up @@ -2627,82 +2626,6 @@ function get_adjusted_tracer_bundle(orig_bundle, hconfig, rc) result(adjusted_bu
_RETURN(_SUCCESS)
end function get_adjusted_tracer_bundle

function get_short_name(field, rc) result(short_name)
type(ESMF_Field) :: field
integer, intent(out) :: rc
character(len=:), allocatable :: short_name

character(len=:), allocatable :: standard_name
integer :: status

call MAPL_FieldGet(field, standard_name=standard_name, _RC)
select case (trim(standard_name))
case ("specific_humidity")
short_name = "Q"
case ("mass_fraction_of_large_scale_cloud_liquid_water")
short_name = "QLLS"
case ("mass_fraction_of_convective_cloud_liquid_water")
short_name = "QLCN"
case ("mass_fraction_of_large_scale_cloud_ice_water")
short_name = "QILS"
case ("mass_fraction_of_convective_cloud_ice_water")
short_name = "QICN"
case ("large_scale_cloud_area_fraction")
short_name = "CLLS"
case ("convective_cloud_area_fraction")
short_name = "CLCN"
case ("mass_fraction_of_rain")
short_name = "QRAIN"
case ("mass_fraction_of_snow")
short_name = "QSNOW"
case ("mass_fraction_of_graupel")
short_name = "QGRAUPEL"
case default
! _FAIL("Unrecognized standard_name: " // trim(standard_name))
short_name = trim(standard_name)
end select

_RETURN(_SUCCESS)
end function get_short_name

function field_is_cloud_water_species(field_name) result(is_cloud_water_species)
character(len=*), intent(in) :: field_name
logical :: is_cloud_water_species

is_cloud_water_species = .false.
if ( &
(trim(field_name) == "Q") .or. &
(trim(field_name) == "QLCN") .or. &
(trim(field_name) == "QLLS") .or. &
(trim(field_name) == "QICN") .or. &
(trim(field_name) == "QILS") .or. &
(trim(field_name) == "CLCN") .or. &
(trim(field_name) == "CLLS") .or. &
(trim(field_name) == "NCPL") .or. &
(trim(field_name) == "NCPI") .or. &
(trim(field_name) == "QRAIN") .or. &
(trim(field_name) == "QSNOW") .or. &
(trim(field_name) == "QGRAUPEL")) then
is_cloud_water_species = .true.
end if
end function field_is_cloud_water_species

function is_name_in_list(name, list) result(is_in_list)
character(len=*), intent(in) :: name
character(len=ESMF_MAXSTR), intent(in) :: list(:)
logical :: is_in_list

integer :: n

is_in_list = .false.
do n = 1, size(list)
if (trim(name) == trim(list(n))) then
is_in_list = .true.
exit
end if
end do
end function is_name_in_list

!BOP
!IROUTINE: run_add_incs

Expand Down
98 changes: 98 additions & 0 deletions fv_shared.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#include "MAPL.h"

MODULE fv_shared

USE ESMF
USE MAPL, ONLY : MAPL_FieldGet, MAPL_Verify

IMPLICIT NONE

private

public :: get_short_name
public :: field_is_cloud_water_species
public :: is_name_in_list

!
Comment thread
lizziel marked this conversation as resolved.
! Functions used in both AdvCore_GridCompMod and DynCore_GridCompMod
!

CONTAINS

function get_short_name(field, rc) result(short_name)
type(ESMF_Field) :: field
integer, intent(out) :: rc
character(len=:), allocatable :: short_name

character(len=:), allocatable :: standard_name
integer :: status

call MAPL_FieldGet(field, standard_name=standard_name, _RC)
select case (trim(standard_name))
case ("specific_humidity")
short_name = "Q"
case ("mass_fraction_of_large_scale_cloud_liquid_water")
short_name = "QLLS"
case ("mass_fraction_of_convective_cloud_liquid_water")
short_name = "QLCN"
case ("mass_fraction_of_large_scale_cloud_ice_water")
short_name = "QILS"
case ("mass_fraction_of_convective_cloud_ice_water")
short_name = "QICN"
case ("large_scale_cloud_area_fraction")
short_name = "CLLS"
case ("convective_cloud_area_fraction")
short_name = "CLCN"
case ("mass_fraction_of_rain")
short_name = "QRAIN"
case ("mass_fraction_of_snow")
short_name = "QSNOW"
case ("mass_fraction_of_graupel")
short_name = "QGRAUPEL"
case default
! _FAIL("Unrecognized standard_name: " // trim(standard_name))
short_name = trim(standard_name)
end select

_RETURN(_SUCCESS)
end function get_short_name

function field_is_cloud_water_species(field_name) result(is_cloud_water_species)
character(len=*), intent(in) :: field_name
logical :: is_cloud_water_species

is_cloud_water_species = .false.
if ( &
(trim(field_name) == "Q") .or. &
(trim(field_name) == "QLCN") .or. &
(trim(field_name) == "QLLS") .or. &
(trim(field_name) == "QICN") .or. &
(trim(field_name) == "QILS") .or. &
(trim(field_name) == "CLCN") .or. &
(trim(field_name) == "CLLS") .or. &
(trim(field_name) == "NCPL") .or. &
(trim(field_name) == "NCPI") .or. &
(trim(field_name) == "QRAIN") .or. &
(trim(field_name) == "QSNOW") .or. &
(trim(field_name) == "QGRAUPEL")) then
is_cloud_water_species = .true.
end if
end function field_is_cloud_water_species

function is_name_in_list(name, list) result(is_in_list)
character(len=*), intent(in) :: name
character(len=ESMF_MAXSTR), intent(in) :: list(:)
logical :: is_in_list

integer :: n

is_in_list = .false.
do n = 1, size(list)
if (trim(name) == trim(list(n))) then
is_in_list = .true.
exit
end if
end do
end function is_name_in_list

END MODULE fv_shared
57 changes: 33 additions & 24 deletions jw.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
MODULE jw

IMPLICIT NONE
!

PRIVATE

PUBLIC :: temperature
PUBLIC :: surface_geopotential
PUBLIC :: u_wind
PUBLIC :: v_wind
PUBLIC :: tracer_q1_q2
PUBLIC :: tracer_q3
PUBLIC :: tracer_q

! Functions for setting up initial conditions for the Jablonowski-Williamson test case.
!
! Given longitude (radians), latitude (radians), eta (pressure) and rotation_angle (degrees)
Expand Down Expand Up @@ -35,31 +46,29 @@ MODULE jw
! and equator.
!
! Author: Peter Hjort Lauritzen (NCAR, pel@ucar.edu)
!
INTEGER,PARAMETER :: r8 = SELECTED_REAL_KIND(12) ! 8 byte real

REAL(r8), PARAMETER :: &
eta_strato = 0.2d0 ,&! tropopause level
u0 = 35.d0 ,&! 35 m/s
T0 = 288.d0 ,&! global mean T at surface
p0 = 100000.d0 ,&! global mean surface pressure
eta0 = 0.252d0 ,&! center of jets (hybrid)
!
radius = 10.d0, & ! radius of the perturbation
perturbation_amplitude = 1.d0, & ! amplitude of u perturbation 1 m/s
perturbation_longitude = 20.d0, & ! longitudinal position, 20E
perturbation_latitude = 40.d0, & ! latitudinal position, 40N
perturbation_latitude_tracer = 55.d0, &
!

INTEGER, PARAMETER :: r8 = SELECTED_REAL_KIND(12) ! 8 byte real

REAL(r8), PARAMETER :: &
eta_strato = 0.2d0 ,& ! tropopause level
u0 = 35.d0 ,& ! 35 m/s
T0 = 288.d0 ,& ! global mean T at surface
p0 = 100000.d0 ,& ! global mean surface pressure
eta0 = 0.252d0 ,& ! center of jets (hybrid)
!
radius = 10.d0 ,& ! radius of the perturbation
perturbation_amplitude = 1.d0 ,& ! amplitude of u perturbation 1 m/s
perturbation_longitude = 20.d0 ,& ! longitudinal position, 20E
perturbation_latitude = 40.d0 ,& ! latitudinal position, 40N
perturbation_latitude_tracer = 55.d0 ,&
!
Rd = 287.d0 ,&! gas constant J/(K kg)
g = 9.80616d0 ,&! gravitational acceleration (m/s^2)
a = 6371229.d0,&! Earth's radius in m
omega = 7.29212d-5,&! angular velocity 1/s
gamma = 0.005d0 ,&! lapse rate
pi = 3.14159265358979323846_R8,& ! pi
deg2rad = pi/180.d0
Rd = 287.d0 ,& ! gas constant J/(K kg)
g = 9.80616d0 ,& ! gravitational acceleration (m/s^2)
a = 6371229.d0 ,& ! Earth's radius in m
omega = 7.29212d-5 ,& ! angular velocity 1/s
gamma = 0.005d0 ,& ! lapse rate
pi = 3.14159265358979323846_R8 ,& ! pi
deg2rad = pi/180.d0

CONTAINS
!
Expand Down
25 changes: 16 additions & 9 deletions sw.f90
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
MODULE sw

IMPLICIT NONE
INTEGER,PARAMETER :: r8 = SELECTED_REAL_KIND(12) ! 8 byte real

REAL(r8), PARAMETER :: &
alpha = 0. ,&! angle of axis rotation about the poles
!
!
g = 9.80616d0 ,&! gravitational acceleration (m/s^2)
a = 6371229.d0,&! Earth's radius in m
omega = 7.29212d-5,&! angular velocity 1/s

PRIVATE

PUBLIC :: surface_geopotential
PUBLIC :: height
PUBLIC :: u_wind
PUBLIC :: v_wind

INTEGER, PARAMETER :: r8 = SELECTED_REAL_KIND(12) ! 8 byte real

REAL(r8), PARAMETER :: &
alpha = 0. ,&! angle of axis rotation about the poles
g = 9.80616d0 ,&! gravitational acceleration (m/s^2)
a = 6371229.d0 ,&! Earth's radius in m
omega = 7.29212d-5 ,&! angular velocity 1/s
pi = 3.14159265358979323846_R8,& ! pi
deg2rad = pi/180.d0

Expand Down