Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor dadadj for CCPP framework #91

Merged
merged 28 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
63bab8e
commit initial dadadj mods for SIMA
jtruesdal Mar 27, 2024
9c8ed80
dadadj ccpp mods
jtruesdal Mar 30, 2024
54dc02f
bug fix in loop rewrite
jtruesdal Apr 4, 2024
9da3c51
Merge branch 'ESCOMP:main' into dadadj
jtruesdal Apr 12, 2024
ec51f8c
update main loop in dadadj to get rid of goto statement
jtruesdal Apr 13, 2024
25b52e8
Merge remote-tracking branch 'refs/remotes/jtruesdal/dadadj' into dadadj
jtruesdal Apr 13, 2024
6262dfb
Merge branch 'ESCOMP:main' into dadadj
jtruesdal Apr 30, 2024
8ad3e20
update doc/ChangeLog
jtruesdal May 2, 2024
9fd5230
Update dadadj/dadadj.F90
jtruesdal May 28, 2024
75568fa
Update dadadj/dadadj.F90
jtruesdal May 28, 2024
ff9c000
PR mods
jtruesdal May 28, 2024
ffd527a
rename dadadj dry_adiabatic_adjust
jtruesdal May 28, 2024
d2af285
PR updates
jtruesdal May 28, 2024
6ebbcd6
PR updates
jtruesdal May 28, 2024
e4ccb3e
PR updates - rename dadadj to dry_adiabatic_adjustment
jtruesdal May 30, 2024
eb6c886
Update suite_cam7.xml
jtruesdal May 30, 2024
5c1c3fb
more PR updates
jtruesdal May 30, 2024
3174426
forgot to add test/test_sdfs directory with dry_adiabatic_adjust suite
jtruesdal May 30, 2024
724f30c
PR errmsg update to indicate what column index failed to converge
jtruesdal Jun 4, 2024
4c0f723
PR updates to Changelog
jtruesdal Jun 20, 2024
c98d6ac
fix constituent update - add new update routine until standard one is…
jtruesdal Jul 10, 2024
26591e1
dry adiabatic suite moved to test_sdfs subdirectory, cam7 suite will …
jtruesdal Jul 11, 2024
4a27c3d
ChangeLog update
jtruesdal Jul 12, 2024
4500e60
update to latest atmospheric_physics, generate new NamesNotInDictiona…
jtruesdal Jul 12, 2024
23d7e14
ChangeLog update
jtruesdal Jul 12, 2024
01a0dc2
ChangeLog corr
jtruesdal Jul 12, 2024
9a44dbf
ChangeLog corr
jtruesdal Jul 12, 2024
1e70ee7
minor PR updates to comments, ChangeLog and meta data
jtruesdal Jul 15, 2024
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
95 changes: 50 additions & 45 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
===============================================================

Tag name: atmos_phys0_0x_xxx
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
Originator(s): jet
Date: May 3, 2024
One-line Summary: dadadj CCPP mods
Github PR URL: hhttps://github.com/ESCOMP/atmospheric_physics/pull/
nusbaume marked this conversation as resolved.
Show resolved Hide resolved

This PR fixes the following NCAR/atmospheric_physics Github issues:
- Creates the CCPP interface for the dadadj routine
- dadadj.F90 routine was slightly refactored to update the logic and syntax

Code reviewed by:

List all existing files that have been added (A), modified (M), or deleted (D),
and describe the changes:

A dry_adiabatic_adjust/dadadj_apply_qv_tendency.F90 - temp file to update constituent tendency
A dry_adiabatic_adjust/dadadj_apply_qv_tendency.meta - SIMA meta file for F90 routine
A dry_adiabatic_adjust/dadadj.F90 - minor refactor to the cam routine - CCPP'ize
A dry_adiabatic_adjust/dadadj.meta - SIMA meta file for F90 routine
A dry_adiabatic_adjust/dadadj_namelist.xml
M doc/ChangeLog
A test/test_sdfs/suite_dry_adiabatic_adjust.xml - CCPP suite file for testing
M suite_cam7.xml - added dry adiabatic adjust to cam7 CCPP suite file
M NamesNotInDictionary.txt - updated with current set of names

