Skip to content

Simulation Setup

Tolosa-lct shares the same input system as Tolosa-sw. This page documents the additions and differences specific to Tolosa-lct (Leucothea).

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 submodule 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 non-hydrostatic Gmsh simulation:

mesh_name = mymesh.msh
simu_time = 12 hours
mach = 0.2
cfl = 0.5
w_vtk = 1000000
dt_vtk = 10 minutes

The key addition over Tolosa-sw is the mach parameter, which sets the acoustic speed for the NH splitting. A Cartesian mesh example:

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

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_lct 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)
w0_user(x, y)return initial vertical velocity at (x, y)
p0_user(x, y)return initial NH pressure at (x, y)
bc_user(tag, x, y, b)return boundary value for a given named tag

The minimal skeleton (all functions returning 0 except bathymetry):

SUBMODULE (m_Tolosa_lct) m_user_data
implicit none
CONTAINS
MODULE SUBROUTINE user_parameters( dof , input , mesh )
type(unk), intent(inout) :: dof
type(cli), intent(inout) :: input
type(msh), intent(inout) :: mesh
END SUBROUTINE user_parameters
MODULE real(rp) FUNCTION bathy_user( x , y )
real(rp), intent(in) :: x , y
bathy_user = -10._rp ! flat bottom at -10 m
END FUNCTION bathy_user
MODULE real(rp) FUNCTION h0_user( x , y , b )
real(rp), intent(in) :: x , y , b
h0_user = max( -b , 0._rp )
END FUNCTION h0_user
MODULE real(rp) FUNCTION u0_user( x , y )
real(rp), intent(in) :: x , y
u0_user = 0._rp
END FUNCTION u0_user
MODULE real(rp) FUNCTION v0_user( x , y )
real(rp), intent(in) :: x , y
v0_user = 0._rp
END FUNCTION v0_user
MODULE real(rp) FUNCTION w0_user( x , y )
real(rp), intent(in) :: x , y
w0_user = 0._rp
END FUNCTION w0_user
MODULE real(rp) FUNCTION p0_user( x , y )
real(rp), intent(in) :: x , y
p0_user = 0._rp
END FUNCTION p0_user
MODULE real(rp) FUNCTION bc_user( tag , x , y , b )
character(len=*), intent(in) :: tag
real(rp) , intent(in), optional :: x , y , b
bc_user = 0._rp
END FUNCTION bc_user
END SUBMODULE m_user_data

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_lct -data-path /path/to/data

Absolute paths are passed through unchanged.