Skip to content

Commit 7502085

Browse files
authored
Merge pull request #1176 from mwaxmonsky/vertical-diffusion-refactor
cam6_4_045: Vertical diffusion refactor
2 parents 016ffe2 + 25a94e3 commit 7502085

File tree

8 files changed

+124
-1367
lines changed

8 files changed

+124
-1367
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
[submodule "atmos_phys"]
3737
path = src/atmos_phys
3838
url = https://github.com/ESCOMP/atmospheric_physics
39-
fxtag = atmos_phys0_05_001
39+
fxtag = atmos_phys0_06_000
4040
fxrequired = AlwaysRequired
4141
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
4242

bld/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,7 @@ sub write_filepath
23352335
# be overridden by modules from directories that occur earlier
23362336
# in the list of filepaths.
23372337
print $fh "$camsrcdir/src/physics/cam\n";
2338+
print $fh "$camsrcdir/src/atmos_phys/to_be_ccppized\n";
23382339

23392340
#Add the CCPP'ized subdirectories
23402341
print $fh "$camsrcdir/src/atmos_phys/schemes/tropopause_find\n";

cime_config/config_pes.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@
164164
<ntasks_cpl>-4</ntasks_cpl>
165165
</ntasks>
166166
<nthrds>
167-
<nthrds_atm>2</nthrds_atm>
168-
<nthrds_lnd>2</nthrds_lnd>
169-
<nthrds_rof>2</nthrds_rof>
170-
<nthrds_ice>2</nthrds_ice>
171-
<nthrds_ocn>2</nthrds_ocn>
172-
<nthrds_glc>2</nthrds_glc>
173-
<nthrds_wav>2</nthrds_wav>
174-
<nthrds_cpl>2</nthrds_cpl>
167+
<nthrds_atm>1</nthrds_atm>
168+
<nthrds_lnd>1</nthrds_lnd>
169+
<nthrds_rof>1</nthrds_rof>
170+
<nthrds_ice>1</nthrds_ice>
171+
<nthrds_ocn>1</nthrds_ocn>
172+
<nthrds_glc>1</nthrds_glc>
173+
<nthrds_wav>1</nthrds_wav>
174+
<nthrds_cpl>1</nthrds_cpl>
175175
</nthrds>
176176
<rootpe>
177177
<rootpe_atm>0</rootpe_atm>

doc/ChangeLog

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,98 @@
11
===============================================================
22

3+
Tag name: cam6_4_045
4+
Originator(s): mwaxmonsky
5+
Date: 10/25/2024
6+
One-line Summary: Start refactoring of vertical diffusion to be CCPPized
7+
Github PR URL: https://github.com/ESCOMP/CAM/pull/1176
8+
9+
Purpose of changes (include the issue number and title text for each relevant GitHub issue):
10+
Start refactoring of vertical diffusion to be CCPPized and outsources solve phase of non-graft decomp solves to atmospheric physics solver.
11+
12+
Describe any changes made to build system:
13+
- Adds the to_be_ccppized directory in atmospheric_physics to source search path
14+
15+
Describe any changes made to the namelist: N/A
16+
17+
List any changes to the defaults for the boundary datasets: N/A
18+
19+
Describe any substantial timing or memory changes: N/A
20+
21+
Code reviewed by:
22+
23+
List all files eliminated:
24+
D src/utils/coords_1d.F90
25+
D src/utils/linear_1d_operators.F90
26+
- Files were moved to atmospheric_physics
27+
28+
List all files added and what they do: N/A
29+
30+
List all existing files that have been modified, and describe the changes:
31+
M .gitmodules
32+
M bld/configure
33+
M src/atmos_phys
34+
- Update atmospheric_physics reference and added new atmospheric_physics directory to search path
35+
36+
M cime_config/config_pes.xml
37+
- 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
38+
39+
M src/physics/cam/diffusion_solver.F90
40+
- Uses new CCPPized interface for decomp that was moved to atmospheric_physics repo to single solve step.
41+
42+
If there were any failures reported from running test_driver.sh on any test
43+
platform, and checkin with these failures has been OK'd by the gatekeeper,
44+
then copy the lines from the td.*.status files for the failed tests to the
45+
appropriate machine below. All failed tests must be justified.
46+
47+
derecho/intel/aux_cam:
48+
49+
ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL) details:
50+
SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: FAIL) details:
51+
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856
52+
53+
SMS_D_Ln9.f19_f19_mg17.FXHIST.derecho_intel.cam-outfrq9s_amie (Overall: FAIL)
54+
SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL)
55+
- pre-existing failures due to build-namelist error requiring CLM/CTSM external update.
56+
57+
derecho/nvhpc/aux_cam: All PASS
58+
59+
izumi/nag/aux_cam:
60+
61+
DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details:
62+
- pre-existing failure -- issue #670
63+
64+
izumi/gnu/aux_cam: All PASS
65+
66+
CAM tag used for the baseline comparison tests if different than previous
67+
tag:
68+
69+
Summarize any changes to answers, i.e.,
70+
- what code configurations:
71+
- what platforms/compilers:
72+
- nature of change (roundoff; larger than roundoff but same climate; new
73+
climate):
74+
N/A
75+
76+
If bitwise differences were observed, how did you show they were no worse
77+
than roundoff?
78+
N/A
79+
80+
If this tag changes climate describe the run(s) done to evaluate the new
81+
climate in enough detail that it(they) could be reproduced, i.e.,
82+
- source tag (all code used must be in the repository):
83+
- platform/compilers:
84+
- configure commandline:
85+
- build-namelist command (or complete namelist):
86+
- MSS location of output:
87+
N/A
88+
89+
MSS location of control simulations used to validate new climate: N/A
90+
91+
URL for AMWG diagnostics output used to validate new climate: N/A
92+
93+
===============================================================
94+
===============================================================
95+
396
Tag name: cam6_4_044
497
Originator(s): eaton
598
Date: 04 November 2024