List and Describe any test failures:
- Tested in CAM
Because dadadj doesn't normally get tripped I modified the Temp
profile to create an instability where the code would be exercised.
The snapshot files contain this instability. The modification adds
60 degrees to the layer 2 temperature.

--- /project/amp/jet/collections/cam6_3_160_dryadj.042924.1856/src/dynamics/se/dyn_comp.F90
2024-05-02 16:56:49.746341064 -0600
+++ SourceMods/src.cam/dyn_comp.F90 2024-05-02 16:37:13.171433366 -0600
@@ -1429,6 +1429,7 @@
do j = 1, np
do i = 1, np
elem(ie)%state%T(i,j,:,1) = dbuf3(indx,:,ie)
+ elem(ie)%state%T(i,j,2,1) = dbuf3(indx,2,ie) + 60._r8
indx = indx + 1
end do
end do

Summarize any changes to answers:
- none: base code includes the same mod above to exercise code.

===============================================================
===============================================================

Tag name: atmos_phys0_03_00
Originator(s): mwaxmonsky
Date: June 18, 2024
Expand Down Expand Up @@ -61,51 +111,6 @@ water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water
********** End Physics Check Data Results **********


===============================================================

Tag name: atmos_phys0_0x_000
Originator(s): jet
Date: May 3, 2024
One-line Summary: dadadj CCPP mods
Github PR URL: hhttps://github.com/ESCOMP/atmospheric_physics/pull/

This PR fixes the following NCAR/atmospheric_physics Github issues:
- Creates the CCPP interface for the dadadj routine
- dadadj.F90 routine was slightly refactored to update the logic and syntax

Code reviewed by:

List all existing files that have been added (A), modified (M), or deleted (D),
and describe the changes:

A dadadj/dadadj.F90 - minor refactor to the cam routine - ccpp'ize
A dadadj/dadadj.meta
A dadadj/dadadj_namelist.xml
M doc/ChangeLog
A suite_dadadj.xml - CCPP suite file


List and Describe any test failures:
- Tested in CAM
Because dadadj doesn't normally get tripped I modified the Temp
profile to create an instability where the code would be exercized.
The snapshot files continain this instability. The modification adds
60 degrees to the layer 2 temperature.

--- /project/amp/jet/collections/cam6_3_160_dryadj.042924.1856/src/dynamics/se/dyn_comp.F90 2024-05-02 16:56:49.746341064 -0600
+++ SourceMods/src.cam/dyn_comp.F90 2024-05-02 16:37:13.171433366 -0600
@@ -1429,6 +1429,7 @@
do j = 1, np
do i = 1, np
elem(ie)%state%T(i,j,:,1) = dbuf3(indx,:,ie)
+ elem(ie)%state%T(i,j,2,1) = dbuf3(indx,2,ie) + 60._r8
indx = indx + 1
end do
end do

Summarize any changes to answers:
- none: base code includes the same mod above to exercise code.

===============================================================
===============================================================

Expand Down
99 changes: 67 additions & 32 deletions doc/NamesNotInDictionary.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

#######################
Date/time of when script was run:
2024-05-30 16:40:13.525104
2024-07-12 11:08:18.467654
#######################

Non-dictionary standard names found in the following metadata files:

--------------------------

/project/amp/jet/collections/CAM-SIMA_ESCOMP.043024/src/physics/ncar_ccpp/utilities/geopotential_temp.meta
atmospheric_physics.jt.062024/utilities/geopotential_temp.meta

- air_pressure_at_interface
- ln_air_pressure_at_interface

--------------------------

/project/amp/jet/collections/CAM-SIMA_ESCOMP.043024/src/physics/ncar_ccpp/zhang_mcfarlane/zm_conv_convtran.meta
atmospheric_physics.jt.062024/zhang_mcfarlane/zm_conv_convtran.meta

