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

cam6_4_045: Vertical diffusion refactor #1176

Merged
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bec05e2
Initial refactors for simple lu-decomp abstraction.
mwaxmonsky Jun 28, 2024
d347a39
Merge branch 'cam_development' into vertical-diffusion-refactor
mwaxmonsky Jul 16, 2024
5ebc048
Migrating solve steps to new_decomp.
mwaxmonsky Sep 16, 2024
8f0ad5f
Merge branch 'cam_development' into vertical-diffusion-refactor
mwaxmonsky Sep 16, 2024
beb169f
Updating pes for izumi and removing initialization of tendency.
mwaxmonsky Sep 18, 2024
9d08f1d
Fix out of order operations.
mwaxmonsky Sep 18, 2024
b5d2816
Updating solver design to return solution directly instead of tendenc…
mwaxmonsky Sep 24, 2024
cab5938
Removing files moved to atmos_phys
mwaxmonsky Oct 21, 2024
836d5d8
Updating build path for non-ccppized modules.
mwaxmonsky Oct 21, 2024
37b4ee1
Updating atmos_phys ref.
mwaxmonsky Oct 21, 2024
46ebe28
Undoing changes not needed.
mwaxmonsky Oct 21, 2024
538065c
Removing reference to new decomp and using solver from atmos_phys.
mwaxmonsky Oct 21, 2024
fe8a469
Removing commented out code and new solver source file moved to atmos…
mwaxmonsky Oct 21, 2024
d9d4971
Undoing format change.
mwaxmonsky Oct 21, 2024
2dbe8f6
Removing more commented out code.
mwaxmonsky Oct 21, 2024
d324fd9
Resolving merge conflicts.
mwaxmonsky Oct 21, 2024
04eb0d2
Updating atmos_phys with merged version from main.
mwaxmonsky Oct 21, 2024
69194ca
Updating to flattened atmos_phys to_be_ccppized folder.
mwaxmonsky Oct 22, 2024
ec5fe1e
Updating atmos_phys to top of development branch.
mwaxmonsky Oct 25, 2024
4c56e8e
Merge branch 'cam_development' into vertical-diffusion-refactor
mwaxmonsky Oct 25, 2024
6561e2c
Whitespace fixes.
mwaxmonsky Oct 25, 2024
542a99b
Removing whitespace.
mwaxmonsky Oct 25, 2024
3cdeb2b
Updating atmos_phys to official release tag.
mwaxmonsky Oct 25, 2024
d6525ae
Merge branch 'cam_development' into vertical-diffusion-refactor
mwaxmonsky Oct 25, 2024
4adb65b
Updating ChangeLog
mwaxmonsky Oct 30, 2024
69253cd
Updating error list.
mwaxmonsky Oct 31, 2024
e5b6a7b
Fixing merge conflicts.
mwaxmonsky Nov 6, 2024
25a94e3
Updating Changelog to reflect latest test runs.
mwaxmonsky Nov 7, 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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
[submodule "atmos_phys"]
path = src/atmos_phys
url = https://github.com/ESCOMP/atmospheric_physics
fxtag = atmos_phys0_05_001
fxtag = atmos_phys0_06_000
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics

Expand Down
1 change: 1 addition & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,7 @@ sub write_filepath
# be overridden by modules from directories that occur earlier
# in the list of filepaths.
print $fh "$camsrcdir/src/physics/cam\n";
print $fh "$camsrcdir/src/atmos_phys/to_be_ccppized\n";

#Add the CCPP'ized subdirectories
print $fh "$camsrcdir/src/atmos_phys/schemes/tropopause_find\n";
Expand Down
16 changes: 8 additions & 8 deletions cime_config/config_pes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@
<ntasks_cpl>-4</ntasks_cpl>
</ntasks>
<nthrds>
<nthrds_atm>2</nthrds_atm>
<nthrds_lnd>2</nthrds_lnd>
<nthrds_rof>2</nthrds_rof>
<nthrds_ice>2</nthrds_ice>
<nthrds_ocn>2</nthrds_ocn>
<nthrds_glc>2</nthrds_glc>
<nthrds_wav>2</nthrds_wav>
<nthrds_cpl>2</nthrds_cpl>
<nthrds_atm>1</nthrds_atm>
<nthrds_lnd>1</nthrds_lnd>
<nthrds_rof>1</nthrds_rof>
<nthrds_ice>1</nthrds_ice>
<nthrds_ocn>1</nthrds_ocn>
<nthrds_glc>1</nthrds_glc>
<nthrds_wav>1</nthrds_wav>
<nthrds_cpl>1</nthrds_cpl>
peverwhee marked this conversation as resolved.
Show resolved Hide resolved
</nthrds>
<rootpe>
<rootpe_atm>0</rootpe_atm>
Expand Down
97 changes: 97 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,102 @@
===============================================================

