L5_Design document for generic BGC interface

The Design Document page provides a description of the algorithms, implementation and planned testing including unit, verification, validation and performance testing. Please read  Step 1.3 Performance Expectations that explains feature documentation requirements from the performance group point of view. 

Design Document

 Click here for instructions to fill up the table below ......

The first table in Design Document gives overview of this document, from this info the Design Documents Overview page is automatically created.

In the overview table below 4.Equ means Equations and Algorithms, 5.Ver means Verification, 6.Perf - Performance, 7. Val - Validation

  • Equations: Document the equations that are being solved and describe algorithms
  • Verification Plans: Define tests that will be run to show that implementation is correct and robust. Involve unit tests to cover range of inputs as well as benchmarks.
  • Performance expectations: Explain the expected performance impact from this development
  • Validation Plans: Document what process-based, stand-alone component, and coupled model runs will be performed, and with what metrics will be used to assess validity

Use the symbols below (copy and paste) to indicate if the section is in progress or done or not started.

In the table below 4.Equ means Equations and Algorithms, 5.Ver means Verification, 6.Perf - Performance, 7. Val - Validation,   (tick) - completed, (warning) - in progress, (error) - not done

 

Overview table for the owner and an approver of this feature

1.Description

Add generic BioGeoChemistry interface for coupling ALM with alternative soil BGC modules
2.OwnerGangsheng Wang (Unlicensed)
3.Created 
4.Equ(tick)
5.Ver(tick)
6.Perf(tick)
7.Val(tick)
8.ApproverPeter Thornton, William Riley (Unlicensed)
9.Approved Date 
V1.0Accepted
 Click here for Table of Contents ...

Table of Contents

 

 

 

Title: Add generic BioGeoChemistry interface for coupling ALM with alternative soil BGC modules

Requirements and Design

ACME Land Group

Date:     

Summary

A generic BGC interface is added to ALM to facilitate the coupling of ALM vegetation sub-model with alternative soil BGC modules, e.g., pflotran and BeTR. As an example to show how the interface works, we will enable running ALM soil BGC sub-model through the interface and expect to obtain bit-for-bit (BFB) outputs compared to original ACME outputs.

 

Requirements

Requirement: Provide a generic data structure

Date last modified:     
Contributors: Gangsheng Wang (Unlicensed)

Provide a generic data structure that includes potential input and output variables. 

 

Requirement: Provide generic functions/subroutines to facilitate the use of the interface

Date last modified:     
Contributors: Gangsheng Wang (Unlicensed)

Provide generic functions/subroutines to implement data passing between the vegetation and soil BGC sub-models

 

Requirement: Modify ALM code to separate soil BGC sub-model from vegetation sub-model

Date last modified:     
Contributors: Gangsheng Wang (Unlicensed)

Modify ALM subroutines to make the soil BGC sub-model standalone. Thus any alternative soil BGC sub-model (e.g., pflotran or BeTR) can be called to replace the original ALM soil BGC sub-model.


Requirement: Run ALM soil BGC sub-model through the interface

Date last modified:     
Contributors: Gangsheng Wang (Unlicensed)

Enable running the standalone ALM soil BGC sub-model by using the interface data structure and functions/subroutines.

Algorithmic Formulations

Design solution: Provide a generic data structure

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

No new algorithmic formulations are required.

Design solution:Provide generic functions/subroutines to facilitate the use of the interface

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

No new algorithmic formulations are required.

Design solution:Modify ALM code to separate soil BGC sub-model from vegetation sub-model

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

No new algorithmic formulations are required.

Design solution: Run ALM soil BGC sub-model through the interface

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

No new algorithmic formulations are required.

Design and Implementation

Implementation: Provide a generic data structure

Date last modified:  
Contributors: Gangsheng Wang (Unlicensed)

 

Add a generic data structure (clm_bgc_interface_data_type) in a new F90 module (clm_bgc_interface_data.F90) that includes potential input and output variables for the coupling between the vegetation sub-model and soil BGC sub-model.
Generally the input variables include
(1) soil BGC state variables;
(2) input fluxes to soil BGC pools;
(3) plant nitrogen/phosphorus demands;
(4) soil properties; and
(5) environmental variables such as soil temperature, soil moisture and oxygen variables. 
The output variables are specific depending on the soil BGC sub-model and generally include
(1) soil BGC fluxes;
(2) plant uptake of nutrients; and
(3) soil BGC state variables. 


ImplementationProvide generic functions/subroutines to facilitate the use of the interface

Date last modified:  
Contributors: Gangsheng Wang (Unlicensed)

 

Add a new F90 module (clm_bgc_interfaceMod.F90) that includes generic functions/subroutines to facilitate the use of the BGC interface. 
These interface functions/subroutines will realize the coupling between sub-models via three general steps:
STEP-1: pass data from ALM variables to clm_bgc_data (an instance of clm_bgc_interface_data_type).

STEP-2: (1) pass data from clm_bgc_data to soil BGC sub-model

              (2) run soil BGC sub-model

              (3) update clm_bgc_data from soil BGC sub-model