- atmosphere_detrainment_convective_mass_flux_for_deep_convection_for_convective_columns
- atmosphere_downdraft_convective_mass_flux_for_deep_convection_for_convective_columns
Expand All @@ -37,33 +37,7 @@ Non-dictionary standard names found in the following metadata files:

--------------------------

/project/amp/jet/collections/CAM-SIMA_ESCOMP.043024/src/physics/ncar_ccpp/zhang_mcfarlane/zm_conv_evap.meta

-
- cloud_area_fraction
- flag_for_zhang_mcfarlane_convective_organization_parameterization?
- freezing_point_of_water?
- frozen_precipitation_mass_flux_at_interface_due_to_deep_convection?
- heating_rate
- latent_heat_of_fusion_of_water_at_0c?
- latent_heat_of_vaporization_of_water_at_0c?
- lwe_frozen_precipitation_rate_at_surface_due_to_deep_convection
- lwe_precipitation_rate_at_surface_due_to_deep_convection
- precipitation_mass_flux_at_interface_due_to_deep_convection?
- pressure_thickness
- specific_heat_of_dry_air_at_constant_pressure?
- tendency_of_dry_air_enthalpy_at_constant_pressure_due_to_frozen_precipitation_melt?
- tendency_of_dry_air_enthalpy_at_constant_pressure_due_to_frozen_precipitation_production_in_deep_convection?
- tendency_of_frozen_precipitation_wrt_moist_air_and_condensed_water_due_to_deep_convection?
- tendency_of_precipitation_wrt_moist_air_and_condensed_water_due_to_deep_convection?
- tendency_of_precipitation_wrt_moist_air_and_condensed_water_due_to_deep_convection_excluding_subcloud_evaporation
- tendency_of_water_vapor_mixing_ratio_wrt_moist_air and_condensed_water?
- tunable_evaporation_efficiency_for_land_in_zhang_mcfarlane_deep_convection_scheme?
- tunable_evaporation_efficiency_in_zhang_mcfarlane_deep_convection_scheme?

--------------------------

/project/amp/jet/collections/CAM-SIMA_ESCOMP.043024/src/physics/ncar_ccpp/zhang_mcfarlane/zm_conv_momtran.meta
atmospheric_physics.jt.062024/zhang_mcfarlane/zm_conv_momtran.meta

- atmosphere_detrainment_convective_mass_flux_for_deep_convection_for_convective_columns
- atmosphere_downdraft_convective_mass_flux_for_deep_convection_for_convective_columns
Expand All @@ -90,7 +64,33 @@ Non-dictionary standard names found in the following metadata files:

--------------------------

/project/amp/jet/collections/CAM-SIMA_ESCOMP.043024/src/physics/ncar_ccpp/zhang_mcfarlane/zm_convr.meta
atmospheric_physics.jt.062024/zhang_mcfarlane/zm_conv_evap.meta

-
- cloud_area_fraction
- flag_for_zhang_mcfarlane_convective_organization_parameterization?
- freezing_point_of_water?
- frozen_precipitation_mass_flux_at_interface_due_to_deep_convection?
- heating_rate
- latent_heat_of_fusion_of_water_at_0c?
- latent_heat_of_vaporization_of_water_at_0c?
- lwe_frozen_precipitation_rate_at_surface_due_to_deep_convection
- lwe_precipitation_rate_at_surface_due_to_deep_convection
- precipitation_mass_flux_at_interface_due_to_deep_convection?
- pressure_thickness
- specific_heat_of_dry_air_at_constant_pressure?
- tendency_of_dry_air_enthalpy_at_constant_pressure_due_to_frozen_precipitation_melt?
- tendency_of_dry_air_enthalpy_at_constant_pressure_due_to_frozen_precipitation_production_in_deep_convection?
- tendency_of_frozen_precipitation_wrt_moist_air_and_condensed_water_due_to_deep_convection?
- tendency_of_precipitation_wrt_moist_air_and_condensed_water_due_to_deep_convection?
- tendency_of_precipitation_wrt_moist_air_and_condensed_water_due_to_deep_convection_excluding_subcloud_evaporation
- tendency_of_water_vapor_mixing_ratio_wrt_moist_air and_condensed_water?
- tunable_evaporation_efficiency_for_land_in_zhang_mcfarlane_deep_convection_scheme?
- tunable_evaporation_efficiency_in_zhang_mcfarlane_deep_convection_scheme?

