You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// mean of soil wetness at start of time step at soil wetness at end of time step - assume linear
2276
2278
}
2277
2279
2280
+
// This should be in events.h/c, but with all the global state defined in this file,
2281
+
// let's leave it here for now. Maybe someday we will factor that out.
2282
+
//
2283
+
// Process events for current location/year/day
2284
+
#ifEVENT_HANDLER
2285
+
voidprocessEvents() {
2286
+
// If locEvent starts off NULL, this function will just fall through, as it should.
2287
+
constintyear=climate->year;
2288
+
constintday=climate->day;
2289
+
2290
+
// The events file has been tested on read, so we know this event list should be in chrono
2291
+
// order. However, we need to check to make sure the current event is not in the past, as
2292
+
// that would indicate an event that did not have a corresponding climate file record.
2293
+
while (locEvent!=NULL&&locEvent->year <= year&&locEvent->day <= day) {
2294
+
if (locEvent->year<year||locEvent->day<day) {
2295
+
printf("Agronomic event found for loc: %d year: %d day: %d that does not have a corresponding record in the climate file\n", locEvent->year, locEvent->year, locEvent->day);
2296
+
exit(1);
2297
+
}
2298
+
switch (locEvent->type) {
2299
+
// Implementation TBD, as we enable the various event types
2300
+
caseIRRIGATION:
2301
+
// TBD
2302
+
printf("Irrigation events not yet implemented\n");
2303
+
break;
2304
+
casePLANTING:
2305
+
// TBD
2306
+
printf("Planting events not yet implemented\n");
2307
+
break;
2308
+
caseHARVEST:
2309
+
// TBD
2310
+
printf("Harvest events not yet implemented\n");
2311
+
break;
2312
+
caseTILLAGE:
2313
+
// TBD
2314
+
printf("Tillage events not yet implemented\n");
2315
+
break;
2316
+
caseFERTILIZATION:
2317
+
// TBD
2318
+
printf("Fertilization events not yet implemented\n");
2319
+
break;
2320
+
default:
2321
+
printf("Unknown event type (%d) in processEvents()\n", locEvent->type);
2322
+
exit(EXIT_CODE_UNKNOWN_EVENT);
2323
+
}
2278
2324
2279
-
// !!! main runner function !!!
2325
+
locEvent=locEvent->nextEvent;
2326
+
}
2327
+
}
2328
+
#endif
2280
2329
2281
2330
2331
+
// !!! main runner function !!!
2282
2332
2283
2333
// calculate all fluxes and update state for this time step
2284
2334
// we calculate all fluxes before updating state in case flux calculations depend on the old state
2285
2335
voidupdateState() {
2286
-
doublenpp; // net primary productivity, g C * m^-2 ground area * day^-1
2287
-
doubleoldSoilWater; // how much soil water was there before we updated it? Used in trackers
2288
-
interr;
2289
-
oldSoilWater=envi.soilWater;
2290
-
2291
-
calculateFluxes();
2292
-
2293
-
// update the stocks, with fluxes adjusted for length of time step:
0 commit comments