Tag name: cam6_4_044
Originator(s): mwaxmonsky
Date: 10/25/2024
One-line Summary: Start refactoring of vertical diffusion to be CCPPized
Github PR URL: https://github.com/ESCOMP/CAM/pull/1176

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
Start refactoring of vertical diffusion to be CCPPized and outsources solve phase of non-graft decomp solves to atmospheric physics solver.

Describe any changes made to build system:
- Adds the to_be_ccppized directory in atmospheric_physics to source search path

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by:

List all files eliminated:
D src/utils/coords_1d.F90
D src/utils/linear_1d_operators.F90
- Files were moved to atmospheric_physics

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:
M .gitmodules
M bld/configure
M src/atmos_phys
- Update atmospheric_physics reference and added new atmospheric_physics directory to search path

M cime_config/config_pes.xml
- Decreasing NTHRDS from 2 to 1 to force single threaded execution as multithreaded execution enables the -smp flag which breaks under OpenMP when running the SE dycore, similar to #1087

M src/physics/cam/diffusion_solver.F90
- Uses new CCPPized interface for decomp that was moved to atmospheric_physics repo to single solve step.

If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:

ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: FAIL) details:
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856

SMS_D_Ln9.f19_f19_mg17.FXHIST.derecho_intel.cam-outfrq9s_amie (Overall: FAIL)
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL)
- pre-existing failures due to build-namelist error requiring CLM/CTSM external update.

derecho/nvhpc/aux_cam: None

izumi/nag/aux_cam:

DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details:
- pre-existing failure -- issue #670

izumi/gnu/aux_cam:

ERP_D_Ln9.ne3pg3_ne3pg3_mg37.FLTHIST.izumi_gnu.cam-outfrq9s (Overall: DIFF) details:
ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes (Overall: DIFF) details:
ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details:
- new tests are missing baselines

CAM tag used for the baseline comparison tests if different than previous
tag:

Summarize any changes to answers, i.e.,
- what code configurations:
- what platforms/compilers:
- nature of change (roundoff; larger than roundoff but same climate; new
climate):
N/A

If bitwise differences were observed, how did you show they were no worse
than roundoff?
N/A

If this tag changes climate describe the run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced, i.e.,
- source tag (all code used must be in the repository):
- platform/compilers:
- configure commandline:
- build-namelist command (or complete namelist):
- MSS location of output:
N/A

MSS location of control simulations used to validate new climate: N/A

URL for AMWG diagnostics output used to validate new climate: N/A

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

