Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Fetch the values from CLM

Status
Not open for further replies.

jinmuluo

Jinmu Luo
Member
Hi CLM Community,

I'm a new CLM user, I have some questions about CLM model and hope someone can give me some hints on how to fix. Thanks!
I wrote a module and added it into CLM, of course I called my module somewhere in CLM and it works. The question is that my module needs some inputs variables from CLM denitrification mod, following what the other module do, I use the SoilBiogeochemNitrogenStateType in my code and try to fetch some values (like fr_WFPS) from the denitrification's output, but the values from denitrification mod is always zero (even after several time step)? I'm sure I turned the methane and denitrification mod on, and I tried to output the values in .nc and results has values... that's really surprised/confused me a lot. I would so appreciate it if someone has same experiences can give me some suggestions!
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I did a short run with CLM5 BGC-CROP (--compset 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV --res f09_g17). It has:

use_nitrif_denitrif = .true.
use_lch4 = .true.

and I output fr_WFPS to the history file. The values of fr_WFPS are non-zero for the levdcmp levels of the soil (20 layers) for a monthly average.
Are you saying you get the same thing but the values of fr_WFPS_col are always zero in the code?
Are you using something like this in your module?

fr_WFPS => soilbiogeochem_nitrogenflux_inst%fr_WFPS_col , & ! Input: [real(r8) (:,:) ]

and are you referencing the values from within a loop like this:

do j = 1, nlevdecomp
do fc = 1,num_soilc
c = filter_soilc(fc)

....fr_WFPS(c,j)

Do you get zero values for an entire month of simulation for all soil columns?
 

jinmuluo

Jinmu Luo
Member
Hi Keith,

Thanks for your replies! I fetched the value of fr_WFPS in my code like this

....
use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type
...
type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst
...
associate(&
nf => soilbiogeochem_nitrogenflux_inst
var = nf%fr_WFPS_col(c, 1)
write(iulog, *) var
...

In my code the value of fr_WFPS are still zero even after 1 day running.
I have checked the code sequence in clm_driver.F90 and my code was called before the denitrification module, do you think it may caused the problem?
and another problem, same way to fetch the values from SoilBiogeochemNitrogenStateType is ok but not works for SoilBiogeochemNitrogenFluxType, so I guess the fluxtype variable's value would not be kept for next time step (set to zero at the beginning of next time step)?

Thank your time and energy agian!

Best,

Jinmu
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I tried just printing out fr_WFPS in another module (SoilBiogeochemDecompMod.F90) and got non-zero values even in the first day.
I don't think the values are zeroed out between time steps.
I don't think I have any other ideas unfortunately.
 

jinmuluo

Jinmu Luo
Member
I tried just printing out fr_WFPS in another module (SoilBiogeochemDecompMod.F90) and got non-zero values even in the first day.
I don't think the values are zeroed out between time steps.
I don't think I have any other ideas unfortunately.
Hi Keith,

After struggling with this problem for a long time, I finally found some clues may help to explain this weird phenomenon.
in src/biogeochem/CNDriverMod.F90, line 243, CLM zeros many CN fluxes term here.

! --------------------------------------------------
! zero the column-level C and N fluxes
! --------------------------------------------------

call soilbiogeochem_nitrogenflux_inst%SetValues( num_soilc, filter_soilc, 0._r8)

So, for every time step, CLM clear the values in soilbiogeochem_nitrogenflux_inst, which means I need to make sure I should fetch the values after it have been calculated. For example, I wrote a function and I want to fetch some values from nitri-denitri mod, I need to make sure my function was called after the nitri-denitri mod in CNDriverMod. For temporary solution, I move all the flux I need to soilbiogeochem_nitrogenstate_inst, it works for me.

Best,

Jinmu
 
Status
Not open for further replies.
Top