Versions Compared

Key

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

...

Code Block
languagetext
titlespacedecl.inc
    double precision, dimension(:,:),  pointer :: x
    double precision, dimension(:,:),  pointer :: y
    double precision, dimension(:,:),  pointer :: xz
    double precision, dimension(:,:),  pointer :: yz
    double precision, dimension(:,:),  pointer :: xu
    double precision, dimension(:,:),  pointer :: yu
    double precision, dimension(:,:),  pointer :: xv
    double precision, dimension(:,:),  pointer :: yv

Output variables (variables.F90 vs. spaceparams.tmpl)

The spaceparams.tmpl file is replaced by the src/xbeachlibrary/variables.F90 file. The main reason is that the Python script that parses the variables.F90 and params.F90 file only needs to parse Fortran code and not also a custom template format as used in the original spaceparams.tmpl file. Each variable is defined on a separate line and all variables are defined as "target". A comment at the end of the line contains meta-data related to the variable and adheres to a specific format. An example variable definition is as follows:

Code Block
languagepy
 double precision, allocatable, target :: x(:,:)           !< [m] x-coord. original cmp. grid {"shape": ["s%nx+1", "s%ny+1"], "standard_name": "projection_x_coordinate", "broadcast": "d"}

The definition starts with a Fortran variable type. The following types are supported: character, logical, double precision, integer and real. Then, separated by commas, the variable may be declared "allocatable" and must be declared "target". Two colons ("::"), the name and number of dimensions follow. The line ends with a comment, indicated by the "!". A comment starts with the variables units between brackets ("[" and "]") followed by a description of the variable. The comment ends with a JSON object that defines the fields "shape", "standard_name" and "broadcast" representing the shape of the variable in terms of XBeach dimensions s%nx+1, s%ny+1, s%nd, s%ngd, etc, the netCDF standard name according to the CF convention and a MPI broadcast type ("b" for "broadcast" and "d" for "distribute").

More changes

A few other things changed in the XBeach code structure along with the new templating system as explained in the following subsections.

...