Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
d88b8f1
Add some additional timers around decomp level activity
ekluzek Jun 26, 2025
6cf4b8e
Start adding control for decomp_init self tests and add ability for s…
ekluzek Jun 26, 2025
ae5435b
Merge remote-tracking branch 'escomp/b4b-dev' into add_decomp_init_se…
ekluzek Jun 26, 2025
a27de36
Add namelist controls for self testing
ekluzek Jun 27, 2025
2fd081b
Changes to exit early when self test namelist option used for_testing…
ekluzek Jul 2, 2025
c90d475
Merge branch 'b4b-dev' into add_decomp_init_self_tests
ekluzek Jul 9, 2025
6eaadd4
Bring in the share branch with the memory logger from John Dennis
ekluzek Jul 11, 2025
3a94e8e
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_study_…
ekluzek Jul 11, 2025
f18e4b0
Update proc_status_vm to use shr_sys_abort, and iulog from shr_log, a…
ekluzek Jul 11, 2025
71de4c9
Turn off restarts and history and add some timer options as well as t…
ekluzek Jul 11, 2025
efd2129
Fix proc_status_vm from the changes I made, it's now reporting properly
ekluzek Jul 14, 2025
d9e212b
Fix proc_status_vm from the changes I made, it's now reporting properly
ekluzek Jul 14, 2025
213ff9c
Add calls for evaluating memory
ekluzek Jul 14, 2025
0abc15c
Put memory stuff only under masterproc to only report on a single tas…
ekluzek Jul 15, 2025
c1bfd83
Add a PE layout for mpas13p75
ekluzek Jul 29, 2025
3a32519
Start adding timers to lnd_set_decomp_and_domain_from_readmesh
ekluzek Jul 29, 2025
33c8f75
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_study_…
ekluzek Jul 29, 2025
d531303
Turn off RTM rather than increase the ROF coupling frequency
ekluzek Jul 30, 2025
402584e
Turn off urban HAC completely and minimize urban in gridcells
ekluzek Jul 30, 2025
31ad846
Add a testmod for mpasa3p75 grid
ekluzek Jul 30, 2025
be81f3a
Add decomp initialization test and test list for ultra high resolutio…
ekluzek Jul 30, 2025
95ab014
Fix syntax and correct 3p75 resolution grid name for test
ekluzek Jul 30, 2025
6ee9077
Still need to set NCPL_ROF
ekluzek Jul 30, 2025
f03a0eb
Fix name of mpasa3p75 testmod in test
ekluzek Jul 30, 2025
ed4c49e
Fix syntax error
ekluzek Jul 30, 2025
b5ab98c
Remove the mpasa15 test from expected fails
ekluzek Jul 30, 2025
8914b12
Add timers for clm_initialize2 that cover the whole subroutine
ekluzek Jul 31, 2025
f294b31
Add another timer within part3, and also turn off some of the history…
ekluzek Jul 31, 2025
1bd2408
Balance check doesn't take time, so adjust the timers again for part3
ekluzek Jul 31, 2025
60bd85e
Add memory checking calls through the lnd_set_decomp_and_domain_from_…
ekluzek Aug 1, 2025
8c5debb
Remove one of the memory checks as it wasn't needed
ekluzek Aug 1, 2025
3f5cff5
Add some timers for clmInstInit
ekluzek Aug 1, 2025
b30d9e0
Combine timers for part3/4/5 as they are all small
ekluzek Aug 1, 2025
373b84c
Add timers for urbantv Init and InitVertical
ekluzek Aug 1, 2025
4f7de29
Add a timer around just the strdata_init
ekluzek Aug 1, 2025
7f03d77
Make an internal subroutine for deallocation inside of lnd_set_decomp…
ekluzek Aug 1, 2025
02f894e
Add release of the ESMF objects in the lnd_set_decomp_and_domain_from…
ekluzek Aug 1, 2025
57b04cd
ESMF tells me that some of these objects are used later and can not b…
ekluzek Aug 1, 2025
8cf101a
Turn on removing all ESMF garbage for the things deleted, and add not…
ekluzek Aug 1, 2025
b47ef38
Merge remote-tracking branch 'escomp/b4b-dev' into add_decomp_init_se…
ekluzek Aug 1, 2025
47dbc1b
Remove the mpasa15 test from expected fails
ekluzek Jul 30, 2025
5bc62fa
Turn off restarts and history and add some timer options as well as t…
ekluzek Jul 11, 2025
f1a4277
Turn off RTM rather than increase the ROF coupling frequency
ekluzek Jul 30, 2025
2b9746b
Still need to set NCPL_ROF
ekluzek Jul 30, 2025
60425cd
Fix syntax error
ekluzek Jul 30, 2025
ccdd13c
Fix XML name for RTM_MODE
ekluzek Aug 1, 2025
9908a81
Fix XML name for RTM_MODE
ekluzek Aug 1, 2025
8fc95c1
Turn off urban HAC completely and minimize urban in gridcells
ekluzek Jul 30, 2025
19fb93d
Keep all self tests on
ekluzek Aug 2, 2025
03722cd
Call shr_malloc_trim so that memory is released by the OS after the d…
ekluzek Aug 4, 2025
635c124
Merge remote-tracking branch 'ekluzek/add_decomp_init_self_tests' int…
ekluzek Aug 4, 2025
4483944
Change memory check to a utility function to call that does everythin…
ekluzek Aug 4, 2025
8cd61a5
Clarify memory check logging
ekluzek Aug 5, 2025
e930f1d
Deallocate lndfrac_loc_input
ekluzek Aug 5, 2025
7b1d3ea
Add timers
ekluzek Aug 6, 2025
6237542
Add more timers
ekluzek Aug 6, 2025
7332c89
Update cdeps with more timers
ekluzek Aug 6, 2025
44a3b45
Add asserts for scalars and also text scalars
ekluzek Aug 11, 2025
82964a0
Add some interfaces and handling for self tests
ekluzek Aug 11, 2025
3e93968
Start adding tests for DecompInit
ekluzek Aug 11, 2025
da2fe56
Start adding tests for DecompInit
ekluzek Aug 11, 2025
d4522af
Add some more logging about self-tests options, and add a normal term…
ekluzek Aug 11, 2025
0481f89
Add return's after endrun calls so that the self-tests can trap expec…
ekluzek Aug 11, 2025
fa64311
Change the endrun message so that it can be tested for
ekluzek Aug 12, 2025
b134a3d
Add more logging, correct the clump_pproc test, flush log write each …
ekluzek Aug 12, 2025
22088aa
Remove ending whitespace, add logging about exiting self-tests, and a…
ekluzek Aug 12, 2025
4b83e4a
Remove terminate_early_without_error because it fails with timers tha…
ekluzek Aug 12, 2025
00f8335
Use iulog at top of module to be available throughout
ekluzek Aug 12, 2025
808720a
Add some new tests for fails that currently fail on the first one
ekluzek Aug 12, 2025
7098a88
Merge branch 'b4b-dev' into decomp_init_for_testing_work
ekluzek Aug 13, 2025
0855d55
Merge remote-tracking branch 'ekluzek/mpasa3p75' into decomp_init_for…
ekluzek Aug 13, 2025
cbf67ec
Merge branch 'endrun_work' into decomp_init_for_testing_work
ekluzek Aug 17, 2025
7c09803
Seperate run_self_tests into a test mod that just sets up the testing…
ekluzek Aug 17, 2025
476088c
Seperate out decomp_init test list into production tests for timing, …
ekluzek Aug 17, 2025
c90b57e
Merge branch 'endrun_work' into decomp_init_for_testing_work
ekluzek Aug 17, 2025
8c2ad44
Make the grid size much smaller and save it at the top of the module,…
ekluzek Aug 20, 2025
9d236ca
Change endrun calls to use new format for file and line, and remove t…
ekluzek Aug 20, 2025
a5612b3
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 20, 2025
d4ef84a
Make decomp_init single grid case run with mpi-serial
ekluzek Aug 20, 2025
d3178e1
Add for_testing options to namelist handling to bypass init and run
ekluzek Aug 21, 2025
d65ecfb
Turn the bypass init and run logicals for testing on
ekluzek Aug 21, 2025
96e0c94
Add a namelist read and some logical settings to bypass init and run …
ekluzek Aug 21, 2025
f6272ef
Merge remote-tracking branch 'escomp/b4b-dev' into for_testing_bypass…
ekluzek Aug 21, 2025
7006740
Add use of abortutils so can make endrun calls
ekluzek Aug 21, 2025
a1fbe32
Add another error check test, this should fail, as it isn't handeled
ekluzek Aug 22, 2025
ebc6fa4
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 22, 2025
06daca4
Merge branch 'for_testing_bypass_framework' into decomp_init_for_test…
ekluzek Aug 22, 2025
93628b2
Add bypassing the run phase in the for_testing tests, and remove it f…
ekluzek Aug 22, 2025
208a6d2
Remove some of the previous bypassing changes that aren't needed here
ekluzek Aug 22, 2025
bf663d4
Merge branch 'for_testing_bypass_framework' into decomp_init_for_test…
ekluzek Aug 22, 2025
28834c9
Update bld/namelist_files/namelist_definition_ctsm.xml
ekluzek Aug 22, 2025
92c9a3c
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 23, 2025
62f3faf
decompInit/decompMod: initialize pointers to null, add checking that …
ekluzek Aug 25, 2025
45903c2
Add a standard ERP test with threading on to the decomp_init testlist…
ekluzek Aug 25, 2025
76d1f5f
Update the share code with a reset option, which turns out to not be …
ekluzek Aug 25, 2025
4bc13a3
Allow get_proc_bounds to exit early if only b3gg/endg will be needed,…
ekluzek Aug 26, 2025
469c108
Return up the chain in decompInit after endrun, for the testing. Do s…
ekluzek Aug 27, 2025
12da9cb
Bypass more code after running the self tests
ekluzek Aug 27, 2025
d325b87
Add calls to redo the decomp calls on the full grid so that get_proc_…
ekluzek Aug 27, 2025
d92cb69
Move bypass code around a bit so that most timers aren't half in/half…
ekluzek Aug 27, 2025
188f229
Also bypass the import fields for_testing option, and move the decomp…
ekluzek Aug 27, 2025
1c17af4
Add unit_test_shr directory to the main model build
ekluzek Aug 29, 2025
f65b59b
Move the get_proc_bounds to inside the bypass
ekluzek Aug 29, 2025
01f2659
Add more tests, remove redoing the decomp with the full grid after th…
ekluzek Aug 29, 2025
9dcf9ab
Move comment over for clarity
ekluzek Aug 29, 2025
9289808
Add a MPI_SCAN as a temporary to start testing how it works and compa…
ekluzek Sep 2, 2025
62e63f6
Fix accidental typo that made it in, that doesn't compile
ekluzek Sep 2, 2025
1a24943
Change the test grid total size to 384 so can be divisible by either …
ekluzek Sep 2, 2025
a3eb6bb
Start filling other procinfo settings with mpi_scan, this passes for …
ekluzek Sep 5, 2025
5f97c99
Remove the mpiscan bit about clumpcnt
ekluzek Sep 5, 2025
c592c5b
Don't do the abort testing if not serial as different tasks won't be …
ekluzek Sep 6, 2025
ce2cd51
Add global i,j indices for each gridcell on a processor to the proces…
ekluzek Sep 6, 2025
5e0c6d4
Add more testing, test new processor_type methods, set gindex_global …
ekluzek Sep 6, 2025
f87db23
Can't do this test yest, as only gridcells are set at this point and …
ekluzek Sep 6, 2025
7cb9d20
Fix setting of gi and gj indices, the serial case runs to completion now
ekluzek Sep 8, 2025
2b15296
Change a test to make it valid for clump_pproc or not
ekluzek Sep 8, 2025
35730c8
Add ggidx global index to the processor_type, allocate, set and deall…
ekluzek Sep 8, 2025
495efe6
Correct the indexing for ggidx
ekluzek Sep 9, 2025
418ee1f
Remove the prints that weren't with an abort
ekluzek Sep 9, 2025
a69339a
Get it working for a threaded case, by adding an additional loop over…
ekluzek Sep 9, 2025
151e76b
Add more testing for correctness, add some notes about what can be re…
ekluzek Sep 11, 2025
e854b1f
Commit share directory with the latest update
ekluzek Sep 11, 2025
dd2a58e
Get it working for the threaded case
ekluzek Sep 12, 2025
57e54ce
Merge remote-tracking branch 'escomp/b4b-dev' into mpi_scan
ekluzek Sep 12, 2025
c8c4926
Comment out the old code and just use the new MPI_SCAN way, this work…
ekluzek Sep 13, 2025
c87adff
Just do the checking over the local processor clumps and not all the …
ekluzek Sep 14, 2025
5497b57
Merge branch 'b4b-dev' into mpi_scan
ekluzek Sep 23, 2025
256e692
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Sep 23, 2025
0137dc2
Merge branch 'for_testing_bypass_framework' of github.com:ekluzek/CTS…
ekluzek Sep 23, 2025
5054bbd
Merge branch 'b4b-dev' into mpi_scan
ekluzek Sep 24, 2025
5b71323
Revert the timers added so going back to 64c700667b41b7631ba77cacf42e…
ekluzek Sep 29, 2025
522ad55
Merge branch 'b4b-dev' into mpi_scan
ekluzek Sep 29, 2025
46f1e2a
Remove extra timers branch in cdeps
ekluzek Sep 29, 2025
ad97c28
Fix the placement of the t_stopf for the final readmesh timer was out…
ekluzek Sep 29, 2025
dcdc1ed
Remove the decompInit_lnd old code commented out, and extra writes to…
ekluzek Sep 29, 2025
4e501a9
Initialize the gi/gj arrays to unset
ekluzek Sep 29, 2025
69792af
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Sep 29, 2025
de1ca06
Add namelist controls for self testing
ekluzek Jun 27, 2025
c1c7ca3
Add unit_test_shr directory to the main model build
ekluzek Aug 29, 2025
db4551c
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 23, 2025
cb8e7ec
Merge remote-tracking branch 'escomp/b4b-dev' into decomp_init_for_te…
ekluzek Aug 22, 2025
09aa5ac
Balance check doesn't take time, so adjust the timers again for part3
ekluzek Jul 31, 2025
bf498ab
Add another timer within part3, and also turn off some of the history…
ekluzek Jul 31, 2025
3c54060
Add timers for clm_initialize2 that cover the whole subroutine
ekluzek Jul 31, 2025
ce2d68b
Change the test grid total size to 384 so can be divisible by either …
ekluzek Sep 2, 2025
2fc723f
Don't do the abort testing if not serial as different tasks won't be …
ekluzek Sep 6, 2025
d8d656b
Change a test to make it valid for clump_pproc or not
ekluzek Sep 8, 2025
4ce6b5f
Just do the checking over the local processor clumps and not all the …
ekluzek Sep 14, 2025
6531dcf
Remove the uneeded timers and get back to the 3 part timers as they s…
ekluzek Oct 1, 2025
7dc7dcd
Resolve the conflicts
ekluzek Oct 1, 2025
2a46724
Remove some of the previous bypassing changes that aren't needed here
ekluzek Aug 22, 2025
c95b886
Move bypass code around a bit so that most timers aren't half in/half…
ekluzek Aug 27, 2025
86382c6
Also bypass the import fields for_testing option, and move the decomp…
ekluzek Aug 27, 2025
dac0ae0
Move the get_proc_bounds to inside the bypass
ekluzek Aug 29, 2025
e867afe
Changes to exit early when self test namelist option used for_testing…
ekluzek Jul 2, 2025
d19b894
Add asserts for scalars and also text scalars
ekluzek Aug 11, 2025
a5d5b5c
Revert most of 2fd081b544 so removing the changes regarding the addit…
ekluzek Oct 1, 2025
b3185c0
Move some for_testing namelist items into the selftests driver namelist
ekluzek Oct 1, 2025
1acf630
Remove the uneeded timers and get back to the 3 part timers as they s…
ekluzek Oct 1, 2025
2636975
Remove some changes from the baseline code that aren't needed especia…
ekluzek Oct 1, 2025
def2c97
Remove TestDecompInit for now, bring it in, in another PR
ekluzek Oct 2, 2025
bf947fb
Remove the update to Assertions and bring it in, in another PR
ekluzek Oct 2, 2025
80192dc
Remove update in DecompInitMod for now
ekluzek Oct 2, 2025
df19381
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Oct 3, 2025
417922d
Merge branch 'b4b-dev' into for_testing_bypass_framework
ekluzek Oct 4, 2025
b53eab9
Merge branch 'for_testing_bypass_framework' into mpi_scan
ekluzek Oct 6, 2025
ef59381
Merge remote-tracking branch 'escomp/b4b-dev' into mpi_scan
ekluzek Nov 3, 2025
77126f0
Remove the for_testing_bypass_init namelist option as the exit after …
ekluzek Nov 3, 2025
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
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ fxDONOTUSEurl = https://github.com/ESCOMP/CDEPS.git

