From 9816cf07626a9c4aba20c5f6519a5ec1bbdb1a24 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 11 Jul 2023 14:50:32 -0600 Subject: [PATCH 01/10] Eliminate NaNs in TotalSum in subr. check_sums_equal_1 --- src/main/surfrdUtilsMod.F90 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/surfrdUtilsMod.F90 b/src/main/surfrdUtilsMod.F90 index 0763d43a16..af9e64d86a 100644 --- a/src/main/surfrdUtilsMod.F90 +++ b/src/main/surfrdUtilsMod.F90 @@ -45,7 +45,7 @@ subroutine check_sums_equal_1(arr, lb, name, caller, ier, sumto) character(len=*), intent(in) :: name ! name of array character(len=*), intent(in) :: caller ! identifier of caller, for more meaningful error messages integer, optional, intent(out):: ier ! Return an error code rather than abort - real(r8), optional, intent(out):: sumto(lb:) ! The value the array should sum to (1.0 if not provided) + real(r8), optional, intent(in):: sumto(lb:) ! The value the array should sum to (1.0 if not provided) ! ! !LOCAL VARIABLES: logical :: found @@ -58,12 +58,15 @@ subroutine check_sums_equal_1(arr, lb, name, caller, ier, sumto) ub = ubound(arr, 1) allocate(TotalSum(lb:ub)) - TotalSum = 1._r8 - if ( present(sumto) ) TotalSum = sumto if( present(ier) ) ier = 0 found = .false. - do nl = lbound(arr, 1), ub + do nl = lb, ub + if ( present(sumto) ) then + TotalSum(nl) = sumto(nl) + else + TotalSum(nl) = 1._r8 + end if if (abs(sum(arr(nl,:)) - TotalSum(nl)) > eps) then found = .true. nindx = nl From 633763f3a9ebe2f9beb122ea98c6cc9b56ce9417 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 13 Jul 2023 12:09:06 -0600 Subject: [PATCH 02/10] Call CLMFatesTimesteps only if use_fates --- src/main/clm_initializeMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 7988fbfc7b..aa7c89ebb9 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -337,7 +337,7 @@ subroutine initialize2(ni,nj) end if ! Pass model timestep info to FATES - call CLMFatesTimesteps() + if (use_fates) call CLMFatesTimesteps() ! Initialize daylength from the previous time step (needed so prev_dayl can be set correctly) call t_startf('init_orbd') From dbb2b6cf7dbbe3fcb86d1a8081b5d9c4ad3549bd Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 14 Jul 2023 16:13:49 -0600 Subject: [PATCH 03/10] Changed num_allc to num_soilc loops to prevent NaNsin nag -nan tests --- src/biogeochem/CNVegCarbonStateType.F90 | 4 ++-- src/biogeochem/CNVegNitrogenStateType.F90 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index 610689fdb6..681fa2a8d0 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -2747,8 +2747,8 @@ subroutine Summary_carbonstate(this, bounds, num_allc, filter_allc, & this%totc_patch(bounds%begp:bounds%endp), & this%totc_p2c_col(bounds%begc:bounds%endc)) - do fc = 1,num_allc - c = filter_allc(fc) + do fc = 1,num_soilc + c = filter_soilc(fc) ! total ecosystem carbon, including veg but excluding cpool (TOTECOSYSC) this%totecosysc_col(c) = & diff --git a/src/biogeochem/CNVegNitrogenStateType.F90 b/src/biogeochem/CNVegNitrogenStateType.F90 index f09311e518..669a22d4f7 100644 --- a/src/biogeochem/CNVegNitrogenStateType.F90 +++ b/src/biogeochem/CNVegNitrogenStateType.F90 @@ -1157,8 +1157,8 @@ subroutine Summary_nitrogenstate(this, bounds, num_allc, filter_allc, & this%totn_patch(bounds%begp:bounds%endp), & this%totn_p2c_col(bounds%begc:bounds%endc)) - do fc = 1,num_allc - c = filter_allc(fc) + do fc = 1,num_soilc + c = filter_soilc(fc) ! total ecosystem nitrogen, including veg (TOTECOSYSN) this%totecosysn_col(c) = & From 18e6a0de0994952d8350ee9a4116e852c009065f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 17 Jul 2023 13:23:50 -0600 Subject: [PATCH 04/10] Reverse part of commit https://github.com/ESCOMP/CTSM/pull/2051/commits/9816cf07626a9c4aba20c5f6519a5ec1bbdb1a24 --- src/main/surfrdUtilsMod.F90 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/surfrdUtilsMod.F90 b/src/main/surfrdUtilsMod.F90 index af9e64d86a..d84b829310 100644 --- a/src/main/surfrdUtilsMod.F90 +++ b/src/main/surfrdUtilsMod.F90 @@ -58,15 +58,12 @@ subroutine check_sums_equal_1(arr, lb, name, caller, ier, sumto) ub = ubound(arr, 1) allocate(TotalSum(lb:ub)) + TotalSum = 1._r8 + if ( present(sumto) ) TotalSum = sumto if( present(ier) ) ier = 0 found = .false. do nl = lb, ub - if ( present(sumto) ) then - TotalSum(nl) = sumto(nl) - else - TotalSum(nl) = 1._r8 - end if if (abs(sum(arr(nl,:)) - TotalSum(nl)) > eps) then found = .true. nindx = nl From 92a87e85aadc249300e45c42f66c4aa0de032722 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 18 Jul 2023 17:26:49 -0600 Subject: [PATCH 05/10] Change two intent(out) to (inout) to eliminate NaNs in nag test --- src/biogeophys/PhotosynthesisMod.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 5b2c68a0fb..a721086e22 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2706,7 +2706,6 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & use clm_varpar , only : nlevsoi use pftconMod , only : nbrdlf_dcd_tmp_shrub, npcropmin use ColumnType , only : col - use shr_infnan_mod , only : shr_infnan_isnan ! ! !ARGUMENTS: @@ -3477,6 +3476,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & else gsminsun = nan gsminsha = nan + call endrun( 'ERROR:: Photosynthesis::PhotosynthesisHydraulicStress must choose stomatalcond_mtd method' ) end if call calcstress(p,c,vegwp(p,:),bsun(p),bsha(p),gb_mol(p),gsminsun, gsminsha, & qsatl(p),qaf(p), atm2lnd_inst,canopystate_inst,waterdiagnosticbulk_inst, & @@ -4064,8 +4064,8 @@ subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha real(r8), intent(in) :: lmr_z_sun, lmr_z_sha ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) real(r8), intent(in) :: par_z_sun, par_z_sha ! par absorbed per unit lai for canopy layer (w/m**2) real(r8), intent(in) :: rh_can ! inside canopy relative humidity - real(r8), intent(out) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8), intent(out) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) real(r8), intent(inout) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) real(r8), intent(inout) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) real(r8), intent(in) :: qsatl ! leaf specific humidity [kg/kg] @@ -4344,6 +4344,7 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b gs_mol_sun = bbb(p) else gs_mol_sun = nan + call endrun( 'ERROR:: Photosynthesis::ci_func_PHS must choose stomatalcond_mtd method' ) end if gs_mol_sun = max( bsun*gs_mol_sun, 1._r8) fvalsun = 0._r8 ! really tho? zqz @@ -4355,6 +4356,7 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b gs_mol_sha = bbb(p) else gs_mol_sha = nan + call endrun( 'ERROR:: Photosynthesis::ci_func_PHS must choose stomatalcond_mtd method' ) end if gs_mol_sha = max( bsha*gs_mol_sha, 1._r8) fvalsha = 0._r8 From bfe8cf080ca2b70e4323715b5e7b4c40e39ac3c0 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Wed, 19 Jul 2023 18:27:54 -0600 Subject: [PATCH 06/10] Change three intent(out) to (inout) to prevent NaNs in nag test --- src/biogeophys/PhotosynthesisMod.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index a721086e22..beda9d0bc5 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2266,7 +2266,7 @@ subroutine hybrid(x0, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) integer, intent(in) :: p, iv, c ! pft, c3/c4, and column index - real(r8), intent(out) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) integer, intent(out) :: iter !number of iterations used, for record only type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type), intent(inout) :: photosyns_inst @@ -2378,7 +2378,7 @@ subroutine brent(x, x1,x2,f1, f2, tol, ip, iv, ic, gb_mol, je, cair, oair,& real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) real(r8), intent(in) :: rh_can ! inside canopy relative humidity integer, intent(in) :: ip, iv, ic ! pft, c3/c4, and column index - real(r8), intent(out) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type), intent(inout) :: photosyns_inst ! @@ -2568,7 +2568,7 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8) , intent(in) :: rh_can ! canopy air realtive humidity integer , intent(in) :: p, iv, c ! pft, vegetation type and column indexes real(r8) , intent(out) :: fval ! return function of the value f(ci) - real(r8) , intent(out) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) + real(r8) , intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type) , intent(inout) :: photosyns_inst ! From bdcd18287687cddfed973c08b913981a72021107 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 24 Jul 2023 13:14:27 -0600 Subject: [PATCH 07/10] Change more intent(out) to intent(inout) to prevent NaNs in nag tests --- src/biogeophys/FrictionVelocityMod.F90 | 8 ++++---- src/biogeophys/PhotosynthesisMod.F90 | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 index 21a09fbc13..962184b30b 100644 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ b/src/biogeophys/FrictionVelocityMod.F90 @@ -677,10 +677,10 @@ subroutine FrictionVelocity(this, lbn, ubn, fn, filtern, & real(r8) , intent(in) :: ur ( lbn: ) ! wind speed at reference height [m/s] [lbn:ubn] real(r8) , intent(in) :: um ( lbn: ) ! wind speed including the stablity effect [m/s] [lbn:ubn] real(r8) , intent(out) :: ustar ( lbn: ) ! friction velocity [m/s] [lbn:ubn] - real(r8) , intent(out) :: temp1 ( lbn: ) ! relation for potential temperature profile [lbn:ubn] - real(r8) , intent(out) :: temp12m ( lbn: ) ! relation for potential temperature profile applied at 2-m [lbn:ubn] - real(r8) , intent(out) :: temp2 ( lbn: ) ! relation for specific humidity profile [lbn:ubn] - real(r8) , intent(out) :: temp22m ( lbn: ) ! relation for specific humidity profile applied at 2-m [lbn:ubn] + real(r8) , intent(inout) :: temp1 ( lbn: ) ! relation for potential temperature profile [lbn:ubn] (inout instead of out to prevent returning nan) + real(r8) , intent(inout) :: temp12m ( lbn: ) ! relation for potential temperature profile applied at 2-m [lbn:ubn] (inout instead of out to prevent returning nan) + real(r8) , intent(inout) :: temp2 ( lbn: ) ! relation for specific humidity profile [lbn:ubn] (inout instead of out to prevent returning nan) + real(r8) , intent(inout) :: temp22m ( lbn: ) ! relation for specific humidity profile applied at 2-m [lbn:ubn] (inout instead of out to prevent returning nan) real(r8) , intent(inout) :: fm ( lbn: ) ! diagnose 10m wind (DUST only) [lbn:ubn] logical , intent(in), optional :: landunit_index ! optional argument that defines landunit or pft level ! diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index beda9d0bc5..6207e40700 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2266,7 +2266,7 @@ subroutine hybrid(x0, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) integer, intent(in) :: p, iv, c ! pft, c3/c4, and column index - real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) integer, intent(out) :: iter !number of iterations used, for record only type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type), intent(inout) :: photosyns_inst @@ -2378,7 +2378,7 @@ subroutine brent(x, x1,x2,f1, f2, tol, ip, iv, ic, gb_mol, je, cair, oair,& real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) real(r8), intent(in) :: rh_can ! inside canopy relative humidity integer, intent(in) :: ip, iv, ic ! pft, c3/c4, and column index - real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type), intent(inout) :: photosyns_inst ! @@ -2568,7 +2568,7 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8) , intent(in) :: rh_can ! canopy air realtive humidity integer , intent(in) :: p, iv, c ! pft, vegetation type and column indexes real(r8) , intent(out) :: fval ! return function of the value f(ci) - real(r8) , intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) + real(r8) , intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type) , intent(inout) :: photosyns_inst ! @@ -4064,8 +4064,8 @@ subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha real(r8), intent(in) :: lmr_z_sun, lmr_z_sha ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) real(r8), intent(in) :: par_z_sun, par_z_sha ! par absorbed per unit lai for canopy layer (w/m**2) real(r8), intent(in) :: rh_can ! inside canopy relative humidity - real(r8), intent(inout) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8), intent(inout) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) + real(r8), intent(inout) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) real(r8), intent(inout) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) real(r8), intent(inout) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) real(r8), intent(in) :: qsatl ! leaf specific humidity [kg/kg] From d85be768a5f2565d8ecbaf6588ea28d08d0cde9a Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 31 Jul 2023 18:02:17 -0600 Subject: [PATCH 08/10] Change another intent(out) to intent(inout) to prevent NaNs in nag tests --- src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 | 1 - src/biogeophys/PhotosynthesisMod.F90 | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 index e7c16f15c7..6f8632658d 100644 --- a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 +++ b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 @@ -1365,7 +1365,6 @@ subroutine calc_plant_nitrogen_demand(this, bounds, & frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch,& ! Output: [real(r8) (:) ] sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N - btran => energyflux_inst%btran_patch , & ! Input: [real(r8) (:) ] transpiration wetness factor (0 to 1) t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col & ! Input: [real(r8) (:,:) ] soil temperature scalar for decomp ) diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 6207e40700..0d14909fbf 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2723,7 +2723,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & real(r8) , intent(in) :: leafn( bounds%begp: ) ! leaf N (gN/m2) real(r8) , intent(out) :: bsun( bounds%begp: ) ! sunlit canopy transpiration wetness factor (0 to 1) real(r8) , intent(out) :: bsha( bounds%begp: ) ! shaded canopy transpiration wetness factor (0 to 1) - real(r8) , intent(out) :: btran( bounds%begp: ) ! transpiration wetness factor (0 to 1) [pft] + real(r8) , intent(inout) :: btran( bounds%begp: ) ! transpiration wetness factor (0 to 1) [pft] real(r8) , intent(in) :: froot_carbon( bounds%begp: ) ! fine root carbon (gC/m2) [pft] real(r8) , intent(in) :: croot_carbon( bounds%begp: ) ! live coarse root carbon (gC/m2) [pft] From ce8ccf3e11c92ffbf942c8ded2efc1cbad165804 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 25 Aug 2023 16:54:10 -0600 Subject: [PATCH 09/10] Draft ChangeLog/ChangeSum --- doc/ChangeLog | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ doc/ChangeSum | 1 + 2 files changed, 60 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index ab2b760ecb..0a9515ff93 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,63 @@ =============================================================== +Tag name: ctsm5.1.dev139 +Originator(s): slevis (Samuel Levis) +Date: Fri Aug 25 16:47:45 MDT 2023 +One-line Summary: Fix problems uncovered by nag -nan tests + +Purpose and description of changes +---------------------------------- + + Fix problems uncovered by adding the -nan compilation flag for the Nag + compiler. + + +Significant changes to scientifically-supported configurations +-------------------------------------------------------------- + +Does this tag change answers significantly for any of the following physics configurations? +(Details of any changes will be given in the "Answer changes" section below.) + + [Put an [X] in the box for any configuration with significant answer changes.] + +[ ] clm5_1 + +[ ] clm5_0 + +[ ] ctsm5_0-nwp + +[ ] clm4_5 + + +Bugs fixed or introduced +------------------------ +CTSM issues fixed (include CTSM Issue #): + Makes progress on issue #1994 (same title) + + +Testing summary: +---------------- + + [PASS means all tests PASS; OK means tests PASS other than expected fails.] + + regular tests (aux_clm: https://github.com/ESCOMP/CTSM/wiki/System-Testing-Guide#pre-merge-system-testing): + + cheyenne ---- OK + izumi ------- PASS + + +Answer changes +-------------- + +Changes answers relative to baseline: No + + +Other details +------------- +Pull Requests that document the changes (include PR ids): + https://github.com/ESCOMP/ctsm/pull/2051 + +=============================================================== +=============================================================== Tag name: ctsm5.1.dev138 Originator(s): slevis (Samuel Levis,UCAR/TSS,303-665-1310) Date: Fri Aug 25 14:44:22 MDT 2023 diff --git a/doc/ChangeSum b/doc/ChangeSum index 0d9e4d3745..4ac0f90f5e 100644 --- a/doc/ChangeSum +++ b/doc/ChangeSum @@ -1,5 +1,6 @@ Tag Who Date Summary ============================================================================================================================ + ctsm5.1.dev139 slevis 08/28/2023 Fix problems uncovered by nag -nan tests ctsm5.1.dev138 slevis 08/25/2023 Refactor max_patch_per_col and maxsoil_patches loops ctsm5.1.dev137 slevis 08/23/2023 Surface roughness modifications ctsm5.1.dev136 multiple 08/22/2023 Change order of history fields to improve performance on derecho From 696cf9a7b2b25411e4990146b9f3e2fdca473a7f Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Mon, 28 Aug 2023 10:44:31 -0600 Subject: [PATCH 10/10] Reworded comments as recommended by Erik Kluzek --- src/biogeophys/FrictionVelocityMod.F90 | 11 +++++++---- src/biogeophys/PhotosynthesisMod.F90 | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 index b25f18fb1c..7cea2a22f9 100644 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ b/src/biogeophys/FrictionVelocityMod.F90 @@ -750,10 +750,13 @@ subroutine FrictionVelocity(this, lbn, ubn, fn, filtern, & real(r8) , intent(in) :: ur ( lbn: ) ! wind speed at reference height [m/s] [lbn:ubn] real(r8) , intent(in) :: um ( lbn: ) ! wind speed including the stablity effect [m/s] [lbn:ubn] real(r8) , intent(out) :: ustar ( lbn: ) ! friction velocity [m/s] [lbn:ubn] - real(r8) , intent(inout) :: temp1 ( lbn: ) ! relation for potential temperature profile [lbn:ubn] (inout instead of out to prevent returning nan) - real(r8) , intent(inout) :: temp12m ( lbn: ) ! relation for potential temperature profile applied at 2-m [lbn:ubn] (inout instead of out to prevent returning nan) - real(r8) , intent(inout) :: temp2 ( lbn: ) ! relation for specific humidity profile [lbn:ubn] (inout instead of out to prevent returning nan) - real(r8) , intent(inout) :: temp22m ( lbn: ) ! relation for specific humidity profile applied at 2-m [lbn:ubn] (inout instead of out to prevent returning nan) + ! temp1, temp12m, temp2, temp22m are "inout" rather than "out" to + ! prevent returning nan when the code returns from this subroutine + ! before assigning values to these variables + real(r8) , intent(inout) :: temp1 ( lbn: ) ! relation for potential temperature profile [lbn:ubn] + real(r8) , intent(inout) :: temp12m ( lbn: ) ! relation for potential temperature profile applied at 2-m [lbn:ubn] + real(r8) , intent(inout) :: temp2 ( lbn: ) ! relation for specific humidity profile [lbn:ubn] + real(r8) , intent(inout) :: temp22m ( lbn: ) ! relation for specific humidity profile applied at 2-m [lbn:ubn] real(r8) , intent(inout) :: fm ( lbn: ) ! diagnose 10m wind (DUST only) [lbn:ubn] logical , intent(in), optional :: landunit_index ! optional argument that defines landunit or pft level ! diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 index 0d14909fbf..6176668f19 100644 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ b/src/biogeophys/PhotosynthesisMod.F90 @@ -2266,7 +2266,10 @@ subroutine hybrid(x0, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) integer, intent(in) :: p, iv, c ! pft, c3/c4, and column index - real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) + ! gs_mol is "inout" rather than "out" to + ! prevent returning nan when the code returns from this subroutine + ! before assigning a value to this variable + real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) integer, intent(out) :: iter !number of iterations used, for record only type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type), intent(inout) :: photosyns_inst @@ -2378,7 +2381,10 @@ subroutine brent(x, x1,x2,f1, f2, tol, ip, iv, ic, gb_mol, je, cair, oair,& real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) real(r8), intent(in) :: rh_can ! inside canopy relative humidity integer, intent(in) :: ip, iv, ic ! pft, c3/c4, and column index - real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) + ! gs_mol is "inout" rather than "out" to + ! prevent returning nan when the code returns from this subroutine + ! before assigning a value to this variable + real(r8), intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type), intent(inout) :: photosyns_inst ! @@ -2568,7 +2574,10 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& real(r8) , intent(in) :: rh_can ! canopy air realtive humidity integer , intent(in) :: p, iv, c ! pft, vegetation type and column indexes real(r8) , intent(out) :: fval ! return function of the value f(ci) - real(r8) , intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) + ! gs_mol is "inout" rather than "out" to + ! prevent returning nan when the code returns from this subroutine + ! before assigning a value to this variable + real(r8) , intent(inout) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) type(atm2lnd_type) , intent(in) :: atm2lnd_inst type(photosyns_type) , intent(inout) :: photosyns_inst ! @@ -4064,8 +4073,11 @@ subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha real(r8), intent(in) :: lmr_z_sun, lmr_z_sha ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) real(r8), intent(in) :: par_z_sun, par_z_sha ! par absorbed per unit lai for canopy layer (w/m**2) real(r8), intent(in) :: rh_can ! inside canopy relative humidity - real(r8), intent(inout) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) - real(r8), intent(inout) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) (inout instead of out to prevent returning nan) + ! gs_mol_s* are "inout" rather than "out" to + ! prevent returning nan when the code returns from this subroutine + ! before assigning values to these variables + real(r8), intent(inout) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) + real(r8), intent(inout) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) real(r8), intent(inout) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) real(r8), intent(inout) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) real(r8), intent(in) :: qsatl ! leaf specific humidity [kg/kg]