Downwards transport of solutes, litter and humus with percolation water.
30 if ( have_water_table &&
31 cbm::flt_greater_zero( infiltration))
33 ldndc_kassert( h_wl > 0.0);
35 accumulated_n_nh4_infiltration_leach_sl[0] -= nh4_an_sl[0] + sc_.coated_nh4_sl[0];
36 accumulated_n_nh3_infiltration_leach_sl[0] -= sc_.nh3_liq_sl[0];
37 accumulated_n_no_infiltration_leach_sl[0] -= an_no_liq_sl[0];
38 accumulated_n_n2o_infiltration_leach_sl[0] -= an_n2o_liq_sl[0];
39 accumulated_n_urea_infiltration_leach_sl[0] -= sc_.urea_sl[0];
40 accumulated_n_no3_infiltration_leach_sl[0] -= no3_an_sl[0];
41 accumulated_n_don_infiltration_leach_sl[0] -= don_an_sl[0];
43 double const leach_fact_sbl( cbm::bound_max( infiltration / h_wl, 0.99));
44 LEACH_DOWN( sb_.ch4_sbl[0], ch4_liq_sl[0], leach_fact_sbl);
45 LEACH_DOWN( sb_.o2_sbl[0], o2_liq_sl[0], leach_fact_sbl);
46 LEACH_DOWN( sb_.nh4_sbl[0], nh4_an_sl[0], leach_fact_sbl);
47 LEACH_DOWN( sb_.coated_nh4_sbl[0], sc_.coated_nh4_sl[0], leach_fact_sbl);
48 LEACH_DOWN( sb_.nh3_sbl[0], sc_.nh3_liq_sl[0], leach_fact_sbl);
49 LEACH_DOWN( sb_.no_sbl[0], an_no_liq_sl[0], leach_fact_sbl);
50 LEACH_DOWN( sb_.n2o_sbl[0], an_n2o_liq_sl[0], leach_fact_sbl);
51 LEACH_DOWN( sb_.urea_sbl[0], sc_.urea_sl[0], leach_fact_sbl);
52 LEACH_DOWN( sb_.no3_sbl[0], no3_an_sl[0], leach_fact_sbl);
53 LEACH_DOWN( sb_.don_sbl[0], don_an_sl[0], leach_fact_sbl);
54 LEACH_DOWN( sb_.doc_sbl[0], sc_.doc_sl[0], leach_fact_sbl);
55 LEACH_DOWN( sb_.co2_sbl[0], co2_liq_sl[0], leach_fact_sbl);
56 LEACH_DOWN( sb_.so4_sbl[0], sc_.so4_sl[0], leach_fact_sbl);
57 LEACH_DOWN( sb_.ni_sbl[0], sc_.ni_sl[0], leach_fact_sbl);
59 accumulated_n_nh4_infiltration_leach_sl[0] += nh4_an_sl[0] + sc_.coated_nh4_sl[0];
60 accumulated_n_nh3_infiltration_leach_sl[0] += sc_.nh3_liq_sl[0];
61 accumulated_n_no_infiltration_leach_sl[0] += an_no_liq_sl[0];
62 accumulated_n_n2o_infiltration_leach_sl[0] += an_n2o_liq_sl[0];
63 accumulated_n_urea_infiltration_leach_sl[0] += sc_.urea_sl[0];
64 accumulated_n_no3_infiltration_leach_sl[0] += no3_an_sl[0];
65 accumulated_n_don_infiltration_leach_sl[0] += don_an_sl[0];
67 for (
size_t sbl = 1; sbl < sb_.surfacebulk_layer_cnt(); ++sbl)
69 size_t const sbl_plus( sbl - 1);
70 LEACH_DOWN( sb_.ch4_sbl[sbl], sb_.ch4_sbl[sbl_plus], leach_fact_sbl);
71 LEACH_DOWN( sb_.o2_sbl[sbl], sb_.o2_sbl[sbl_plus], leach_fact_sbl);
72 LEACH_DOWN( sb_.nh4_sbl[sbl], sb_.nh4_sbl[sbl_plus], leach_fact_sbl);
73 LEACH_DOWN( sb_.coated_nh4_sbl[sbl], sb_.coated_nh4_sbl[sbl_plus], leach_fact_sbl);
74 LEACH_DOWN( sb_.nh3_sbl[sbl], sb_.nh3_sbl[sbl_plus], leach_fact_sbl);
75 LEACH_DOWN( sb_.no_sbl[sbl], sb_.no_sbl[sbl_plus], leach_fact_sbl);
76 LEACH_DOWN( sb_.n2o_sbl[sbl], sb_.n2o_sbl[sbl_plus], leach_fact_sbl);
77 LEACH_DOWN( sb_.urea_sbl[sbl], sb_.urea_sbl[sbl_plus], leach_fact_sbl);
78 LEACH_DOWN( sb_.no3_sbl[sbl], sb_.no3_sbl[sbl_plus], leach_fact_sbl);
79 LEACH_DOWN( sb_.don_sbl[sbl], sb_.don_sbl[sbl_plus], leach_fact_sbl);
80 LEACH_DOWN( sb_.doc_sbl[sbl], sb_.doc_sbl[sbl_plus], leach_fact_sbl);
81 LEACH_DOWN( sb_.co2_sbl[sbl], sb_.co2_sbl[sbl_plus], leach_fact_sbl);
82 LEACH_DOWN( sb_.so4_sbl[sbl], sb_.so4_sbl[sbl_plus], leach_fact_sbl);
83 LEACH_DOWN( sb_.ni_sbl[sbl], sb_.ni_sbl[sbl_plus], leach_fact_sbl);
91 if ( cbm::flt_greater_zero( waterflux_sl[0]) &&
92 cbm::flt_greater_zero( v_water_sl[0]))
95 size_t const sl_plus( 1);
97 double const leach_fact( cbm::bound_min( 0.0, waterflux_sl[sl] / v_water_sl[sl]));
99 double const leach_fact_nh4( cbm::bound_max( leach_fact * sipar_.RETNH4(), 0.9999));
100 double const leach_fact_no3( cbm::bound_max( leach_fact * sipar_.RETNO3(), 0.9999));
101 double const leach_fact_doc( cbm::bound_max( leach_fact * sipar_.RETDOC(), 0.9999));
102 double const leach_fact_mic( cbm::bound_max( leach_fact * sipar_.METRX_RET_MICROBES(), 0.9999));
103 double const leach_fact_lit( cbm::bound_max( leach_fact * sipar_.METRX_RET_LITTER(), 0.9999));
104 double const leach_fact_hum( cbm::bound_max( leach_fact * sipar_.METRX_RET_HUMUS(), 0.9999));
105 double const leach_fact_dissolved_gases( cbm::bound_max( leach_fact, 0.9999));
107 accumulated_n_aorg_leaching_sl[sl] += sc_.N_aorg_sl[sl] * leach_fact_mic;
108 LEACH_DOWN( sc_.C_aorg_sl[sl], sc_.C_aorg_sl[sl_plus], leach_fact_mic);
109 LEACH_DOWN( sc_.N_aorg_sl[sl], sc_.N_aorg_sl[sl_plus], leach_fact_mic);
111 transport_.leach_down_epsilon( sc_.C_micro1_sl[sl], sc_.C_micro1_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro1_sl[sl]));
112 transport_.leach_down_epsilon( sc_.C_micro2_sl[sl], sc_.C_micro2_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro2_sl[sl]));
113 transport_.leach_down_epsilon( sc_.C_micro3_sl[sl], sc_.C_micro3_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro3_sl[sl]));
115 if( n_micro_1_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]) )
117 accumulated_n_micro_leaching_sl[sl] += ( n_micro_1_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]) ) * leach_fact_mic;
119 if( n_micro_2_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]) )
121 accumulated_n_micro_leaching_sl[sl] += ( n_micro_2_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]) ) * leach_fact_mic;
123 if( n_micro_3_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]) )
125 accumulated_n_micro_leaching_sl[sl] += ( n_micro_3_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]) ) * leach_fact_mic;
127 transport_.leach_down_epsilon( n_micro_1_sl[sl], n_micro_1_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]));
128 transport_.leach_down_epsilon( n_micro_2_sl[sl], n_micro_2_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]));
129 transport_.leach_down_epsilon( n_micro_3_sl[sl], n_micro_3_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]));
131 LEACH_DOWN( sc_.C_lit1_sl[sl], sc_.C_lit1_sl[sl_plus], leach_fact_lit);
132 LEACH_DOWN( sc_.C_lit2_sl[sl], sc_.C_lit2_sl[sl_plus], leach_fact_lit);
133 LEACH_DOWN( sc_.C_lit3_sl[sl], sc_.C_lit3_sl[sl_plus], leach_fact_lit);
135 accumulated_n_litter_leaching_sl[sl] += (sc_.N_lit1_sl[sl] + sc_.N_lit2_sl[sl] + sc_.N_lit3_sl[sl]) * leach_fact_lit;
136 LEACH_DOWN( sc_.N_lit1_sl[sl], sc_.N_lit1_sl[sl_plus], leach_fact_lit);
137 LEACH_DOWN( sc_.N_lit2_sl[sl], sc_.N_lit2_sl[sl_plus], leach_fact_lit);
138 LEACH_DOWN( sc_.N_lit3_sl[sl], sc_.N_lit3_sl[sl_plus], leach_fact_lit);
140 LEACH_DOWN( c_humus_1_sl[sl], c_humus_1_sl[sl_plus], leach_fact_hum);
141 LEACH_DOWN( c_humus_2_sl[sl], c_humus_2_sl[sl_plus], leach_fact_hum);
142 LEACH_DOWN( c_humus_3_sl[sl], c_humus_3_sl[sl_plus], leach_fact_hum);
144 accumulated_n_humus_1_leaching_sl[sl] += n_humus_1_sl[sl] * leach_fact_hum;
145 accumulated_n_humus_2_leaching_sl[sl] += n_humus_2_sl[sl] * leach_fact_hum;
146 accumulated_n_humus_3_leaching_sl[sl] += n_humus_3_sl[sl] * leach_fact_hum;
147 LEACH_DOWN( n_humus_1_sl[sl], n_humus_1_sl[sl_plus], leach_fact_hum);
148 LEACH_DOWN( n_humus_2_sl[sl], n_humus_2_sl[sl_plus], leach_fact_hum);
149 LEACH_DOWN( n_humus_3_sl[sl], n_humus_3_sl[sl_plus], leach_fact_hum);
151 accumulated_n_nh4_leaching_sl[sl] += (nh4_ae_sl[sl] + nh4_an_sl[sl] + sc_.coated_nh4_sl[sl]) * leach_fact_nh4;
152 accumulated_n_nh3_leaching_sl[sl] += sc_.nh3_liq_sl[sl] * leach_fact_doc;
153 accumulated_n_urea_leaching_sl[sl] += sc_.urea_sl[sl] * leach_fact_doc;
154 LEACH_DOWN( nh4_ae_sl[sl], nh4_ae_sl[sl_plus], leach_fact_nh4);
155 LEACH_DOWN( nh4_an_sl[sl], nh4_an_sl[sl_plus], leach_fact_nh4);
156 LEACH_DOWN( sc_.coated_nh4_sl[sl], sc_.coated_nh4_sl[sl_plus], leach_fact_nh4);
157 LEACH_DOWN( sc_.nh3_liq_sl[sl], sc_.nh3_liq_sl[sl_plus], leach_fact_doc);
158 LEACH_DOWN( sc_.urea_sl[sl], sc_.urea_sl[sl_plus], leach_fact_doc);
160 sc_.accumulated_n_no3_leaching_sl[sl] += (no3_ae_sl[sl] + no3_an_sl[sl]) * leach_fact_no3;
161 LEACH_DOWN( no3_ae_sl[sl], no3_ae_sl[sl_plus], leach_fact_no3);
162 LEACH_DOWN( no3_an_sl[sl], no3_an_sl[sl_plus], leach_fact_no3);
164 accumulated_n_don_leaching_sl[sl] += (don_ae_sl[sl] + don_an_sl[sl]) * leach_fact_doc;
165 LEACH_DOWN( don_ae_sl[sl], don_ae_sl[sl_plus], leach_fact_doc);
166 LEACH_DOWN( don_an_sl[sl], don_an_sl[sl_plus], leach_fact_doc);
167 LEACH_DOWN( sc_.doc_sl[sl], sc_.doc_sl[sl_plus], leach_fact_doc);
168 LEACH_DOWN( sc_.an_doc_sl[sl], sc_.an_doc_sl[sl_plus], leach_fact_doc);
169 LEACH_DOWN( ae_acetate_sl[sl], ae_acetate_sl[sl_plus], leach_fact_doc);
170 LEACH_DOWN( an_acetate_sl[sl], an_acetate_sl[sl_plus], leach_fact_doc);
172 accumulated_n_no_leaching_sl[sl] += (no_liq_sl[sl]+an_no_liq_sl[sl]) * leach_fact_dissolved_gases;
173 accumulated_n_n2o_leaching_sl[sl] += (n2o_liq_sl[sl]+an_n2o_liq_sl[sl]) * leach_fact_dissolved_gases;
174 LEACH_DOWN( no_liq_sl[sl], no_liq_sl[sl_plus], leach_fact_dissolved_gases);
175 LEACH_DOWN( an_no_liq_sl[sl], an_no_liq_sl[sl_plus], leach_fact_dissolved_gases);
176 LEACH_DOWN( n2o_liq_sl[sl], n2o_liq_sl[sl_plus], leach_fact_dissolved_gases);
177 LEACH_DOWN( an_n2o_liq_sl[sl], an_n2o_liq_sl[sl_plus], leach_fact_dissolved_gases);
179 LEACH_DOWN( ch4_liq_sl[sl], ch4_liq_sl[sl_plus], leach_fact_dissolved_gases);
180 LEACH_DOWN( co2_liq_sl[sl], co2_liq_sl[sl_plus], leach_fact_dissolved_gases);
181 LEACH_DOWN( o2_liq_sl[sl], o2_liq_sl[sl_plus], leach_fact_dissolved_gases);
183 LEACH_DOWN( sc_.so4_sl[sl], sc_.so4_sl[sl_plus], leach_fact_no3);
184 LEACH_DOWN( sc_.ni_sl[sl], sc_.ni_sl[sl_plus], leach_fact_doc);
187 for(
size_t sl = 1; sl < sl_.soil_layer_cnt()-1; ++sl)
189 if ( !cbm::flt_equal_zero( waterflux_sl[sl]) &&
190 cbm::flt_greater_zero( v_water_sl[sl]))
192 size_t sl_minus( sl - 1);
193 size_t sl_plus( sl + 1);
195 double const leach_fact( waterflux_sl[sl] / v_water_sl[sl]);
197 double const leach_fact_nh4( cbm::bound(-0.9999, leach_fact * sipar_.RETNH4(), 0.9999));
198 double const leach_fact_no3( cbm::bound(-0.9999, leach_fact * sipar_.RETNO3(), 0.9999));
199 double const leach_fact_doc( cbm::bound(-0.9999, leach_fact * sipar_.RETDOC(), 0.9999));
200 double const leach_fact_mic( cbm::bound(-0.9999, leach_fact * sipar_.METRX_RET_MICROBES(), 0.9999));
201 double const leach_fact_lit( cbm::bound(-0.9999, leach_fact * sipar_.METRX_RET_LITTER(), 0.9999));
202 double const leach_fact_hum( cbm::bound(-0.9999, leach_fact * sipar_.METRX_RET_HUMUS(), 0.9999));
203 double const leach_fact_dissolved_gases( cbm::bound(-0.9999, leach_fact, 0.9999));
205 accumulated_n_aorg_leaching_sl[sl] += sc_.N_aorg_sl[sl] * leach_fact_mic;
206 transport_.leach_up_and_down( sc_.C_aorg_sl[sl_minus], sc_.C_aorg_sl[sl], sc_.C_aorg_sl[sl_plus], leach_fact_mic);
207 transport_.leach_up_and_down( sc_.N_aorg_sl[sl_minus], sc_.N_aorg_sl[sl], sc_.N_aorg_sl[sl_plus], leach_fact_mic);
209 transport_.leach_up_and_down_epsilon( sc_.C_micro1_sl[sl_minus], sc_.C_micro1_sl[sl], sc_.C_micro1_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro1_sl[sl]));
210 transport_.leach_up_and_down_epsilon( sc_.C_micro2_sl[sl_minus], sc_.C_micro2_sl[sl], sc_.C_micro2_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro2_sl[sl]));
211 transport_.leach_up_and_down_epsilon( sc_.C_micro3_sl[sl_minus], sc_.C_micro3_sl[sl], sc_.C_micro3_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro3_sl[sl]));
213 if( n_micro_1_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]) )
215 accumulated_n_micro_leaching_sl[sl] += ( n_micro_1_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]) ) * leach_fact_mic;
217 if( n_micro_2_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]) )
219 accumulated_n_micro_leaching_sl[sl] += ( n_micro_2_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]) ) * leach_fact_mic;
221 if( n_micro_3_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]) )
223 accumulated_n_micro_leaching_sl[sl] += ( n_micro_3_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]) ) * leach_fact_mic;
225 transport_.leach_up_and_down_epsilon( n_micro_1_sl[sl_minus], n_micro_1_sl[sl], n_micro_1_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]));
226 transport_.leach_up_and_down_epsilon( n_micro_2_sl[sl_minus], n_micro_2_sl[sl], n_micro_2_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]));
227 transport_.leach_up_and_down_epsilon( n_micro_3_sl[sl_minus], n_micro_3_sl[sl], n_micro_3_sl[sl_plus], leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]));
229 transport_.leach_up_and_down( sc_.C_lit1_sl[sl_minus], sc_.C_lit1_sl[sl], sc_.C_lit1_sl[sl_plus], leach_fact_lit);
230 transport_.leach_up_and_down( sc_.C_lit2_sl[sl_minus], sc_.C_lit2_sl[sl], sc_.C_lit2_sl[sl_plus], leach_fact_lit);
231 transport_.leach_up_and_down( sc_.C_lit3_sl[sl_minus], sc_.C_lit3_sl[sl], sc_.C_lit3_sl[sl_plus], leach_fact_lit);
233 accumulated_n_litter_leaching_sl[sl] += (sc_.N_lit1_sl[sl]+sc_.N_lit2_sl[sl]+sc_.N_lit3_sl[sl]) * leach_fact_lit;
234 transport_.leach_up_and_down( sc_.N_lit1_sl[sl_minus], sc_.N_lit1_sl[sl], sc_.N_lit1_sl[sl_plus], leach_fact_lit);
235 transport_.leach_up_and_down( sc_.N_lit2_sl[sl_minus], sc_.N_lit2_sl[sl], sc_.N_lit2_sl[sl_plus], leach_fact_lit);
236 transport_.leach_up_and_down( sc_.N_lit3_sl[sl_minus], sc_.N_lit3_sl[sl], sc_.N_lit3_sl[sl_plus], leach_fact_lit);
238 transport_.leach_up_and_down( c_humus_1_sl[sl_minus], c_humus_1_sl[sl], c_humus_1_sl[sl_plus], leach_fact_hum);
239 transport_.leach_up_and_down( c_humus_2_sl[sl_minus], c_humus_2_sl[sl], c_humus_2_sl[sl_plus], leach_fact_hum);
240 transport_.leach_up_and_down( c_humus_3_sl[sl_minus], c_humus_3_sl[sl], c_humus_3_sl[sl_plus], leach_fact_hum);
242 accumulated_n_humus_1_leaching_sl[sl] += n_humus_1_sl[sl] * leach_fact_hum;
243 accumulated_n_humus_2_leaching_sl[sl] += n_humus_2_sl[sl] * leach_fact_hum;
244 accumulated_n_humus_3_leaching_sl[sl] += n_humus_3_sl[sl] * leach_fact_hum;
245 transport_.leach_up_and_down( n_humus_1_sl[sl_minus], n_humus_1_sl[sl], n_humus_1_sl[sl_plus], leach_fact_hum);
246 transport_.leach_up_and_down( n_humus_2_sl[sl_minus], n_humus_2_sl[sl], n_humus_2_sl[sl_plus], leach_fact_hum);
247 transport_.leach_up_and_down( n_humus_3_sl[sl_minus], n_humus_3_sl[sl], n_humus_3_sl[sl_plus], leach_fact_hum);
249 accumulated_n_nh4_leaching_sl[sl] += (nh4_ae_sl[sl] + nh4_an_sl[sl] + sc_.coated_nh4_sl[sl]) * leach_fact_nh4;
250 accumulated_n_nh3_leaching_sl[sl] += sc_.nh3_liq_sl[sl] * leach_fact_doc;
251 accumulated_n_urea_leaching_sl[sl] += sc_.urea_sl[sl] * leach_fact_doc;
252 transport_.leach_up_and_down( nh4_ae_sl[sl_minus], nh4_ae_sl[sl], nh4_ae_sl[sl_plus], leach_fact_nh4);
253 transport_.leach_up_and_down( nh4_an_sl[sl_minus], nh4_an_sl[sl], nh4_an_sl[sl_plus], leach_fact_nh4);
254 transport_.leach_up_and_down( sc_.coated_nh4_sl[sl_minus], sc_.coated_nh4_sl[sl], sc_.coated_nh4_sl[sl_plus], leach_fact_nh4);
255 transport_.leach_up_and_down( sc_.nh3_liq_sl[sl_minus], sc_.nh3_liq_sl[sl], sc_.nh3_liq_sl[sl_plus], leach_fact_doc);
256 transport_.leach_up_and_down( sc_.urea_sl[sl_minus], sc_.urea_sl[sl], sc_.urea_sl[sl_plus], leach_fact_doc);
258 sc_.accumulated_n_no3_leaching_sl[sl] += (no3_ae_sl[sl]+no3_an_sl[sl]) * leach_fact_no3;
259 transport_.leach_up_and_down( no3_ae_sl[sl_minus], no3_ae_sl[sl], no3_ae_sl[sl_plus], leach_fact_no3);
260 transport_.leach_up_and_down( no3_an_sl[sl_minus], no3_an_sl[sl], no3_an_sl[sl_plus], leach_fact_no3);
262 accumulated_n_don_leaching_sl[sl] += (don_ae_sl[sl] + don_an_sl[sl]) * leach_fact_doc;
263 transport_.leach_up_and_down( don_ae_sl[sl_minus], don_ae_sl[sl], don_ae_sl[sl_plus], leach_fact_doc);
264 transport_.leach_up_and_down( don_an_sl[sl_minus], don_an_sl[sl], don_an_sl[sl_plus], leach_fact_doc);
265 transport_.leach_up_and_down( sc_.doc_sl[sl_minus], sc_.doc_sl[sl], sc_.doc_sl[sl_plus], leach_fact_doc);
266 transport_.leach_up_and_down( sc_.an_doc_sl[sl_minus], sc_.an_doc_sl[sl], sc_.an_doc_sl[sl_plus], leach_fact_doc);
267 transport_.leach_up_and_down( ae_acetate_sl[sl_minus], ae_acetate_sl[sl], ae_acetate_sl[sl_plus], leach_fact_doc);
268 transport_.leach_up_and_down( an_acetate_sl[sl_minus], an_acetate_sl[sl], an_acetate_sl[sl_plus], leach_fact_doc);
270 accumulated_n_no_leaching_sl[sl] += (no_liq_sl[sl]+an_no_liq_sl[sl]) * leach_fact_dissolved_gases;
271 accumulated_n_n2o_leaching_sl[sl] += (n2o_liq_sl[sl]+an_n2o_liq_sl[sl]) * leach_fact_dissolved_gases;
272 transport_.leach_up_and_down( no_liq_sl[sl_minus], no_liq_sl[sl], no_liq_sl[sl_plus], leach_fact_dissolved_gases);
273 transport_.leach_up_and_down( an_no_liq_sl[sl_minus], an_no_liq_sl[sl], an_no_liq_sl[sl_plus], leach_fact_dissolved_gases);
274 transport_.leach_up_and_down( n2o_liq_sl[sl_minus], n2o_liq_sl[sl], n2o_liq_sl[sl_plus], leach_fact_dissolved_gases);
275 transport_.leach_up_and_down( an_n2o_liq_sl[sl_minus], an_n2o_liq_sl[sl], an_n2o_liq_sl[sl_plus], leach_fact_dissolved_gases);
277 transport_.leach_up_and_down( ch4_liq_sl[sl_minus], ch4_liq_sl[sl], ch4_liq_sl[sl_plus], leach_fact_dissolved_gases);
278 transport_.leach_up_and_down( co2_liq_sl[sl_minus], co2_liq_sl[sl], co2_liq_sl[sl_plus], leach_fact_dissolved_gases);
279 transport_.leach_up_and_down( o2_liq_sl[sl_minus], o2_liq_sl[sl], o2_liq_sl[sl_plus], leach_fact_dissolved_gases);
281 transport_.leach_up_and_down( sc_.so4_sl[sl_minus], sc_.so4_sl[sl], sc_.so4_sl[sl_plus], leach_fact_no3);
282 transport_.leach_up_and_down( sc_.ni_sl[sl_minus], sc_.ni_sl[sl], sc_.ni_sl[sl_plus], leach_fact_doc);
286 size_t sl( sl_.soil_layer_cnt()-1);
288 if ( !cbm::flt_equal_zero( waterflux_sl[sl]) &&
289 cbm::flt_greater_zero( v_water_sl[sl]))
291 double dummy_out( 0.0);
292 size_t sl_minus( sl_.soil_layer_cnt()-2);
294 double const leach_fact( waterflux_sl[sl] / v_water_sl[sl]);
296 double const leach_fact_nh4( cbm::bound(-0.9999, leach_fact * sipar_.RETNH4(), 0.9999));
297 double const leach_fact_no3( cbm::bound(-0.9999, leach_fact * sipar_.RETNO3(), 0.9999));
298 double const leach_fact_doc( cbm::bound(-0.9999, leach_fact * sipar_.RETDOC(), 0.9999));
299 double const leach_fact_mic( cbm::bound(-0.9999, leach_fact * sipar_.METRX_RET_MICROBES(), 0.9999));
300 double const leach_fact_lit( cbm::bound(-0.9999, leach_fact * sipar_.METRX_RET_LITTER(), 0.9999));
301 double const leach_fact_hum( cbm::bound(-0.9999, leach_fact * sipar_.METRX_RET_HUMUS(), 0.9999));
302 double const leach_fact_dissolved_gases( cbm::bound(-0.9999, leach_fact, 0.9999));
304 accumulated_n_aorg_leaching_sl[sl] += sc_.N_aorg_sl[sl] * leach_fact_mic;
305 transport_.leach_up_and_down( sc_.C_aorg_sl[sl_minus], sc_.C_aorg_sl[sl], sc_.accumulated_doc_leach, leach_fact_mic);
306 transport_.leach_up_and_down( sc_.N_aorg_sl[sl_minus], sc_.N_aorg_sl[sl], sc_.accumulated_don_leach, leach_fact_mic);
308 transport_.leach_up_and_down_epsilon( sc_.C_micro1_sl[sl_minus], sc_.C_micro1_sl[sl], sc_.accumulated_doc_leach, leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro1_sl[sl]));
309 transport_.leach_up_and_down_epsilon( sc_.C_micro2_sl[sl_minus], sc_.C_micro2_sl[sl], sc_.accumulated_doc_leach, leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro2_sl[sl]));
310 transport_.leach_up_and_down_epsilon( sc_.C_micro3_sl[sl_minus], sc_.C_micro3_sl[sl], sc_.accumulated_doc_leach, leach_fact_mic, MeTrX_get_micro_c_decay_max( sc_.C_micro3_sl[sl]));
312 if( n_micro_1_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]) )
314 accumulated_n_micro_leaching_sl[sl] += ( n_micro_1_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]) ) * leach_fact_mic;
316 if( n_micro_2_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]) )
318 accumulated_n_micro_leaching_sl[sl] += ( n_micro_2_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]) ) * leach_fact_mic;
320 if( n_micro_3_sl[sl] > MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]) )
322 accumulated_n_micro_leaching_sl[sl] += ( n_micro_3_sl[sl] - MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]) ) * leach_fact_mic;
324 transport_.leach_up_and_down_epsilon( n_micro_1_sl[sl_minus], n_micro_1_sl[sl], sc_.accumulated_don_leach, leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_1_sl[sl]));
325 transport_.leach_up_and_down_epsilon( n_micro_2_sl[sl_minus], n_micro_2_sl[sl], sc_.accumulated_don_leach, leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_2_sl[sl]));
326 transport_.leach_up_and_down_epsilon( n_micro_3_sl[sl_minus], n_micro_3_sl[sl], sc_.accumulated_don_leach, leach_fact_mic, MeTrX_get_micro_n_decay_max( n_micro_3_sl[sl]));
328 transport_.leach_up_and_down( sc_.C_lit1_sl[sl_minus], sc_.C_lit1_sl[sl], sc_.accumulated_doc_leach, leach_fact_lit);
329 transport_.leach_up_and_down( sc_.C_lit2_sl[sl_minus], sc_.C_lit2_sl[sl], sc_.accumulated_doc_leach, leach_fact_lit);
330 transport_.leach_up_and_down( sc_.C_lit3_sl[sl_minus], sc_.C_lit3_sl[sl], sc_.accumulated_doc_leach, leach_fact_lit);
332 accumulated_n_litter_leaching_sl[sl] += (sc_.N_lit1_sl[sl]+sc_.N_lit2_sl[sl]+sc_.N_lit3_sl[sl]) * leach_fact_lit;
333 transport_.leach_up_and_down( sc_.N_lit1_sl[sl_minus], sc_.N_lit1_sl[sl], sc_.accumulated_don_leach, leach_fact_lit);
334 transport_.leach_up_and_down( sc_.N_lit2_sl[sl_minus], sc_.N_lit2_sl[sl], sc_.accumulated_don_leach, leach_fact_lit);
335 transport_.leach_up_and_down( sc_.N_lit3_sl[sl_minus], sc_.N_lit3_sl[sl], sc_.accumulated_don_leach, leach_fact_lit);
337 transport_.leach_up_and_down( c_humus_1_sl[sl_minus], c_humus_1_sl[sl], sc_.accumulated_doc_leach, leach_fact_hum);
338 transport_.leach_up_and_down( c_humus_2_sl[sl_minus], c_humus_2_sl[sl], sc_.accumulated_doc_leach, leach_fact_hum);
339 transport_.leach_up_and_down( c_humus_3_sl[sl_minus], c_humus_3_sl[sl], sc_.accumulated_doc_leach, leach_fact_hum);
341 accumulated_n_humus_1_leaching_sl[sl] += n_humus_1_sl[sl] * leach_fact_hum;
342 accumulated_n_humus_2_leaching_sl[sl] += n_humus_2_sl[sl] * leach_fact_hum;
343 accumulated_n_humus_3_leaching_sl[sl] += n_humus_3_sl[sl] * leach_fact_hum;
344 transport_.leach_up_and_down( n_humus_1_sl[sl_minus], n_humus_1_sl[sl], sc_.accumulated_don_leach, leach_fact_hum);
345 transport_.leach_up_and_down( n_humus_2_sl[sl_minus], n_humus_2_sl[sl], sc_.accumulated_don_leach, leach_fact_hum);
346 transport_.leach_up_and_down( n_humus_2_sl[sl_minus], n_humus_2_sl[sl], sc_.accumulated_don_leach, leach_fact_hum);
348 accumulated_n_nh4_leaching_sl[sl] += (nh4_ae_sl[sl] + nh4_an_sl[sl] + sc_.coated_nh4_sl[sl]) * leach_fact_nh4;
349 accumulated_n_nh3_leaching_sl[sl] += sc_.nh3_liq_sl[sl] * leach_fact_doc;
350 accumulated_n_urea_leaching_sl[sl] += sc_.urea_sl[sl] * leach_fact_doc;
351 transport_.leach_up_and_down( nh4_ae_sl[sl_minus], nh4_ae_sl[sl], sc_.accumulated_nh4_leach, leach_fact_nh4);
352 transport_.leach_up_and_down( nh4_an_sl[sl_minus], nh4_an_sl[sl], sc_.accumulated_nh4_leach, leach_fact_nh4);
353 transport_.leach_up_and_down( sc_.coated_nh4_sl[sl_minus], sc_.coated_nh4_sl[sl], sc_.accumulated_nh4_leach, leach_fact_nh4);
354 transport_.leach_up_and_down( sc_.nh3_liq_sl[sl_minus], sc_.nh3_liq_sl[sl], day_leach_nh3, leach_fact_doc);
355 transport_.leach_up_and_down( sc_.urea_sl[sl_minus], sc_.urea_sl[sl], day_leach_urea, leach_fact_doc);
357 sc_.accumulated_n_no3_leaching_sl[sl] += (no3_ae_sl[sl]+no3_an_sl[sl]) * leach_fact_no3;
358 transport_.leach_up_and_down( no3_ae_sl[sl_minus], no3_ae_sl[sl], sc_.accumulated_no3_leach, leach_fact_no3);
359 transport_.leach_up_and_down( no3_an_sl[sl_minus], no3_an_sl[sl], sc_.accumulated_no3_leach, leach_fact_no3);
361 accumulated_n_don_leaching_sl[sl] += (don_ae_sl[sl] + don_an_sl[sl]) * leach_fact_doc;
362 transport_.leach_up_and_down( don_ae_sl[sl_minus], don_ae_sl[sl], sc_.accumulated_don_leach, leach_fact_doc);
363 transport_.leach_up_and_down( don_an_sl[sl_minus], don_an_sl[sl], sc_.accumulated_don_leach, leach_fact_doc);
364 transport_.leach_up_and_down( sc_.doc_sl[sl_minus], sc_.doc_sl[sl], sc_.accumulated_doc_leach, leach_fact_doc);
365 transport_.leach_up_and_down( sc_.an_doc_sl[sl_minus], sc_.an_doc_sl[sl], sc_.accumulated_doc_leach, leach_fact_doc);
366 transport_.leach_up_and_down( ae_acetate_sl[sl_minus], ae_acetate_sl[sl], sc_.accumulated_doc_leach, leach_fact_doc);
367 transport_.leach_up_and_down( an_acetate_sl[sl_minus], an_acetate_sl[sl], sc_.accumulated_doc_leach, leach_fact_doc);
369 accumulated_n_no_leaching_sl[sl] += (no_liq_sl[sl]+an_no_liq_sl[sl]) * leach_fact_dissolved_gases;
370 accumulated_n_n2o_leaching_sl[sl] += (n2o_liq_sl[sl]+an_n2o_liq_sl[sl]) * leach_fact_dissolved_gases;
371 transport_.leach_up_and_down( no_liq_sl[sl_minus], no_liq_sl[sl], day_leach_no, leach_fact_dissolved_gases);
372 transport_.leach_up_and_down( an_no_liq_sl[sl_minus], an_no_liq_sl[sl], day_leach_no, leach_fact_dissolved_gases);
373 transport_.leach_up_and_down( n2o_liq_sl[sl_minus], n2o_liq_sl[sl], day_leach_n2o, leach_fact_dissolved_gases);
374 transport_.leach_up_and_down( an_n2o_liq_sl[sl_minus], an_n2o_liq_sl[sl], day_leach_n2o, leach_fact_dissolved_gases);
375 transport_.leach_up_and_down( o2_liq_sl[sl_minus], o2_liq_sl[sl], day_leach_o2, leach_fact_dissolved_gases);
377 transport_.leach_up_and_down( ch4_liq_sl[sl_minus], ch4_liq_sl[sl], subdaily_ch4_leach[subdaily_time_step_], leach_fact_dissolved_gases);
378 transport_.leach_up_and_down( co2_liq_sl[sl_minus], co2_liq_sl[sl], subdaily_co2_leach[subdaily_time_step_], leach_fact_dissolved_gases);
380 transport_.leach_up_and_down( sc_.so4_sl[sl_minus], sc_.so4_sl[sl], sc_.accumulated_so4_leach, leach_fact_no3);
381 transport_.leach_up_and_down( sc_.ni_sl[sl_minus], sc_.ni_sl[sl], dummy_out, leach_fact_doc);