extract_new_initial_cond_from_end_of_run {StrathE2E2} | R Documentation |
The function saves the state of the model at the end of a run for use as initial conditions in future runs. This enables, for example, the model to be run for a long time to attain a stationary state, and then restarted in that state.
extract_new_initial_cond_from_end_of_run(model, results)
model |
R-list object defining the model configuration compiled by the read_model() function |
results |
R-list object generated by the StrathE2E() function |
Initial conditions for a model run are held in the /Parameters folder of the Model/Variant path specified in the read_model() function call used to define a run. By default, the function attampts to write the model end-state file back to this /Parameters folder. However, the package folders are read-only so if read_model() has been specified to load an internally provided Model/Variant then the output will revert to the currently specified results folder instead. To fix this, copy the required package model to a user workspace using the copy_model() function and re-run.
The new initial conditions file will have a name model_endstate_export-*.csv, where * is the model.ident text identifier specified in read_model() To source the new initial conditions in a subsequent model run, edit the MODEL_SETUP.csv file in the required /Models/Variant folder
csv file containing new initial conditions
# Copy the 2003-2013 version of the North Sea model supplied with the package to a user workspace (Windows OS): copy_model("North_Sea", "2003-2013", dest.path="C:/Users/username/Documents/Models") model <- read_model("North_Sea", "2003-2013", user.path="C:/Users/username/Documents/Models", model.ident="TEST") results<-StrathE2E(model, nyears=5) extract_new_initial_cond_from_end_of_run(model,results)