--------------------------

atmospheric_physics.jt.062024/zhang_mcfarlane/zm_convr.meta

- air_pressure_at_interface
- atmosphere_convective_mass_flux_due_to all_convection?
Expand Down Expand Up @@ -146,12 +146,47 @@ Non-dictionary standard names found in the following metadata files:

--------------------------

/project/amp/jet/collections/CAM-SIMA_ESCOMP.043024/src/physics/ncar_ccpp/dry_adiabatic_adjust/dadadj.meta
atmospheric_physics.jt.062024/dry_adiabatic_adjust/dadadj.meta

- air_pressure_at_interface
- binary_indicator_for_dry_adiabatic_adjusted_grid_cell
- number_of_iterations_for_dry_adiabatic_adjustment_algorithm_convergence
- number_of_vertical_levels_from_model_top_where_dry_adiabatic_adjustment_occurs
- tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water

--------------------------

atmospheric_physics.jt.062024/dry_adiabatic_adjust/dadadj_apply_qv_tendency.meta

- tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water

--------------------------

atmospheric_physics.jt.062024/tj2016/tj2016_precip.meta

- gas_constant_of_water_vapor
- lwe_large_scale_precipitation_rate_at_surface
- ratio_of_water_vapor_to_dry_air_molecular_weights
- sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient

--------------------------

atmospheric_physics.jt.062024/tj2016/tj2016_sfc_pbl_hs.meta

- air_pressure_at_interface
- eddy_heat_diffusivity
- eddy_momentum_diffusivity
- gas_constant_of_water_vapor
- ln_air_pressure_at_interface
- pi_constant
- ratio_of_water_vapor_to_dry_air_molecular_weights
- sum_of_sigma_pressure_hybrid_coordinate_a_coefficient_and_sigma_pressure_hybrid_coordinate_b_coefficient
- surface_eastward_wind_stress
- surface_evaporation_rate
- surface_northward_wind_stress
- surface_upward_sensible_heat_flux
- tendency_of_air_temperature_due_to_diabatic_heating
- tendency_of_air_temperature_due_to_vertical_diffusion
- tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water_due_to_vertical_diffusion

#######################
25 changes: 12 additions & 13 deletions dry_adiabatic_adjust/dadadj.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,24 @@ end subroutine dadadj_init
!> \section arg_table_dadadj_run Argument Table
!! \htmlinclude dadadj_run.html
subroutine dadadj_run( &
ncol, dt, pmid, pint, pdel, state_t, state_q, cappa, t_tend, &
ncol, nz, dt, pmid, pint, pdel, state_t, state_q, cappa, cpair, s_tend, &
q_tend, dadpdf, scheme_name, errmsg, errflg)

!------------------------------------------------
! Input / output parameters
!------------------------------------------------
integer, intent(in) :: ncol ! number of atmospheric columns
integer, intent(in) :: nz ! number of atmospheric levels
real(kind_phys), intent(in) :: dt ! physics timestep
real(kind_phys), intent(in) :: pmid(:,:) ! pressure at model levels
real(kind_phys), intent(in) :: pint(:,:) ! pressure at model interfaces
real(kind_phys), intent(in) :: pdel(:,:) ! vertical delta-p
real(kind_phys), intent(in) :: cappa(:,:) ! variable Kappa
real(kind_phys), intent(in) :: cpair(:,:) ! heat capacity of air
real(kind_phys), intent(in) :: state_t(:,:) ! temperature (K)
real(kind_phys), intent(in) :: state_q(:,:) ! specific humidity
real(kind_phys), intent(out), target :: t_tend(:,:) ! temperature tendency
real(kind_phys), intent(out), target :: q_tend(:,:) ! specific humidity tendency
real(kind_phys), intent(out) :: s_tend(:,:) ! temperature tendency
nusbaume marked this conversation as resolved.
Show resolved Hide resolved
real(kind_phys), intent(out) :: q_tend(:,:) ! specific humidity tendency
real(kind_phys), intent(out) :: dadpdf(:,:) ! PDF of where adjustments happened

