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

Mass imbalance outside the model.

jinmuluo

Jinmu Luo
Member
Dear CTSM Community members,

I developed a model based on CLM, everything reaches mass balance inside the CLM (not mass imbalance warnings). In my model, I calculated array(c) = array2(c) + array3(c).
When I outputted these three variables in Netcdf, and tried to make sure mass balance was made outside the model. But the result was array(g) < (array2(g) + array3(g)).
I'm wandering that why mass balance is satisfied in column level, but when I output it into global grid cell, it not longer balance anymore? Grid cell checker was passed successfully, but it broken at the first time step of new year. Thanks so much.

Best,

Jinmu
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I may not completely understand the question, but I think that the first two or three (depending on the model version) time steps are skipped for the balance checks because balance can't be achieved. So, it might be that say monthly averages in the first month of history output won't balance because they include the first two or three time steps of data. Does that make sense for your situation?
 

jinmuluo

Jinmu Luo
Member
Hi Keith,

Maybe I can ask in another way, I want to create a variable called "Var" <(crop_column, vertical level)> which represents mass concentration in soil. What I have done just follow the way of creation of "sminn_vr_col" in SoilBiogeochemNitrogenStateType then use it in my module. Do you think am I missed any necessary steps? Should I transfer it into grid cell matrix before it can be outputted into Netcdf? When the land use change happens at the first time step of new year, should I do anything else on my variable?

Best,

Jinmu
 

jinmuluo

Jinmu Luo
Member
I may not completely understand the question, but I think that the first two or three (depending on the model version) time steps are skipped for the balance checks because balance can't be achieved. So, it might be that say monthly averages in the first month of history output won't balance because they include the first two or three time steps of data. Does that make sense for your situation?
Thanks for you help! BTW, does NCAR provide any python library to deal with CLM output?
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Following the sminn_vr_col example in SoilBiogeochemNitrogenStateType.F90 seems like a good way to start. I don't think you are missing anything as long as you follow the examples in InitAllocate, InitHistory, InitCold, Restart, etc. I think you could follow the example in InitHistory to output the variable to history:

data2dptr => this%sminn_vr_col(begc:endc,1:nlevsoi)
call hist_addfld_decomp (fname='SMINN'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', &
avgflag='A', long_name='soil mineral N', &
ptr_col=data2dptr)

If the variable is related to carbon or nitrogen (or water or energy) then you would likely have to deal with the changes that are induced by landcover change, specifically changes in column weights. There is some description of how that is handled here:


It looks like this is handled for the sminn_vr_col example in the subroutine DynamicColumnAdjustments, so perhaps you could follow that example if necessary.

Regarding python, unfortunately I don't have any expertise there, but I know there have been some tools developed, e.g.,


More generally, the Earth System Data Science initiative at NCAR may be helpful.
@wwieder may be able to provide some additional resources.
 

jinmuluo

Jinmu Luo
Member
Following the sminn_vr_col example in SoilBiogeochemNitrogenStateType.F90 seems like a good way to start. I don't think you are missing anything as long as you follow the examples in InitAllocate, InitHistory, InitCold, Restart, etc. I think you could follow the example in InitHistory to output the variable to history:

data2dptr => this%sminn_vr_col(begc:endc,1:nlevsoi)
call hist_addfld_decomp (fname='SMINN'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', &
avgflag='A', long_name='soil mineral N', &
ptr_col=data2dptr)

If the variable is related to carbon or nitrogen (or water or energy) then you would likely have to deal with the changes that are induced by landcover change, specifically changes in column weights. There is some description of how that is handled here:


It looks like this is handled for the sminn_vr_col example in the subroutine DynamicColumnAdjustments, so perhaps you could follow that example if necessary.

Regarding python, unfortunately I don't have any expertise there, but I know there have been some tools developed, e.g.,


More generally, the Earth System Data Science initiative at NCAR may be helpful.
@wwieder may be able to provide some additional resources.
Hi Keith,

It' seems like pretty hard to incorporate the land use change schemes to our module (ran into many mistakes), so could you please tell me how to turn the land use change scheme off ?

Best,

Jinmu
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
In a transient compset, the land cover change is controlled by the following in lnd_in, e.g.,:

&dynamic_subgrid
do_harvest = .true.
do_transient_crops = .true.
do_transient_pfts = .true.
flanduse_timeseries = '/glade/work/cmip6/cases/LUMIP/b.e21.B1850.f09_g17.CMIP6-deforest-globe.001/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.20mil_top30_tdf.nc'
/

I think it is sufficient to set flanduse_timeseries to a blank string in your user_nl_clm:

flanduse_timeseries = ' '
 
Top