gen_fabm_code: Function to generate FABM source code

View source: R/generate_FABM.R

gen_fabm_codeR Documentation

Function to generate FABM source code

Description

This function creates fortran90 FABM code from data.frames. Additionally a fabm.yaml control file for FABM is generated

Usage

gen_fabm_code(
  vars,
  pars,
  funs,
  pros,
  stoi,
  file_name = "model.f90",
  diags = TRUE
)

Arguments

vars

data.frame containing the state variables

pars

data.frame containing the parameters

funs

data.frame containing the functions

pros

data.frame containing the processes

stoi

data.frame containing the stoichiometry

file_name

Name of the text file in wich the source code is written

diags

Boolean: should the process rates be stored in diagnostic variables? Defaults to TRUE

Author(s)

Johannes Feldbauer

Examples

## Not run: 
library(readODS)
library(rodeoFABM)

# copy example ods file
example_model <- system.file("extdata/simple_model.ods", package= 'rodeoFABM')
dir.create('example') # Create example folder
file.copy(from = example_model, to = 'example',recursive = TRUE)
setwd('example') # Change working directory to example folder

# read in example ods file
odf_file <- "simple_model.ods"
vars <- read_ods(odf_file,1)
pars <- read_ods(odf_file,2)
funs <- read_ods(odf_file,3)
pros <- read_ods(odf_file,4)
stoi <- read_ods(odf_file,5)

# generate fabm code
gen_fabm_code(vars,pars,funs,pros,stoi,"simple_model.f90",diags = TRUE)

## End(Not run)

JFeldbauer/rodeoFABM documentation built on Jan. 27, 2024, 11:41 a.m.