@@ -2266,7 +2266,10 @@ subroutine hybrid(x0, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,&
22662266 real (r8 ), intent (in ) :: cair ! Atmospheric CO2 partial pressure (Pa)
22672267 real (r8 ), intent (in ) :: oair ! Atmospheric O2 partial pressure (Pa)
22682268 integer , intent (in ) :: p, iv, c ! pft, c3/c4, and column index
2269- real (r8 ), intent (out ) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s)
2269+ ! gs_mol is "inout" rather than "out" to
2270+ ! prevent returning nan when the code returns from this subroutine
2271+ ! before assigning a value to this variable
2272+ real (r8 ), intent (inout ) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s)
22702273 integer , intent (out ) :: iter ! number of iterations used, for record only
22712274 type (atm2lnd_type) , intent (in ) :: atm2lnd_inst
22722275 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,&
23782381 real (r8 ), intent (in ) :: oair ! Atmospheric O2 partial pressure (Pa)
23792382 real (r8 ), intent (in ) :: rh_can ! inside canopy relative humidity
23802383 integer , intent (in ) :: ip, iv, ic ! pft, c3/c4, and column index
2381- real (r8 ), intent (out ) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s)
2384+ ! gs_mol is "inout" rather than "out" to
2385+ ! prevent returning nan when the code returns from this subroutine
2386+ ! before assigning a value to this variable
2387+ real (r8 ), intent (inout ) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s)
23822388 type (atm2lnd_type) , intent (in ) :: atm2lnd_inst
23832389 type (photosyns_type), intent (inout ) :: photosyns_inst
23842390 !
@@ -2568,7 +2574,10 @@ subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,&
25682574 real (r8 ) , intent (in ) :: rh_can ! canopy air realtive humidity
25692575 integer , intent (in ) :: p, iv, c ! pft, vegetation type and column indexes
25702576 real (r8 ) , intent (out ) :: fval ! return function of the value f(ci)
2571- real (r8 ) , intent (out ) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s)
2577+ ! gs_mol is "inout" rather than "out" to
2578+ ! prevent returning nan when the code returns from this subroutine
2579+ ! before assigning a value to this variable
2580+ real (r8 ) , intent (inout ) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s)
25722581 type (atm2lnd_type) , intent (in ) :: atm2lnd_inst
25732582 type (photosyns_type) , intent (inout ) :: photosyns_inst
25742583 !
@@ -2706,7 +2715,6 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
27062715 use clm_varpar , only : nlevsoi
27072716 use pftconMod , only : nbrdlf_dcd_tmp_shrub, npcropmin
27082717 use ColumnType , only : col
2709- use shr_infnan_mod , only : shr_infnan_isnan
27102718
27112719 !
27122720 ! !ARGUMENTS:
@@ -2724,7 +2732,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
27242732 real (r8 ) , intent (in ) :: leafn( bounds% begp: ) ! leaf N (gN/m2)
27252733 real (r8 ) , intent (out ) :: bsun( bounds% begp: ) ! sunlit canopy transpiration wetness factor (0 to 1)
27262734 real (r8 ) , intent (out ) :: bsha( bounds% begp: ) ! shaded canopy transpiration wetness factor (0 to 1)
2727- real (r8 ) , intent (out ) :: btran( bounds% begp: ) ! transpiration wetness factor (0 to 1) [pft]
2735+ real (r8 ) , intent (inout ) :: btran( bounds% begp: ) ! transpiration wetness factor (0 to 1) [pft]
27282736 real (r8 ) , intent (in ) :: froot_carbon( bounds% begp: ) ! fine root carbon (gC/m2) [pft]
27292737 real (r8 ) , intent (in ) :: croot_carbon( bounds% begp: ) ! live coarse root carbon (gC/m2) [pft]
27302738
@@ -3477,6 +3485,7 @@ subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, &
34773485 else
34783486 gsminsun = nan
34793487 gsminsha = nan
3488+ call endrun( ' ERROR:: Photosynthesis::PhotosynthesisHydraulicStress must choose stomatalcond_mtd method' )
34803489 end if
34813490 call calcstress(p,c,vegwp(p,:),bsun(p),bsha(p),gb_mol(p),gsminsun, gsminsha, &
34823491 qsatl(p),qaf(p), atm2lnd_inst,canopystate_inst,waterdiagnosticbulk_inst, &
@@ -4064,8 +4073,11 @@ subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha
40644073 real (r8 ), intent (in ) :: lmr_z_sun, lmr_z_sha ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s)
40654074 real (r8 ), intent (in ) :: par_z_sun, par_z_sha ! par absorbed per unit lai for canopy layer (w/m**2)
40664075 real (r8 ), intent (in ) :: rh_can ! inside canopy relative humidity
4067- real (r8 ), intent (out ) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s)
4068- real (r8 ), intent (out ) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s)
4076+ ! gs_mol_s* are "inout" rather than "out" to
4077+ ! prevent returning nan when the code returns from this subroutine
4078+ ! before assigning values to these variables
4079+ real (r8 ), intent (inout ) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s)
4080+ real (r8 ), intent (inout ) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s)
40694081 real (r8 ), intent (inout ) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1)
40704082 real (r8 ), intent (inout ) :: bsha ! shaded canopy transpiration wetness factor (0 to 1)
40714083 real (r8 ), intent (in ) :: qsatl ! leaf specific humidity [kg/kg]
@@ -4344,6 +4356,7 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b
43444356 gs_mol_sun = bbb(p)
43454357 else
43464358 gs_mol_sun = nan
4359+ call endrun( ' ERROR:: Photosynthesis::ci_func_PHS must choose stomatalcond_mtd method' )
43474360 end if
43484361 gs_mol_sun = max ( bsun* gs_mol_sun, 1._r8 )
43494362 fvalsun = 0._r8 ! really tho? zqz
@@ -4355,6 +4368,7 @@ subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, b
43554368 gs_mol_sha = bbb(p)
43564369 else
43574370 gs_mol_sha = nan
4371+ call endrun( ' ERROR:: Photosynthesis::ci_func_PHS must choose stomatalcond_mtd method' )
43584372 end if
43594373 gs_mol_sha = max ( bsha* gs_mol_sha, 1._r8 )
43604374 fvalsha = 0._r8
0 commit comments