Learn R Programming

rodeo (version 0.7.6)

forcingFunctions: Generation of Forcing Functions in Fortran

Description

Generates Fortran code to return the current values of forcing functions based on interpolation in tabulated time series data.

Usage

forcingFunctions(x)

Arguments

x

Data frame with colums 'name', 'file', 'column', 'mode', 'default'. See below for expected entries.

Value

A character string holding generated Fortran code. Must be written to disk, e.g. using write, prior to compilation.

Examples

Run this code
# NOT RUN {
  ! Example of a Fortran file to define functions
  include 'forcings.f95'   ! include generated forcings file in compilation
  module functions
  use forcings             ! make forcings available as functions
  implicit none
  contains
  ! ... any non-forcing functions go here ...
  end module
# }
# NOT RUN {
# }
# NOT RUN {
  ! Definition of 'rexit' and 'rwarn' for testing of the generated code
  ! outside of R
  subroutine rexit (x)
    character(len=*), intent(in):: x
    write(*,*) "ERROR: ",trim(adjustl(x))
    stop 1
  end subroutine
  
  subroutine rwarn (x)
    character(len=*), intent(in):: x
    write(*,*) "WARNING: ",trim(adjustl(x))
  end subroutine
# }

Run the code above in your browser using DataLab