character(len=64), intent(out) :: scheme_name
Expand All @@ -90,8 +92,8 @@ subroutine dadadj_run( &
real(kind_phys) :: zgamma ! intermediate constant
real(kind_phys) :: qave ! mean q between levels
real(kind_phys) :: cappaint ! Kappa at level intefaces
real(kind_phys), pointer :: t(:,:)
real(kind_phys), pointer :: q(:,:)
real(kind_phys) :: t(ncol,nz)
real(kind_phys) :: q(ncol,nz)

logical :: ilconv ! .TRUE. ==> convergence was attained
logical :: dodad(ncol) ! .TRUE. ==> do dry adjustment
Expand Down Expand Up @@ -124,10 +126,6 @@ subroutine dadadj_run( &
return
end if

! t_tend< and tend_dtdq used as workspace until needed to calculate tendencies
t => t_tend
q => q_tend

t = state_t
q = state_q

Expand Down Expand Up @@ -200,7 +198,8 @@ subroutine dadadj_run( &
zeps = zeps + zeps
if (zeps > 1.e-4_kind_phys) then
errflg = i
errmsg = trim(scheme_name)//': Convergence failure, zeps > 1.e-4'
write(errmsg,*) trim(scheme_name)//': Convergence failure at column ',i,' zeps > 1.e-4 '// &
'(errflg set to failing column index)'
return ! error return
end if
end do DBLZEP
Expand All @@ -209,11 +208,11 @@ subroutine dadadj_run( &

end do COL

deallocate(c1dad, c2dad, c3dad, c4dad)

t_tend = (t - state_t)/dt
s_tend = (t - state_t)/dt*cpair
q_tend = (q - state_q)/dt

deallocate(c1dad, c2dad, c3dad, c4dad)

end subroutine dadadj_run

end module dadadj
21 changes: 17 additions & 4 deletions dry_adiabatic_adjust/dadadj.meta
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[ccpp-table-properties]
name = dadadj
type = scheme

[ccpp-arg-table]
name = dadadj_init
type = scheme
Expand Down Expand Up @@ -39,6 +38,7 @@
dimensions = ()
intent = out

#########################################################
[ccpp-arg-table]
name = dadadj_run
type = scheme
Expand All @@ -49,6 +49,13 @@
dimensions = ()
type = integer
intent = in
[ nz ]
standard_name = vertical_layer_dimension
long_name = number of vertical layers
units = count
dimensions = ()
type = integer
intent = in
[ dt ]
standard_name = timestep_for_physics
long_name = time step
Expand Down Expand Up @@ -94,11 +101,17 @@
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
type = real | kind = kind_phys
intent = in
[ t_tend ]
standard_name = tendency_of_air_temperature
units = K s-1
[ cpair ]
standard_name = composition_dependent_specific_heat_of_dry_air_at_constant_pressure
units = J kg-1 K-1
dimensions = (horizontal_loop_extent, vertical_layer_dimension)
type = real | kind = kind_phys
intent = in
[ s_tend ]
standard_name = tendency_of_dry_air_enthalpy_at_constant_pressure
units = J kg-1 s-1
type = real | kind = kind_phys
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
intent = out
[ q_tend ]
standard_name = tendency_of_water_vapor_mixing_ratio_wrt_moist_air_and_condensed_water
Expand Down
Loading