Opened 9 months ago

Closed 9 months ago

#646 closed defect (fixed)

Mass balance closure

Reported by: luyssaert Owned by: luyssaert
Priority: critical Milestone: IPSLCM6.v2
Component: Biogeochemical processes Version:
Keywords: Cc:


r6437 (OOL_SEC_STO_FG2 with FM = 2) crashed

Date: 1905-07-12 0.0000sec at timestep 79297
5 Error: mass balance is not closed in nitrogen_dynamics for nitrogen
5 ipts, ivm; 12 9
5 Difference is, 1.769512891769409E-008
5 pool_end,pool_start: 36965253.6348079 35538681.0188180
5FATAL ERROR FROM ROUTINE nitrogen_dynamics
5 --> Mass balance error
5 -->
5 -->

The error could be reproduced for a 3x3 test case.

Change History (2)

comment:1 Changed 9 months ago by luyssaert

The code used a rather elegant way to calculate the final mineral soil nitrogen based on the fluxes calculated in nitrogen_dynamics.

soil_n_min(:,:,iammonium) = MAX(zero, soil_n_min(:,:,iammonium) + n_adsorbed(:,:) &
   - nitrification(:,:,i_nh4_to_no3) - nitrification(:,:,i_nh4_to_no) &
   - nitrification(:,:,i_nh4_to_n2o) - leaching(:,:,iammonium) &
   - emission(:,:,iammonium) - plant_n_uptake(:,:,iammonium)) 

In case these values had to be truncated, nitrogen was lost. This part has been rewritten as a long series of WHERE statements. Less elegant but it conserves mass.

Another mass balance issue was related to the order of the calculations. n_fungivores was added to plant_n_uptake too early in the code which could result in n_fungivores being truncated (see the issue described above) thus loosing N. n_fungivores is now dealt with at the end of the code guaranteeing that no N is lost from n_fungivores.

These changes have been comitted in r6444.

comment:2 Changed 9 months ago by luyssaert

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.