Skip to content
Open
Changes from all commits
Commits
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
37 changes: 21 additions & 16 deletions src/soilbiogeochem/CNSoilMatrixMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module CNSoilMatrixMod
use spmdMod , only : masterproc
use clm_time_manager , only : get_step_size, is_end_curr_month,get_curr_date,update_DA_nstep
use clm_time_manager , only : is_first_restart_step,is_beg_curr_year,is_end_curr_year,is_first_step_of_this_run_segment
use clm_time_manager , only : is_first_step
use clm_varpar , only : ndecomp_pools, nlevdecomp, ndecomp_pools_vr !number of biogeochemically active soil layers
use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_cascade_outtransitions
use clm_varpar , only : i_cwd
Expand Down Expand Up @@ -610,11 +611,12 @@ subroutine CNSoilMatrix(bounds,num_soilc, filter_soilc, num_actfirec, filter_act
if ( is_first_restart_step() )then
call AKXcacc%CopyIdxSM( AKallsoilc )
end if
if ( AKXcacc%IsValuesSetSM() )then
call AKXcacc%SPMP_B_ACC(num_soilc,filter_soilc,AKallsoilc)
else
! This should only happen on the first time-step
! Use is_first_step() instead of IsValuesSetSM() to avoid race condition related to metadata
! filling; see https://github.com/ESCOMP/CTSM/issues/3360#issuecomment-6862429821 for details
if (is_first_step()) then
call AKXcacc%SetValueCopySM(num_soilc,filter_soilc,AKallsoilc)
else
call AKXcacc%SPMP_B_ACC(num_soilc,filter_soilc,AKallsoilc)
end if

!
Expand All @@ -625,11 +627,12 @@ subroutine CNSoilMatrix(bounds,num_soilc, filter_soilc, num_actfirec, filter_act
if ( is_first_restart_step() )then
call cs13_soil%AKXcacc%CopyIdxSM( cf13_soil%AKallsoilc )
end if
if ( cs13_soil%AKXcacc%IsValuesSetSM() )then
call cs13_soil%AKXcacc%SPMP_B_ACC(num_soilc,filter_soilc,cf13_soil%AKallsoilc)
else
! This should only happen on the first time-step
! Use is_first_step() instead of IsValuesSetSM() to avoid race condition related to metadata
! filling; see https://github.com/ESCOMP/CTSM/issues/3360#issuecomment-6862429821 for details
if (is_first_step()) then
call cs13_soil%AKXcacc%SetValueCopySM(num_soilc,filter_soilc,cf13_soil%AKallsoilc)
else
call cs13_soil%AKXcacc%SPMP_B_ACC(num_soilc,filter_soilc,cf13_soil%AKallsoilc)
end if
end if

Expand All @@ -641,11 +644,12 @@ subroutine CNSoilMatrix(bounds,num_soilc, filter_soilc, num_actfirec, filter_act
if ( is_first_restart_step() )then
call cs14_soil%AKXcacc%CopyIdxSM( cf14_soil%AKallsoilc )
end if
if ( cs14_soil%AKXcacc%IsValuesSetSM() )then
call cs14_soil%AKXcacc%SPMP_B_ACC(num_soilc,filter_soilc,cf14_soil%AKallsoilc)
else
! This should only happen on the first time-step
! Use is_first_step() instead of IsValuesSetSM() to avoid race condition related to metadata
! filling; see https://github.com/ESCOMP/CTSM/issues/3360#issuecomment-6862429821 for details
if (is_first_step()) then
call cs14_soil%AKXcacc%SetValueCopySM(num_soilc,filter_soilc,cf14_soil%AKallsoilc)
else
call cs14_soil%AKXcacc%SPMP_B_ACC(num_soilc,filter_soilc,cf14_soil%AKallsoilc)
end if
end if

Expand All @@ -656,11 +660,12 @@ subroutine CNSoilMatrix(bounds,num_soilc, filter_soilc, num_actfirec, filter_act
if ( is_first_restart_step() )then
call AKXnacc%CopyIdxSM( AKallsoiln )
end if
if ( AKXnacc%IsValuesSetSM() )then
call AKXnacc%SPMP_B_ACC(num_soilc,filter_soilc,AKallsoiln)
else
! This should only happen on the first time-step
! Use is_first_step() instead of IsValuesSetSM() to avoid race condition related to metadata
! filling; see https://github.com/ESCOMP/CTSM/issues/3360#issuecomment-6862429821 for details
if (is_first_step()) then
call AKXnacc%SetValueCopySM(num_soilc,filter_soilc,AKallsoiln)
else
call AKXnacc%SPMP_B_ACC(num_soilc,filter_soilc,AKallsoiln)
end if

call t_startf('CN Soil matrix-calc. C capacity')
Expand Down
Loading