[submodule "share"]
path = share
url = https://github.com/ESCOMP/CESM_share
fxtag = share1.1.9
#url = https://github.com/ESCOMP/CESM_share
url = https://github.com/ekluzek/CESM_share
#fxtag = share1.1.9
#fxtag = add_jdennis_procstatus_module
fxtag = 1a871cad0a90f8a361196f045313cca1919c7cbc
fxrequired = ToplevelRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/ESCOMP/CESM_share
Expand Down
1 change: 1 addition & 0 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5319,6 +5319,7 @@ sub write_output_files {
push @groups, "clm_canopy_inparm";
push @groups, "prigentroughness";
push @groups, "zendersoilerod";
push @groups, "for_testing_options";
if (remove_leading_and_trailing_quotes($nl->get_value('snow_cover_fraction_method')) eq 'SwensonLawrence2012') {
push @groups, "scf_swenson_lawrence_2012_inparm";
}
Expand Down
23 changes: 22 additions & 1 deletion bld/namelist_files/namelist_definition_ctsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1259,12 +1259,33 @@ Whether to use subgrid fluxes for snow
Whether snow on the vegetation canopy affects the radiation/albedo calculations
</entry>

<!-- ======================================================================================== -->
<!-- Namelist items for doing specific things for testing -->
<!-- for_testing section: -->
<!-- ======================================================================================== -->

<entry id="for_testing_bypass_run" type="logical" category="default_settings"
group="for_testing_options" >
For testing whether to bypass most of the run phase other than the clock advance
</entry>

<entry id="for_testing_exit_after_self_tests" type="logical" category="default_settings"
group="for_testing_options" >
Whether to exit early after the initialization self tests are run. This is typically only used in automated tests.
</entry>

<entry id="for_testing_run_ncdiopio_tests" type="logical" category="default_settings"
group="clm_inparm" >
group="for_testing_options" >
Whether to run some tests of ncdio_pio as part of the model run. This is
typically only used in automated tests.
</entry>

<entry id="for_testing_run_decomp_init_tests" type="logical" category="default_settings"
group="for_testing_options" >
Whether to run some tests of decompInit (to get the gridcell to MPI task decomposition) as part of the model run. This is
typically only used in automated tests.
</entry>

<entry id="for_testing_use_second_grain_pool" type="logical" category="default_settings"
group="clm_inparm" >
If true, allocate memory for and use a second crop grain pool. This is
Expand Down
1 change: 1 addition & 0 deletions cime_config/buildlib
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def _main_func():
os.path.join(lnd_root, "src", "dyn_subgrid"),
os.path.join(lnd_root, "src", "init_interp"),
os.path.join(lnd_root, "src", "self_tests"),
os.path.join(lnd_root, "src", "unit_test_shr"),
os.path.join(lnd_root, "src", "fates"),
os.path.join(lnd_root, "src", "fates", "main"),
os.path.join(lnd_root, "src", "fates", "biogeophys"),
Expand Down
7 changes: 0 additions & 7 deletions cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,6 @@

<!-- decomp_init test list-->

<test name="SMS_Ln1_PL.mpasa15_mpasa15.I2000Clm45Sp.derecho_intel.clm-run_self_tests">
<phase name="RUN">
<status>FAIL</status>
<issue>#3316</issue>
</phase>
</test>

<!-- interim_restart (and aux_clm) test list-->

<test name="ERR_Ld7.f10_f10_mg37.I2000Clm50BgcCropRtm.derecho_gnu.clm-default">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
! Exit early and bypass the run phase
for_testing_exit_after_self_tests = .true.

! Turn off history, restarts, and output
hist_empty_htapes = .true.
use_noio = .true.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
./xmlchange CLM_FORCE_COLDSTART="on"

# We use this testmod in a _Ln1 test; this requires forcing the ROF coupling frequency to every time step
./xmlchange ROF_NCPL=48

# Restarts aren't allowed for these tests, and turn off CPL history
./xmlchange REST_OPTION="never"
./xmlchange HIST_OPTION="never"
10 changes: 10 additions & 0 deletions cime_config/testdefs/testmods_dirs/clm/run_self_tests/user_nl_clm
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
! Bypass as much of the init phase as can be done
! Bypassing the run phase already was inherited from the for_testing_fastsetup_bypassrun testmod
for_testing_bypass_init = .true.

! Turn on some of the self tests
for_testing_run_ncdiopio_tests = .true.
for_testing_run_decomp_init_tests = .true.

! Turn off history, restarts, and output
hist_empty_htapes = .true.
use_noio = .true.
for_testing_run_decomp_init_tests = .true.

! Exit initialization phase after the self tests
for_testing_bypass_init = .true.
2 changes: 1 addition & 1 deletion share
Submodule share updated from 14338b to 1a871c
50 changes: 46 additions & 4 deletions src/cpl/nuopc/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module lnd_comp_nuopc
use clm_varctl , only : single_column, clm_varctl_set, iulog
use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch
use clm_varctl , only : FL => fname_len
use clm_varctl , only : for_testing_exit_after_self_tests
use clm_time_manager , only : set_timemgr_init, advance_timestep
use clm_time_manager , only : update_rad_dtime
use clm_time_manager , only : get_nstep, get_step_size
Expand All @@ -49,6 +50,7 @@ module lnd_comp_nuopc
use lnd_import_export , only : advertise_fields, realize_fields, import_fields, export_fields
use lnd_comp_shr , only : mesh, model_meshfile, model_clock
use perf_mod , only : t_startf, t_stopf, t_barrierf
use SelfTestDriver , only : for_testing_exit_after_self_tests

implicit none
private ! except
Expand Down Expand Up @@ -80,6 +82,7 @@ module lnd_comp_nuopc

logical :: glc_present
logical :: rof_prognostic
logical :: atm_present
logical :: atm_prognostic
integer, parameter :: dbug = 0
character(*),parameter :: modName = "(lnd_comp_nuopc)"
Expand Down Expand Up @@ -284,6 +287,11 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
else
atm_prognostic = .true.
end if
if (trim(atm_model) == 'satm') then
atm_present = .false.
else
atm_present = .true.
end if
call NUOPC_CompAttributeGet(gcomp, name='GLC_model', value=glc_model, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (trim(glc_model) == 'sglc') then
Expand All @@ -310,6 +318,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
write(iulog,'(a )')' rof component = '//trim(rof_model)
write(iulog,'(a )')' glc component = '//trim(glc_model)
write(iulog,'(a,L2)')' atm_prognostic = ',atm_prognostic
if (.not. atm_present) then
write(iulog,'(a,L2)')' atm_present = ',atm_present
end if
write(iulog,'(a,L2)')' rof_prognostic = ',rof_prognostic
write(iulog,'(a,L2)')' glc_present = ',glc_present
if (glc_present) then
Expand All @@ -328,7 +339,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call control_setNL("lnd_in"//trim(inst_suffix))


call advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, atm_prognostic, rc)
call advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, &
atm_prognostic, atm_present, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!----------------------------------------------------------------------------
Expand All @@ -351,6 +363,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_from_readmesh
use lnd_set_decomp_and_domain , only : lnd_set_mesh_for_single_column
use lnd_set_decomp_and_domain , only : lnd_set_decomp_and_domain_for_single_column
use SelfTestDriver , only : for_testing_bypass_init_after_self_tests, &
for_testing_exit_after_self_tests

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -500,6 +514,12 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
else
single_column = .false.
end if
!if ( for_testing_exit_after_self_tests) then
! *******************
! *** RETURN HERE ***
! *******************
!RETURN
!end if

!----------------------------------------------------------------------------
! Reset shr logging to my log file
Expand Down Expand Up @@ -676,14 +696,19 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
call t_startf('clm_init2')
call initialize2(ni, nj, currtime)
call t_stopf('clm_init2')
if (for_testing_exit_after_self_tests) then
RETURN
end if

!--------------------------------
! Create land export state
!--------------------------------
if ( .not. for_testing_bypass_init_after_self_tests() ) then
call get_proc_bounds(bounds)
call export_fields(gcomp, bounds, glc_present, rof_prognostic, &
water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

! Set scalars in export state
call State_SetScalar(dble(ldomain%ni), flds_scalar_index_nx, exportState, &
Expand Down Expand Up @@ -731,6 +756,7 @@ subroutine ModelAdvance(gcomp, rc)
use clm_instMod , only : water_inst, atm2lnd_inst, glc2lnd_inst, lnd2atm_inst, lnd2glc_inst
use decompMod , only : bounds_type, get_proc_bounds
use clm_driver , only : clm_drv
use SelfTestDriver, only : for_testing_bypass_init_after_self_tests

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down Expand Up @@ -786,6 +812,9 @@ subroutine ModelAdvance(gcomp, rc)
if (single_column .and. .not. scol_valid) then
RETURN
end if
!if (for_testing_exit_after_self_tests) then
! RETURN
!end if

!$ call omp_set_num_threads(nthrds)

Expand Down Expand Up @@ -818,16 +847,20 @@ subroutine ModelAdvance(gcomp, rc)
flds_scalar_index_nextsw_cday, nextsw_cday, &
flds_scalar_name, flds_scalar_num, rc)

! Get proc bounds
call get_proc_bounds(bounds)

!--------------------------------
! Unpack import state
!--------------------------------

if ( .not. for_testing_bypass_init_after_self_tests() ) then
! Get proc bounds for both import and export
call get_proc_bounds(bounds)

call t_startf ('lc_lnd_import')
call import_fields( gcomp, bounds, glc_present, rof_prognostic, &
atm2lnd_inst, glc2lnd_inst, water_inst%wateratm2lndbulk_inst, rc )
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call t_stopf ('lc_lnd_import')
end if

!--------------------------------
! Run model
Expand Down Expand Up @@ -917,9 +950,13 @@ subroutine ModelAdvance(gcomp, rc)
! Pack export state
!--------------------------------

if ( .not. for_testing_bypass_init_after_self_tests() ) then
call t_startf ('lc_lnd_export')
call export_fields(gcomp, bounds, glc_present, rof_prognostic, &
water_inst%waterlnd2atmbulk_inst, lnd2atm_inst, lnd2glc_inst, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call t_stopf ('lc_lnd_export')
end if

!--------------------------------
! Advance ctsm time step
Expand Down Expand Up @@ -1009,6 +1046,7 @@ subroutine ModelSetRunClock(gcomp, rc)
rc = ESMF_SUCCESS
call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
if (.not. scol_valid) return
!if (for_testing_exit_after_self_tests) return

! query the Component for its clocks
call NUOPC_ModelGet(gcomp, driverClock=dclock, modelClock=mclock, rc=rc)
Expand Down Expand Up @@ -1292,6 +1330,7 @@ subroutine clm_orbital_update(clock, logunit, mastertask, eccen, obliqr, lambm0
end subroutine clm_orbital_update

subroutine CheckImport(gcomp, rc)
use clm_varctl, only : for_testing_exit_after_self_tests
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc
character(len=*) , parameter :: subname = "("//__FILE__//":CheckImport)"
Expand Down Expand Up @@ -1320,6 +1359,9 @@ subroutine CheckImport(gcomp, rc)
if (single_column .and. .not. scol_valid) then
RETURN
end if
!if (for_testing_exit_after_self_tests) then
!RETURN
!end if
! The remander of this should be equivalent to the NUOPC internal routine
! from NUOPC_ModeBase.F90

Expand Down
14 changes: 12 additions & 2 deletions src/cpl/nuopc/lnd_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ module lnd_import_export
contains
!===============================================================================

subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, atm_prognostic, rc)
subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, rof_prognostic, &
atm_prognostic, atm_present, rc)

use shr_carma_mod , only : shr_carma_readnl
use shr_ndep_mod , only : shr_ndep_readnl
Expand All @@ -173,6 +174,7 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r
logical , intent(in) :: cism_evolve
logical , intent(in) :: rof_prognostic
logical , intent(in) :: atm_prognostic
logical , intent(in) :: atm_present
integer , intent(out) :: rc

! local variables
Expand Down Expand Up @@ -210,7 +212,9 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r

! Need to determine if there is no land for single column before the advertise call is done

if (atm_prognostic .or. force_send_to_atm) then
if (.not. atm_present)then
send_to_atm = .false.
else if (atm_prognostic .or. force_send_to_atm) then
send_to_atm = .true.
else
send_to_atm = .false.
Expand Down Expand Up @@ -339,6 +343,9 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r

call fldlist_add(fldsToLnd_num, fldsToLnd, trim(flds_scalar_name))

!!!!!!!!!!!!!!!!!!!!!!!!!!! new if section !!!!!!!!!!!!!!!!!!!!!!!!!!
if ( atm_present ) then

! from atm
call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_z )
call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_topo )
Expand Down Expand Up @@ -389,6 +396,9 @@ subroutine advertise_fields(gcomp, flds_scalar_name, glc_present, cism_evolve, r
call fldlist_add(fldsToLnd_num, fldsToLnd, Sa_co2diag)
end if

end if ! atm_present
!!!!!!!!!!!!!!!!!!!!!!!!!!! new if section !!!!!!!!!!!!!!!!!!!!!!!!!!

if (rof_prognostic) then
! from river
call fldlist_add(fldsToLnd_num, fldsToLnd, Flrr_flood )
Expand Down
Loading
Loading