Tag name: cam6_4_043
Originator(s): eaton
Date: 25 Oct 2024
Expand Down
2 changes: 1 addition & 1 deletion src/atmos_phys
Submodule atmos_phys updated 42 files
+11 −1 .github/workflows/test.yaml
+27 −0 doc/ChangeLog
+122 −113 doc/NamesNotInDictionary.txt
+56 −51 schemes/musica/micm/musica_ccpp_micm.F90
+31 −54 schemes/musica/micm/musica_ccpp_micm_util.F90
+70 −44 schemes/musica/musica_ccpp.F90
+43 −1 schemes/musica/musica_ccpp.meta
+1 −1 schemes/musica/musica_ccpp_namelist.xml
+5 −3 schemes/musica/musica_ccpp_util.F90
+179 −31 schemes/musica/tuvx/musica_ccpp_tuvx.F90
+171 −0 schemes/musica/tuvx/musica_ccpp_tuvx_height_grid.F90
+70 −0 schemes/musica/tuvx/musica_ccpp_tuvx_temperature.F90
+58 −0 schemes/sima_diagnostics/kessler_diagnostics.F90
+41 −0 schemes/sima_diagnostics/kessler_diagnostics.meta
+78 −0 schemes/sima_diagnostics/scheme_diagnostics_template.F90
+180 −0 schemes/sima_diagnostics/sima_state_diagnostics.F90
+191 −0 schemes/sima_diagnostics/sima_state_diagnostics.meta
+48 −0 schemes/sima_diagnostics/sima_tend_diagnostics.F90
+53 −0 schemes/sima_diagnostics/sima_tend_diagnostics.meta
+0 −0 schemes/sima_diagnostics/tropopause_diagnostics.F90
+0 −0 schemes/sima_diagnostics/tropopause_diagnostics.meta
+4 −0 suites/suite_cam7.xml
+4 −0 suites/suite_held_suarez_1994.xml
+5 −0 suites/suite_kessler.xml
+2 −0 suites/suite_tj2016.xml
+5 −2 test/cmake/TestUtils.cmake
+10 −2 test/docker/Dockerfile.musica
+80 −0 test/docker/Dockerfile.musica.no_install
+28 −7 test/musica/CMakeLists.txt
+1 −2 test/musica/micm/CMakeLists.txt
+32 −69 test/musica/micm/test_micm_util.F90
+2 −2 test/musica/musica_ccpp_namelist.F90
+130 −123 test/musica/test_musica_api.F90
+56 −0 test/musica/tuvx/CMakeLists.txt
+0 −18 test/musica/tuvx/configs/ts1_tsmlt.json
+103 −0 test/musica/tuvx/test_tuvx_height_grid.F90
+64 −0 test/musica/tuvx/test_tuvx_temperature.F90
+38 −0 test/valgrind.supp
+50 −0 to_be_ccppized/ccpp_const_utils.F90
+152 −0 to_be_ccppized/coords_1d.F90
+1,181 −0 to_be_ccppized/linear_1d_operators.F90
+130 −0 to_be_ccppized/vertical_diffusion_solver.F90
46 changes: 20 additions & 26 deletions src/physics/cam/diffusion_solver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ subroutine compute_vdiff( lchnk ,
use linear_1d_operators, only : BoundaryType, BoundaryFixedLayer, &
BoundaryData, BoundaryFlux, TriDiagDecomp
use vdiff_lu_solver, only : fin_vol_lu_decomp
use vertical_diffusion_solver, only : fin_vol_solve
use beljaars_drag_cam, only : do_beljaars
! FIXME: This should not be needed
use air_composition, only: rairv
Expand Down Expand Up @@ -570,12 +571,15 @@ end function vd_lu_qdecomp
tau_damp_rate(:,k) = tau_damp_rate(:,k) + dragblj(:ncol,k)
end do

decomp = fin_vol_lu_decomp(ztodt, p, &
coef_q=tau_damp_rate, coef_q_diff=kvm(:ncol,:)*dpidz_sq)
v(:ncol,:) = fin_vol_solve(ztodt, p, v(:ncol,:), ncol, pver, &
coef_q=tau_damp_rate, &
coef_q_diff=kvm(:ncol,:)*dpidz_sq)

u(:ncol,:) = fin_vol_solve(ztodt, p, u(:ncol,:), ncol, pver, &
coef_q=tau_damp_rate, &
coef_q_diff=kvm(:ncol,:)*dpidz_sq)


call decomp%left_div(u(:ncol,:))
call decomp%left_div(v(:ncol,:))
call decomp%finalize()

! ---------------------------------------------------------------------- !
! Calculate 'total' ( tautotx ) and 'tms' ( tautmsx ) stresses that !
Expand Down Expand Up @@ -741,37 +745,31 @@ end function vd_lu_qdecomp

! Boundary layer thickness of "0._r8" signifies that the boundary
! condition is defined directly on the top interface.
decomp = fin_vol_lu_decomp(ztodt, p, &
coef_q_diff=kvh(:ncol,:)*dpidz_sq, &
upper_bndry=interface_boundary)

if (.not. use_spcam) then
call decomp%left_div(dse(:ncol,:), &
l_cond=BoundaryData(dse_top(:ncol)))
dse(:ncol,:) = fin_vol_solve(ztodt, p, dse(:ncol,:), ncol, pver, &
coef_q_diff=kvh(:ncol,:)*dpidz_sq, &
upper_bndry=interface_boundary, &
l_cond=BoundaryData(dse_top(:ncol)))
endif

call decomp%finalize()

! Calculate flux at top interface

! Modification : Why molecular diffusion does not work for dry static energy in all layers ?

topflx(:ncol) = - kvh(:ncol,1) * tmpi2(:ncol,1) / (ztodt*gravit) * &
( dse(:ncol,1) - dse_top(:ncol) )

decomp = fin_vol_lu_decomp(ztodt, p, &
coef_q_diff=kvt(:ncol,:)*dpidz_sq, &
coef_q_weight=cpairv(:ncol,:))

ttemp0 = t(:ncol,:)
ttemp = ttemp0

! upper boundary is zero flux for extended model
if (.not. use_spcam) then
call decomp%left_div(ttemp)
ttemp = fin_vol_solve(ztodt, p, ttemp, ncol, pver, &
coef_q_diff=kvt(:ncol,:)*dpidz_sq, &
coef_q_weight=cpairv(:ncol,:))
end if

call decomp%finalize()

!-------------------------------------
! Update dry static energy
Expand All @@ -791,17 +789,13 @@ end function vd_lu_qdecomp

! Boundary layer thickness of "0._r8" signifies that the boundary
! condition is defined directly on the top interface.
decomp = fin_vol_lu_decomp(ztodt, p, &
coef_q_diff=kv_total(:ncol,:)*dpidz_sq, &
upper_bndry=interface_boundary)

if (.not. use_spcam) then
call decomp%left_div(dse(:ncol,:), &
l_cond=BoundaryData(dse_top(:ncol)))
dse(:ncol,:) = fin_vol_solve(ztodt, p, dse(:ncol,:), ncol, pver, &
coef_q_diff=kv_total(:ncol,:)*dpidz_sq, &
upper_bndry=interface_boundary, &
l_cond=BoundaryData(dse_top(:ncol)))
end if

call decomp%finalize()

! Calculate flux at top interface

! Modification : Why molecular diffusion does not work for dry static energy in all layers ?
Expand Down
151 changes: 0 additions & 151 deletions src/utils/coords_1d.F90

This file was deleted.

Loading
Loading