Skip to content

Simulation Setup

All simulations run from the bin/ directory. You need to place there:

  • input.txt — main configuration file
  • The mesh file (.msh from Gmsh, or generated from Cartesian parameters)
  • m_user_data.f90 — Fortran file defining bathymetry and initial conditions (recompiled at each run)
  • Any required external forcing or boundary files (see External Input Files)

All parameters have sensible defaults. A minimal input.txt for a Gmsh mesh:

mesh_name = mymesh.msh
simu_time = 12 hours
cfl = 0.5
w_tecplot = 10000
dt_tecplot = 10 minutes

A Cartesian mesh (no Gmsh file):

nx = 200
ny = 100
lx = 100000.
ly = 50000.
bc_N = wall
bc_S = wall
bc_W = neumann
bc_E = wall
simu_time = 6 hours

See the complete parameter reference for all available parameters, and Boundary Conditions for the full BC type catalogue.

m_user_data.f90 defines the problem geometry and initial conditions. It is a Fortran submodule of m_Tolosa_sw and is recompiled at every run (make mrun). It must implement:

ProcedureRole
user_parameters(dof, input, mesh)called once before all initializations; read custom parameters, precompute data, open files
bathy_user(x, y)return bathymetry (positive upward) at point (x, y)
h0_user(x, y, b)return initial water depth at (x, y) given bathymetry b
u0_user(x, y)return initial x-velocity at (x, y)
v0_user(x, y)return initial y-velocity at (x, y)
bc_user(tag)return boundary value for a given named tag

Called after the mesh is loaded and input.txt parsed, but before bathymetry, BCs, initial state, friction, forcings, and numerical schemes are initialized. Use it to:

  • Declare custom input.txt parameters via input%add_get:
    call input%add_get( 'h_0' , default='1.d3' , kind=rtype , value=h_0 )
    call input%add_get( 'n_bathy' , default='1000' , kind=itype , value=n_bathy )
  • Precompute geometry using globals: lx, ly, mesh%nc, proc/np, g, pi, pathto()
  • Read/write auxiliary binary files:
    open( unit=new_unit(unit), file=pathto('bathy.bin'), form='unformatted', ... )
  • Generate randomised fields using genrand(min, max) (from Tolosa-lib)

All file names in input.txt are resolved through pathto(), which prepends data_path (default "./") to any relative path.

Override at runtime:

Terminal window
./Tolosa_sw -data-path /path/to/data

Absolute paths are passed through unchanged.