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

How to accumulate excess DOC in SoilBiogeochemCarbonFluxType

mariuslam

Marius Lambert
New Member
Hi, @erik, @oleson, @sacks

I have been working on implementing DOC production simlarly to HR (heterotrophic respiration) in SoilBiogeochemCarbonFluxType.
Until now I have sent this flux directly to MOSART via lnd2atmMod (I hope at the right time step :/ ).

Now I want to add a condition in lnd2atmMod, to send DOC to MOSART only if there is (enough) RUNOFF.
This means I now need to track the excess DOC kept in CTSM.

I have tried several things so far BUT
It seems like all the carbon fluxes are zeroed at every time step, how and where do you suggest I accumulate the excess DOC if not in SoilBiogeochemCarbonFluxType?

>> My commits so far<<

Thanks!
 

sacks

Bill Sacks
CSEG and Liaisons
Staff member
I'd suggest adding a new pool/state in SoilBiogeochemCarbonStateType to track the excess. As you found, fluxes are typically zeroed each time step and not meant to accumulate from one time step to the next. States, on the other hand, can be used to accumulate things like this. So the logic would be something like:
- If there is enough runoff, send DOC to ROF
- Otherwise, send DOC to an accumulation pool

I can see a few possible ways to handle the accumulation pool. One simple thing would be to attempt to empty the accumulation pool each time step. That would look like:
- Add all DOC from the accumulation pool to this time step's DOC flux (this would also set the accumulation pool to 0)
- Use the above logic to route the flux to ROF or back to the accumulation pool

This would mean that, if there still isn't enough runoff, you would end up emptying the accumulation pool and then refilling it (plus adding any new flux) each time step, but to me that seems okay, and seems like it could be simpler than other ways of handling this.

In principle it would be possible to add a new flux variable that doesn't reset to zero each time step and instead accumulates, but I'm concerned that the different behavior of that flux variable compared with others would be confusing to other people working with the code.
 

mariuslam

Marius Lambert
New Member
Thanks a lot Bill, I have added the structure for the accumulated DOC variable in SoilBiogeochemCarbonStateType.

You suggest I don't do anything with that variable in SoilBiogeochemCarbonStateType%Summary, but instead add it to the current DOC flux in SoilBiogeochemCarbonFluxType%Summary ?

Then I put a condition in lnd2atm depending on waterbulk_inst%qflx_surf_col, drain and drain_perched?

Then also in lnd2atm, I update the SoilBiogeochemCarbonStateType accumulated DOC variable ?

Why and where do I need to empty the accumulated DOC variable ? isn't it fine to overwrite it in lnd2atm?

I really appreciate the help, Marius
 

mariuslam

Marius Lambert
New Member
Hi,

I added the DOC_ACC variable in the state file.
All the rest of the code is in lnd2atm: where I pass the DOC flux to DOC_ACC, then have the condition (if there is runoff I move some DOC_ACC to a temporary variable), then remove the temporary DOC from DOC_ACC.

I tested the output and it seems to work fine, Thank you!!
Let me know if this seems right to you as well.

PS: There is something weird happening, for the same run, sometimes my "write(iulog,*)..." statements appear in the log file but sometimes they don't.

Cheers,

Marius
 

sacks

Bill Sacks
CSEG and Liaisons
Staff member
Hi Marius,

I'm glad to hear that you have gotten this working. Do you still have some remaining questions from your post on Friday or have you resolved this all now?

For the write statements, have you checked both the lnd log and the cesm log files? (Output from the main / masterproc go to the lnd log; output from other processors goes to the cesm log file.)
 

mariuslam

Marius Lambert
New Member
Hi, No I think this solved the questions on the last post.

The accumulation pool seems to be building up correctly, but in MOSART, some grid-cells have really weird values for DOC...
For example, surface runoff input is below 300 m3/s, but some gridcells show abnormally high DOC input 80 000 kgC/s, this despite the condition in lnd2atm to only send maximum 0.3gC/liter of water from the accumulated DOC pool.

I think I have already made sure unit changes along the way are correct..
1) Could this be due to different time steps for water and DOC calculations since I added DOC to the water structure in CTSM (waterlnd2atmbulk_inst%qflx_subdoc_grc) ?
2) Is there some weighting or other factor that should be different from sending RUNOFF vs DOC to MOSART ?

Thank you for helping!

Links to branches:
cmeps
CTSM
MOSART
 
Top