STEP-3: update ALM variables from clm_bgc_data

Implementation:Modify ALM code to separate soil BGC sub-model from vegetation sub-model

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

Major code revisions include:

  • break down the subroutine 'CNEcosystemDynNoLeaching' into two subroutines:
    (1) CNEcosystemDynNoLeaching1: called before running soil BGC sub-model
    (2) CNEcosystemDynNoLeaching2: called after running soil BGC sub-model

  • break down the subroutine 'CNDecompAlloc' into two subroutines:
    (1) CNDecompAlloc: the standalone ALM soil BGC module that keeps the majority of code in original 'CNDecompAlloc', only Phase-2 of CNAllocation (i.e., CNAllocation2_ResolveNPLimit) is called in this subroutine.
    (2) CNDecompAlloc2: integration of net_nmin/pmin, gross_nmin/pmin to column level is moved from original CNDecompAlloc to this subroutine; Phase-3 of CNAllocation (i.e., CNAllocation3_PlantCNPAlloc) is implemetned in this subroutine. Additional calculations required by specific soil BGC sub-model may also be included in this subroutine, e.g, integration of plant N/P uptake to column level and calculation of fpg and fpi while pflotran is coupled to ALM. 

  • break down the subroutine 'CNAllocation' into three subroutines
    (1) CNAllocation1_PlantNPDemand: calculate plant N/P demand; called in CNEcosystemDynNoLeaching1.
    (2) CNAllocation2_ResolveNPLimitResolve N/P Limitation; called in CNDecompAlloc
    (3) CNAllocation3_PlantCNPAllocPlant C/N/P Allocation; called in CNDecompAlloc2

The code structure with the BGC interface is shown in the figure below:

BGC_interface_code_struct.pdf

 

In summary, 30 files have been changed:

  1. models/lnd/clm/src/biogeochem/CNAllocationMod.F90
  2. models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90
  3. models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90
  4. models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90
  5. models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90
  6. models/lnd/clm/src/biogeochem/CNCarbonFluxType.F90
  7. models/lnd/clm/src/biogeochem/CNCarbonStateType.F90
  8. models/lnd/clm/src/biogeochem/CNDecompMod.F90
  9. models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90
  10. models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90
  11. models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90
  12. models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90
  13. models/lnd/clm/src/biogeochem/CNNitrogenFluxType.F90
  14. models/lnd/clm/src/biogeochem/CNNitrogenStateType.F90
  15. models/lnd/clm/src/biogeochem/PStateUpdate1Mod.F90
  16. models/lnd/clm/src/biogeochem/PStateUpdate2Mod.F90
  17. models/lnd/clm/src/biogeochem/PStateUpdate3Mod.F90
  18. models/lnd/clm/src/biogeochem/PhosphorusFluxType.F90
  19. models/lnd/clm/src/biogeochem/PhosphorusStateType.F90
  20. models/lnd/clm/src/main/clm_bgc_interfaceMod.F90
  21. models/lnd/clm/src/main/clm_bgc_interface_data.F90
  22. models/lnd/clm/src/main/clm_driver.F90
  23. models/lnd/clm/src/main/clm_initializeMod.F90
  24. models/lnd/clm/src/main/clm_pflotran_interfaceMod.F90
  25. models/lnd/clm/src/main/clm_varctl.F90
  26. models/lnd/clm/src/main/controlMod.F90
  27. models/lnd/clm/src/utils/clm_time_manager.F90

Implementation: Run ALM soil BGC sub-model through the interface

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

  • Two options are added into the namelist 'clm_inparm':
    (1) use_bgc_interface: whether to use BGC interface or not.
    (2) use_clm_bgc: whether to run ALM soil BGC sub-model through interface
  • sequential of subroutines in 'clm_drv':
    (1) call CNEcosystemDynNoLeaching1
    (2) if (use_bgc_interface) call get_clm_bgc_data
    (3) if (use_clm_bgc) call clm_bgc_run; call update_bgc_date_clm2clm
    (4) call CNEcosystemDynNoLeaching2

Planned Verification and Unit Testing 

Verification and Unit Testing: Run ALM soil BGC sub-model through the interface

Date last modified:   
Contributors: Gangsheng Wang (Unlicensed)

 

This design requirement will be verified on the basis of BFB testing. All capability of the ACME model will be reproduced in the point and global run w/ or w/o running ALM soil BGC sub-model through the interface. 

Planned Validation Testing 

Validation Testing: Run ALM soil BGC sub-model through the interface

Date last modified:  
Contributors: Gangsheng Wang (Unlicensed)

 

Since the model run of clm-bgc through interface is BFB compared to original ALM, the validation of the BGC interface will follow the validation tests of L6_Add phosphorus cycle.

Planned Performance Testing 

Performance Testing: Run ALM soil BGC sub-model through the interface

Date last modified:  
Contributors: Gangsheng Wang (Unlicensed)

 

Performance impacts of the addition of topographic units will be evaluated using the built-in timing tools while conducting verification tests described above (BFB testing).