Simulation Setup
Directory Layout
Section titled “Directory Layout”All simulations run from the bin/ directory. You need to place there:
input.txt— main configuration file- The mesh file (
.mshfrom 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)
Setting Up input.txt
Section titled “Setting Up input.txt”All parameters have sensible defaults. A minimal input.txt for a Gmsh mesh:
mesh_name = mymesh.mshsimu_time = 12 hourscfl = 0.5w_tecplot = 10000dt_tecplot = 10 minutesA Cartesian mesh (no Gmsh file):
nx = 200ny = 100lx = 100000.ly = 50000.bc_N = wallbc_S = wallbc_W = neumannbc_E = wallsimu_time = 6 hoursSee the complete parameter reference for all available parameters, and Boundary Conditions for the full BC type catalogue.
Setting Up m_user_data.f90
Section titled “Setting Up m_user_data.f90”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:
| Procedure | Role |
|---|---|
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 |
user_parameters — the Setup Hook
Section titled “user_parameters — the Setup Hook”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.txtparameters viainput%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)
Data Path
Section titled “Data Path”All file names in input.txt are resolved through pathto(), which prepends data_path (default "./") to any relative path.
Override at runtime:
./Tolosa_sw -data-path /path/to/dataAbsolute paths are passed through unchanged.