Simulation Setup
Tolosa-lct shares the same input system as Tolosa-sw. This page documents the additions and differences specific to Tolosa-lct (Leucothea).
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 submodule 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 non-hydrostatic Gmsh simulation:
mesh_name = mymesh.mshsimu_time = 12 hoursmach = 0.2cfl = 0.5w_vtk = 1000000dt_vtk = 10 minutesThe key addition over Tolosa-sw is the mach parameter, which sets the acoustic speed
nx = 200ny = 100lx = 100000.ly = 50000.bc_N = wallbc_S = wallbc_W = neumannbc_E = wallsimu_time = 6 hoursmach = 0.2See 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_lct 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) |
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_datauser_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_lct -data-path /path/to/dataAbsolute paths are passed through unchanged.