src/atmos_phys

Submodule atmos_phys updated 42 files

src/physics/cam/diffusion_solver.F90

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ subroutine compute_vdiff( lchnk ,
161161
use linear_1d_operators, only : BoundaryType, BoundaryFixedLayer, &
162162
BoundaryData, BoundaryFlux, TriDiagDecomp
163163
use vdiff_lu_solver, only : fin_vol_lu_decomp
164+
use vertical_diffusion_solver, only : fin_vol_solve
164165
use beljaars_drag_cam, only : do_beljaars
165166
! FIXME: This should not be needed
166167
use air_composition, only: rairv
@@ -570,12 +571,15 @@ end function vd_lu_qdecomp
570571
tau_damp_rate(:,k) = tau_damp_rate(:,k) + dragblj(:ncol,k)
571572
end do
572573

573-
decomp = fin_vol_lu_decomp(ztodt, p, &
574-
coef_q=tau_damp_rate, coef_q_diff=kvm(:ncol,:)*dpidz_sq)
574+
v(:ncol,:) = fin_vol_solve(ztodt, p, v(:ncol,:), ncol, pver, &
575+
coef_q=tau_damp_rate, &
576+
coef_q_diff=kvm(:ncol,:)*dpidz_sq)
577+
578+
u(:ncol,:) = fin_vol_solve(ztodt, p, u(:ncol,:), ncol, pver, &
579+
coef_q=tau_damp_rate, &
580+
coef_q_diff=kvm(:ncol,:)*dpidz_sq)
581+
575582

576-
call decomp%left_div(u(:ncol,:))
577-
call decomp%left_div(v(:ncol,:))
578-
call decomp%finalize()
579583

580584
! ---------------------------------------------------------------------- !
581585
! Calculate 'total' ( tautotx ) and 'tms' ( tautmsx ) stresses that !
@@ -741,37 +745,31 @@ end function vd_lu_qdecomp
741745

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

748749
if (.not. use_spcam) then
749-
call decomp%left_div(dse(:ncol,:), &
750-
l_cond=BoundaryData(dse_top(:ncol)))
750+
dse(:ncol,:) = fin_vol_solve(ztodt, p, dse(:ncol,:), ncol, pver, &
751+
coef_q_diff=kvh(:ncol,:)*dpidz_sq, &
752+
upper_bndry=interface_boundary, &
753+
l_cond=BoundaryData(dse_top(:ncol)))
751754
endif
752755

753-
call decomp%finalize()
754-
755756
! Calculate flux at top interface
756757

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

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

762-
decomp = fin_vol_lu_decomp(ztodt, p, &
763-
coef_q_diff=kvt(:ncol,:)*dpidz_sq, &
764-
coef_q_weight=cpairv(:ncol,:))
765-
766763
ttemp0 = t(:ncol,:)
767764
ttemp = ttemp0
768765

769766
! upper boundary is zero flux for extended model
770767
if (.not. use_spcam) then
771-
call decomp%left_div(ttemp)
768+
ttemp = fin_vol_solve(ztodt, p, ttemp, ncol, pver, &
769+
coef_q_diff=kvt(:ncol,:)*dpidz_sq, &
770+
coef_q_weight=cpairv(:ncol,:))
772771
end if
773772

774-
call decomp%finalize()
775773

776774
!-------------------------------------
777775
! Update dry static energy
@@ -791,17 +789,13 @@ end function vd_lu_qdecomp
791789

792790
! Boundary layer thickness of "0._r8" signifies that the boundary
793791
! condition is defined directly on the top interface.
794-
decomp = fin_vol_lu_decomp(ztodt, p, &
795-
coef_q_diff=kv_total(:ncol,:)*dpidz_sq, &
796-
upper_bndry=interface_boundary)
797-
798792
if (.not. use_spcam) then
799-
call decomp%left_div(dse(:ncol,:), &
800-
l_cond=BoundaryData(dse_top(:ncol)))
793+
dse(:ncol,:) = fin_vol_solve(ztodt, p, dse(:ncol,:), ncol, pver, &
794+
coef_q_diff=kv_total(:ncol,:)*dpidz_sq, &
795+
upper_bndry=interface_boundary, &
796+
l_cond=BoundaryData(dse_top(:ncol)))
801797
end if
802798

803-
call decomp%finalize()
804-
805799
! Calculate flux at top interface
806800

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

src/utils/coords_1d.F90

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)