atlantisfmsy_restart: Restart Fmsy simulation.

View source: R/atlantisfmsy_simurestart.R

atlantisfmsy_restartR Documentation

Restart Fmsy simulation.

Description

In case of an interruption of atlantisfmsy_simu, this function will restart the Fmsy estimation protocol where it was stopped. It will first look if all the condition to run the simulations are met, then look for the last value of F simulated, and then restart the function atlantisfmsy_simu.

Usage

atlantisfmsy_restart(
  func_grp,
  folder_path,
  model_path,
  exe_name,
  fmax,
  last_run = NULL,
  batch_file = NULL
)

Arguments

func_grp

The code of the Atlantis functional group for which Fmsy will be estimated.

folder_path

The working directory: where the Fmsy simulations will be run and stored.

model_path

The directory of the calibrated model (containing all the parameters files and one bach file. Forcing files can be stored in a direct parent directory of model_path). WARNING: Only working if the forcing folder is in the main model directory model_path or if it is in the direct parent directory. If not please either modify this package or modify the path structure of your Atlantis input forcing parameters file.

exe_name

The name of the atlantis executable you used (ex: atlantismain, atlantisNew).

fmax

The maximal value of F the simulation is going to test in y-1. WARNING: only work if fmax < 10 y-1 (see atlantis_bachchange).

last_run

The name of the output file of the last simulation run before atlantisfmsy_simu stopped. The name of the output have to be the same as the one in the batch/shell file used to run Atlantis. Default: NULL.

batch_file

The name of the batch/shell file with extension you are using to run your model. If not provided, the function will search for the unique batch file in your folder_path. Default: NULL.

Value

fmsy The dataframe containing all the values of F (sum of mFC parameter value in y-1) tested and the average yearly catch of the 5 last years of simulation. As well, a message with the Fmsy value for the Atlantis functional group considered is printed and all the simulation necessary to estimate the Fmsy are stored in the folder_path.

Warning

This doesn't work if the files have been transfered to another computer because the date of file creation change and this date is used to determine the last simulated F value (see atlantis_lastsimu). If it is the case, you have to specify a value in the parameter last_run.

See Also

atlantis_fgrpon checking if the functional group is active, atlantis_paraselect for parameters file selection, atlantis_openfile to open a parameters file and select a parameter, atlantis_lastsimu to find the last F value tested, atlantisfmsy_completion to check if Fmsy has been reached, atlantisfmsy_simu to run the simulation to find the Fmsy, str_split_fixed to split a chain of characters, ex_number to extract number from a chain of characters, nc_open to open netCDF4 files, ncvar_get to extract variables from netCDF4 files, nc_close to close netCDF4 files, write.table to write table on the drive, and read.table to open table stored in text files (.txt, .csv ...).

Examples

atlantisfmsy_restart("COD", "C:/Atlantis/AtlantisEEC",
                     "C:/Atlantis/AtlantisEEC/AtlantisEECF_v3",
                     "atlantismain", 4)
atlantisfmsy_restart("COD", "/home/Atlantis/AtlantisEEC",
                     "/home/Atlantis/AtlantisEEC/AtlantisEECF_v3",
                     "atlantisNew", 4)
atlantisfmsy_restart("COD", "C:/Atlantis/AtlantisEEC",
                     "C:/Atlantis/AtlantisEEC/AtlantisEECF_v3",
                     "atlantismain", 4, "MSY_COD_F012.nc", "runAtlantis.bat")
atlantisfmsy_restart("COD", "/home/Atlantis/AtlantisEEC",
                     "/home/Atlantis/AtlantisEEC/AtlantisEECF_v3",
                     "atlantisNew", 4, "MSY_COD_F012.nc", "runAtlantis.sh")

## Not run: atlantisfmsy_restart("COD", "C:/Atlantis/AtlantisEEC",
                              "C:/Atlantis/AtlantisEEC/AtlantisEECF_v3",
                              "atlantismain", 10)
## End(Not run)
## Not run: atlantisfmsy_restart("COD", "/home/Atlantis/AtlantisEEC",
                              "/home/Atlantis/AtlantisEEC/AtlantisEECF_v3",
                              "atlantisNew", 10)
## End(Not run)

rgirardi/atlantisfmsy documentation built on Aug. 30, 2022, 9:11 a.m.