Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this example the first 10 lines define a Python function that generates a Fortran code snippet to define the dimensions of a variable. The function is used on line 13. Line 13 is in fact the only Fortran code line in this template. Line 12 and 14 form a for-loop that loops over all variables defined in the "variables" dictionary provided by the Python script and holds all variables defined in src/xbeachlibrary/variables.F90. This include file will therefore contain a single line of Fortran code for each variable defined in src/xbeachlibrary/variables.F90. Each line uses the "fortrantype", "rank" and variables "name" from the "variables" dictionary  as is visible in line 13. The "rank" is used to generate a Fortran code snippet to define the variables dimensions. Apart from the "variables" dictionary also a "parameters" dictionary is available that holds all parameters from params.F90. Take a look at the other templates in src/xbeachlibrary/templates/ for more examples.

...

original C-interfaceBMI interface
init()initialize()
outputext() 
executestep()update(dt)
final()finalize()
 get_var(var)
 get_var_type(var)
 get_var_rank(var)
 get_var_shape(var)
 set_var(var, val)
 get_start_time()
 get_current_time()
 get_end_time()

The BMI interface does not support getting derived variables (min, max, avg, var) nor does it support setting of input parameters. It does support some externally controlled time stepping. Externally set time steps are maximized according to the CFL condition. Negative time steps make the model to skip the absolute value of the time step in time, without executing any model. The external program should provide the updated model state as well.