Library (index)
WaterWaves1D.AbstractModelWaterWaves1D.AiryWaterWaves1D.AkersNichollsWaterWaves1D.AkersNicholls_fastWaterWaves1D.BBMWaterWaves1D.BoussinesqWaterWaves1D.ChoiWaterWaves1D.CnoidalSGNWaterWaves1D.DataWaterWaves1D.EulerWaterWaves1D.EulerExpWaterWaves1D.EulerExp_naiveWaterWaves1D.EulerSympWaterWaves1D.Euler_naiveWaterWaves1D.InitWaterWaves1D.Init2DWaterWaves1D.InitialDataWaterWaves1D.IsobeKakinumaWaterWaves1D.KdVWaterWaves1D.MatsunoWaterWaves1D.Matsuno_fastWaterWaves1D.MeshWaterWaves1D.NonHydrostaticWaterWaves1D.ProblemWaterWaves1D.RK4WaterWaves1D.RK4_naiveWaterWaves1D.RandomWaterWaves1D.SaintVenantWaterWaves1D.SaintVenant2DWaterWaves1D.SaintVenant2D_fastWaterWaves1D.SaintVenant_fastWaterWaves1D.SerreGreenNaghdiWaterWaves1D.SolitarySGNWaterWaves1D.SolitaryWBWaterWaves1D.SolitaryWGNWaterWaves1D.SolitaryWhithamWaterWaves1D.SquareRootDepthWaterWaves1D.StoermerVerletWaterWaves1D.TimesWaterWaves1D.WWnWaterWaves1D.WaterWavesWaterWaves1D.WhithamWaterWaves1D.WhithamBoussinesqWaterWaves1D.WhithamGreenNaghdiWaterWaves1D.modifiedMatsunoWaterWaves1D.relaxedGreenNaghdiBase.dumpBase.dumpBase.dumpWaterWaves1D.CnoidalWaveSerreGreenNaghdiWaterWaves1D.SolitaryWaveSerreGreenNaghdiWaterWaves1D.SolitaryWaveWhithamWaterWaves1D.SolitaryWaveWhithamBoussinesqWaterWaves1D.SolitaryWaveWhithamGreenNaghdiWaterWaves1D.default_exampleWaterWaves1D.energyWaterWaves1D.energy_diffWaterWaves1D.examples_dirWaterWaves1D.get_examplesWaterWaves1D.interpolateWaterWaves1D.interpolateWaterWaves1D.load_dataWaterWaves1D.load_data!WaterWaves1D.load_initWaterWaves1D.massWaterWaves1D.mass_diffWaterWaves1D.momentumWaterWaves1D.momentum_diffWaterWaves1D.randomWaterWaves1D.solutionWaterWaves1D.solve!WaterWaves1D.solve!
Initial data
WaterWaves1D.CnoidalSGN — Type
CnoidalSGN(param; P=1)Build the initial data associated with CnoidalWaveSerreGreenNaghdi(param; P=1), of type InitialData, to be used in initial-value problems Problem(model, initial::InitialData, param).
WaterWaves1D.CnoidalWaveSerreGreenNaghdi — Method
CnoidalWaveSerreGreenNaghdi(param; P=1)Compute the Serre-Green-Naghdi cnoidal wave with prescribed h₀<h₁<h₂. h₁ is the minimum, h₂ is the maximum of the wave. As h₀ -> h₁, the cnoidal wave converges towards the solitary wave. See for instance Gavrilyuk et al. (2020).
Arguments
param :: NamedTuple: parameters of the problem containingh₀<h₁<h₂and dimensionless parametersϵandμ, and number of collocation pointsN.P :: Int: (keyword, optional, default = 1) the number of periods of the cnoidal wave in the constructed mesh.
Return values
(η,u,v,mesh,param) with
η :: Vector{Float64}: surface deformation;u :: Vector{Float64}: layer-averaged velocity;v :: Vector{Float64}: derivative of the trace of the velocity potential at the surface;mesh :: Mesh: mesh collocation points;param :: NamedTuple: useful parameters
WaterWaves1D.SolitarySGN — Type
SolitarySGN(param; x₀=0)Build the initial data associated with SolitaryWaveSerreGreenNaghdi(param; x₀=0), of type InitialData, to be used in initial-value problems Problem(model, initial::InitialData, param).
SolitarySGN(c; ϵ=1,μ=1,x₀=0,N=2^12)Build the initial data with velocity c, center x₀, dimensionless parameters ϵ and μ, and number of collocation points N.
WaterWaves1D.SolitaryWaveSerreGreenNaghdi — Method
SolitaryWaveSerreGreenNaghdi(param; x₀=0)Compute the Serre-Green-Naghdi solitary wave with prescribed velocity.
Arguments
param :: NamedTuple: parameters of the problem containing velocitycand dimensionless parametersϵandμ, and mesh sizeLand number of collocation pointsN;x₀ :: Real: (keyword, optional, default = 0) center of solitary wave.
Return values
(η,u,v,mesh) with
η :: Vector{Float64}: surface deformation;u :: Vector{Float64}: layer-averaged velocity;v :: Vector{Float64}: derivative of the trace of the velocity potential at the surface;mesh :: Mesh: mesh collocation points.
WaterWaves1D.SolitaryWGN — Type
SolitaryWGN(param; kwargs)Build the initial data associated with SolitaryWaveWhithamGreenNaghdi(param; kwargs), of type InitialData, to be used in initial-value problems Problem(model, initial::InitialData, param).
SolitaryWGN(c; ϵ=1,μ=1,N=2^12,kwargs)Build the initial data with velocity c, dimensionless parameters ϵ and μ, and number of collocation points N, and kwargs the other (optional) keyword arguments as above.
WaterWaves1D.SolitaryWaveWhithamGreenNaghdi — Method
SolitaryWaveWhithamGreenNaghdi(param; kwargs)Compute the Whitham-Green-Naghdi solitary wave with prescribed velocity.
Arguments
param :: NamedTuple: parameters of the problem containing velocitycand dimensionless parametersϵandμ, and mesh sizeLand number of collocation pointsN;
Keywords (optional)
guess :: Vector{Real}: initial guess for the surface deformation (if not provided, the exact formula for SGN is used);x₀ :: Real: center of solitary wave (if guess is not provided);SGN :: Bool: iftruecomputes the Serre-Green-Naghdi (instead of Whitham-Green-Naghdi) solitary wave (considerSolitaryWaveSerreGreenNaghdiinstead);method :: Int: equation used (between1and4);iterative :: Bool: inverts Jacobian through GMRES iftrue, LU decomposition iffalse(default isfalse);verbose :: Bool: prints numerical errors at each step iftrue(default isfalse);max_iter :: Int: maximum number of iterations of the Newton algorithm (default is20);tol :: Real: relative tolerance measured in ℓ∞ norm (default is1e-10);ktol :: Real: tolerance of the Krasny filter (default is0, i.e. no filtering);gtol :: Real: relative tolerance of the GMRES algorithm (default is1e-10);dealias :: Int: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);q :: Real: Newton algorithm modified withu_{n+1}=q*u_{n+1}+(1-q)*u_n(default is1);α :: Real: addsαtimes spectral projection onto the Kernel to the Jacobian (default is0).
Return values
(η,u,v,mesh) with
η :: Vector{Float64}: surface deformation;u :: Vector{Float64}: layer-averaged velocity;v :: Vector{Float64}: derivative of the velocity potential at the surface;mesh :: Mesh: mesh collocation points.
WaterWaves1D.SolitaryWB — Type
SolitaryWB(param; kwargs)Build the initial data associated with SolitaryWaveWhithamBoussinesq(param; kwargs), of type InitialData, to be used in initial-value problems Problem(model, initial::InitialData, param).
SolitaryWB(c; ϵ=1,μ=1,N=2^12,kwargs)Build the initial data with velocity c, dimensionless parameters ϵ and μ, and number of collocation points N, and kwargs the other (optional) keyword arguments as above.
WaterWaves1D.SolitaryWaveWhithamBoussinesq — Method
SolitaryWaveWhithamBoussinesq(param; kwargs)Compute the Whitham-Boussinesq solitary wave with prescribed velocity.
Argument
param :: NamedTuple: parameters of the problem containing velocitycand dimensionless parametersϵandμ,
and mesh size L and number of collocation points N;
Keywords (optional)
guess :: Vector{Real}: initial guess for the surface deformation (if not provided, the exact formula for SGN is used);x₀ :: Real: center of solitary wave (if guess is not provided);α :: Real: determines the model used (typically1or1/2, default is 1);Boussinesq: iftrue(default isfalse), compute the standard Boussinesq system with parametersa(defaut-1//3),b=d(defaut1//3), andc=0);iterative :: Bool: inverts Jacobian through GMRES iftrue, LU decomposition iffalse;verbose :: Bool: prints numerical errors at each step iftrue;max_iter :: Int: maximum number of iterations of the Newton algorithm;tol :: Real: general tolerance (default is1e-10);ktol :: Real: tolerance of the Krasny filter (default is0, i.e. no filtering);gtol :: Real: relative tolerance of the GMRES algorithm (default is1e-10);dealias :: Int: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);q :: Real: Newton algorithm modified with
u_{n+1}=q*(u_n+du)+(1-q)*u_n (default is 1);
β :: Real: addsβtimes spectral projection onto the Kernel to the Jacobian.β
Return values
(η,v,mesh) with
η :: Vector{Float64}: surface deformation;v :: Vector{Float64}: velocity (derivative of the trace of the velocity potential at the surface);mesh :: Mesh: mesh collocation points.
WaterWaves1D.SolitaryWhitham — Type
SolitaryWhitham(param; kwargs)Build the initial data associated with SolitaryWaveWhitham(param; kwargs), of type InitialData, to be used in initial-value problems Problem(model, initial::InitialData, param).
SolitaryWhitham(c; ϵ=1,μ=1,N=2^12,kwargs)Build the initial data with velocity c, dimensionless parameters ϵ and μ, and number of collocation points N, and kwargs the other (optional) keyword arguments as above.
WaterWaves1D.SolitaryWaveWhitham — Method
SolitaryWaveWhitham(param; kwargs)Compute the Whitham solitary wave with prescribed velocity.
Argument
param :: NamedTuple: parameters of the problem containing velocitycand dimensionless parametersϵandμ, and mesh sizeLand number of collocation pointsN;
Keywords (optional)
guess :: Vector{Real}: initial guess for the surface deformation (if not provided, the exact formula for KdV is used);x₀ :: Real: center of solitary wave (if guess is not provided);iterative :: Bool: inverts Jacobian through GMRES iftrue, LU decomposition iffalse;verbose :: Bool: prints numerical errors at each step iftrue;max_iter :: Int: maximum number of iterations of the Newton algorithm;tol :: Real: general tolerance (default is1e-10);ktol :: Real: tolerance of the Krasny filter (default is0, i.e. no filtering);gtol :: Real: relative tolerance of the GMRES algorithm (default is1e-10);dealias :: Int: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);q :: Real: Newton algorithm modified with
u_{n+1}=q*u_{n+1}+(1-q)*u_n (default is 1);
α :: Real: addsαtimes spectral projection onto the Kernel to the Jacobian;KdV :: Bool: iftruecomputes the KdV (instead of Whitham) solitary wave.
Return values
(u,mesh) with
u :: Vector{Float64}: the solution;mesh :: Mesh: mesh collocation points.
WaterWaves1D.Random — Type
Random(param;args)Randomly generated initial data, based on provided (optional arguments) :
Lis the typical wavelength (default isL=1),sis the (real) Sobolev index regularity (default iss=∞),λis the length of spatial localization (default isλ=∞, no localization),ais the couple of amplitudes of the surface deformation, and velocity (default isa=(1,1)).
Return an initial data init::InitialData, to be used in initial-value problems Problem(model, init, param), with init.η and init.v two samples of random(x;L,s,λ), where x is the set of collocation points generated by Mesh(param).
WaterWaves1D.random — Method
random(x;args)Randomly generate a vector of values at collocation points x, based on provided (optional arguments) :
Lis the typical wavelength (default isL=1),sis the (real) Sobolev index regularity (default iss=∞, smooth data),λis the length of spatial localization (default isλ=∞, no localization),ais the amplitude of the returned vector (default isa=1).
The vector is generated through randomly chosen Fourier coefficients, multiplied with weigth w=10^(-|k|L/(2π)) if s=∞, or w=1/(1+9(|k|L/(2π))^(s+1/2)) otherwise. If λ≠∞, the function in spatial variables is multiplied by exp(-|x/λ|^2), and in any case normalized to have maximum absolute value 1.
Models
WaterWaves1D.AbstractModel — Type
Abstract type whose subtypes are the models from which initial-value problems can be built, through Problem( model :: AbstractModel, initial :: InitialData, param :: NamedTuple )
WaterWaves1D.Airy — Type
Airy(param; mesh, label)Define an object of type AbstractModel in view of solving the initial-value problem for the linear (Airy) water waves equations:
\[ \left\{\begin{array}{l} ∂_tη-\tfrac{1}{\sqrtμ ν} T^μv =0,\\[1ex] ∂_tv+∂_xη=0, \end{array}\right.\]
where $η$ is the surface deformation, $v=∂_xψ$ is the derivative of the trace of the velocity potential at the surface, and
\[T^μ=-{\rm i}\tanh(\sqrtμ D)\]
is the Fourier multiplier sometimes called "Tilbert transform" (related to the Hilbert transform, the latter arising in the infinite layer configuration, $μ=∞$).
Arguments
param::NamedTuplemust contain- the shallowness parameter
μ(set the infinite-layer case ifμ=Inf); - optionally,
νthe shallow/deep water scaling factor. By default,ν=1ifμ≦1andν=1/√μotherwise; - numerical parameters to construct the mesh of collocation points, if
meshis not provided.
- the shallowness parameter
mesh :: Mesh: the mesh of collocation points. By default,mesh = Mesh(param).label :: String: a label for future references (default is"linear (Airy)").
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
Airy.f!to be called in explicit time-integration solvers; - a function
Airy.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
Airy.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.AkersNicholls — Type
AkersNicholls(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the quadratic deep-water model proposed by Akers and Nicholls (2010) and Cheng et al. (2019)
\[ \left\{\begin{array}{l} ∂_tη+∂_x m=0,\\[1ex] ∂_tm-\tfrac{1}{\sqrtμ ν} T^μ\big(η+\frac{ϵ}{ν}(L^μ m)^2\big)+\frac{ϵ}{ν}\big(η∂_xη+T^μ(η ∂_x T^μ η)\big)=0, \end{array}\right.\]
where $η$ is the surface deformation, $m=-\frac1{\sqrtμ ν} T^μψ + \frac{ϵ}{ν} \big(η ∂_xψ + T^μ(η T^μ ∂_xψ)\big)$ represents the vertically integrated horizontal momentum, and $T^μ=-{\rm i}\tanh(\sqrtμ D)$ and $L^μ=\frac{ν\sqrtμ D}{\tanh(\sqrtμ D)}$ are Fourier multipliers.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - optionally,
νthe shallow/deep water scaling factor. By default,ν=1ifμ≦1andν=1/√μotherwise. Set the infinite-layer case ifν=0, orμ=Inf. - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);IL: Set the infinite-layer case ifIL=true(orμ=Inf, orν=0), in which caseϵis the steepness parameter. Default isfalse.dealias: dealiasing with1/3Orszag rule iftrueor no dealiasing iffalse(by default);label: a label for future references (default is"deep quadratic");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
AkersNicholls.f!to be called in explicit time-integration solvers; - a function
AkersNicholls.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
AkersNicholls.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
Consider also AkersNicholls_fast.
WaterWaves1D.AkersNicholls_fast — Type
AkersNicholls_fast(param; kwargs...)Same as AkersNicholls, but faster.
WaterWaves1D.BBM — Type
BBM(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for two uncoupled Benjamin et al. (1972) equations:
\[∂_t u_\pm -\frac{\mu}{6} ∂_x^2 ∂_t u_\pm \mp ∂_x u_\pm \mp \frac{3ϵ}{4} ∂_x (u_\pm^2) = 0 ,\]
where $u_\pm$ are right- and left-going waves, combined to produce the physical solutions.
See Lannes (2013) and Emerald (2021) for formulas and a full justification.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
improved_initial_data: iftrue(default), improves the naive (first-order) decomposition into right-going and left-going wave;mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"BBM").
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
BBM.f!to be called in explicit time-integration solvers;
Additionnally, a vector Whitham.D and a function Whitham.f! for exponential solvers;
- a function
BBM.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed. - a function
BBM.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.Boussinesq — Type
Boussinesq(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for abcd-Boussinesq models proposed in Bona et al. (2002):
\[ \left\{\begin{array}{l} ∂_tη+∂_x((1+ϵη)u)+a∂_x^3u-b∂_x^2∂_tη=0,\\[1ex] ∂_tu+∂_xη+ϵu∂_xu+c∂_x^3η-d∂_x^2∂_tu=0, \end{array}\right.\]
where $a,b,c,d$ can be freely chosen as long as they satisfy $a+b+c+d=1/3$.
The function is restricted to the so-called Hamiltonian case: $d=b$, and $c=0$. Indeed, in that case, one may genuinely interpret $v=u-d∂_x^2u$ as an approximation to $∂_xψ$, the derivative of the trace of the velocity potential at the surface, and write the system as evolution equations for the variables $(η,v)$:
\[ \left\{\begin{array}{l} ∂_tη+∂_x((1+a∂_x^2)(1-b∂_x^2)^{-2}v + ϵ(1-b∂_x^2)^{-1} (η (1-b∂_x^2)^{-1}v))=0,\\[1ex] ∂_tv+∂_xη+\tfrac{ϵ}{2}∂_x(((1-b∂_x^2)^{-1}v)^2) =0. \end{array}\right.\]
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
- two parameters
a(default is-1/3) andb(default is+1/3) which determine the model solved. You needa+2*b=1/3for validity as a long wave model (without surface tension). mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Boussinesq");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
Boussinesq.f!to be called in explicit time-integration solvers; - a function
Boussinesq.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
Boussinesq.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.Choi — Type
Choi(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for (an asymptotically equivalent variant of) the model proposed by Choi:
\[ \left\{\begin{array}{l} ∂_tη+∂_x\left(\sum_{m=0}^M h^{2m+1}\frac{(-μ∂_x^2)^mv }{(2m+1)!}\right) =0,\\[1ex] \big( 1-\sum_{m=1}^M μ∂_x( h^{2m}∂_x\frac{(-μ∂_x^2)^{m-1}}{(2m)!})\big)∂_tv +∂_xη \\[1ex] \qquad +∂_x\left(\frac12\sum_{m=0}^M h^{2m}\left(\sum_{j=0}^m \frac{(-μ∂_x^2)^j v}{(2j)!} \frac{(-μ∂_x^2)^{m-j} v}{(2m-2j)!}-μ\sum_{j=0}^{m-1} \frac{∂_x(-μ∂_x^2)^j v}{(2j+1)!} \frac{∂_x(-μ∂_x^2)^{m-j-1} v}{(2m-2j-1)!} \right)\right), \end{array}\right.\]
where $M$ is the rank of the system, $h=1 + ϵ η$ , $η$ the surface deformation and $v=∂_xϕᵦ$ is the derivative of the trace of the velocity potential at the bottom.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
M∈{0,1,2}: the rank of the system.M=2by default;reg: applies a regularization operator.reg=falseby default.mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Choi-N");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
Choi.f!to be called in explicit time-integration solvers; - a function
Choi.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
Choi.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential;
- additionally, a handy function
Choi.mapfrofullwhich from data matrix returns the Tuple of real vectors(η,v,u,vᵦ), where
vis the derivative of the trace of the velocity potential;ucorresponds to the layer-averaged horizontal velocity;vᵦcorresponds to the horizontal velocity at the bottom.
WaterWaves1D.IsobeKakinuma — Type
IsobeKakinuma(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the Isobe-Kakinuma model proposed by Isobe (1994) and studied in Kakinuma (2001):
\[ \left\{\begin{array}{l} ∂_tη+∂_x\left( \sum_{j=0}^N\tfrac{h^{p_j+1}}{p_j+1}∂_xϕ_j \right)=0,\\[1ex] ∂_tv+∂_x\left( η +ϵ \left( \sum_{i=0}^Np_ih^{p_i-1}ϕ_i \right)∂_x\left( \sum_{j=0}^N\tfrac{h^{p_j+1}}{p_j+1}∂_xϕ_j \right) +\tfrac{ϵ}{2}\left( \sum_{j=0}^Nh^{p_j}∂_xϕ_j\right)^2 +\tfrac{ϵ}{2μ} \left( \sum_{j=0}^Np_jh^{p_j-1}ϕ_j\right)^2 \right) =0, \end{array}\right.\]
where $h=1 + ϵ η$ is the water depth, , $η$ the surface deformation, $v=∂_xψ$ the derivative of the trace of the velocity potential at the surface, and $(ϕ₀,ϕ₁,⋯,ϕ_N)$ are obtained by solving the elliptic problem
\[ \left\{\begin{array}{l} \sum_{j=0}^Nh^{p_j}ϕ_j =ψ,\\[1ex] -h^{p_i} ∂_x\left(\sum_{j=0}^N\tfrac{h^{p_j+1}}{p_j+1}∂_xϕ_j \right) + ∂_x\left(\sum_{j=0}^N\tfrac{h^{p_i+p_j+1}}{p_i+p_j+1}∂_xϕ_j \right) -\tfrac{1}{μ} \sum_{j=0}^N \tfrac{p_ip_j}{p_i+p_j+1}ϕ_j=0 \quad (\forall i∈\{1,⋯,N\}). \end{array}\right.\]
Above, the rank of the model is set to $N=1$ and the parameters are $(p_0,p_1)=(0,2)$.
Argument
param is of type NamedTuple (or a collection NamedTuples) of and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Isobe-Kakinuma");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
IsobeKakinuma.f!to be called in explicit time-integration solvers; - a function
IsobeKakinuma.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
IsobeKakinuma.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.KdV — Type
KdV(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for two uncoupled Korteweg and De Vries (1895) equations:
\[∂_t u_\pm \mp ∂_x u_\pm \mp \frac{\mu}{6} ∂_x^3 u_\pm \mp \frac{3ϵ}{4} ∂_x (u_\pm^2) = 0 ,\]
where $u_\pm$ are right- and left-going waves, combined to produce the physical solutions.
See Lannes (2013) and Emerald (2021) for formulas and a full justification.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
improved_initial_data: iftrue(default), improves the naive (first-order) decomposition into right-going and left-going wave;mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"KdV").
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
KdV.f!to be called in explicit time-integration solvers;
Additionnally, a vector Whitham.D and a function Whitham.f! for exponential solvers;
- a function
KdV.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed. - a function
KdV.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.Matsuno — Type
Matsuno(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the quadratic deep-water model proposed by Matsuno (1992):
\[ \left\{\begin{array}{l} ∂_tη-\tfrac{1}{\sqrtμ ν} T^μu + \tfrac{ϵ}{ν} ∂_x(η u) + \tfrac{ϵ}{ν} T^μ(η ∂_x T^μ u) =0,\\[1ex] ∂_tu+\big(1-ϵ\sqrtμ T^μ∂_xη\big)∂_xη+\frac{ϵ}{2ν}∂_x\big( u^2\big)=0, \end{array}\right.\]
where $η$ is the surface deformation, $v=∂_xψ$ is the derivative of the trace of the velocity potential at the surface, $u=∂_xψ-ϵ\sqrtμ(T^μ∂_xψ)(∂_xη)$ represents the horizontal velocity at the free surface, and
\[T^μ=-{\rm i}\tanh(\sqrtμ D)\]
is the Fourier multiplier sometimes called "Tilbert transform" (related to the Hilbert transform, the latter arising in the infinite layer configuration, $μ=∞$).
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - optionally,
νthe shallow/deep water scaling factor. By default,ν=1ifμ≦1andν=1/√μotherwise. Set the infinite-layer case ifν=0, orμ=Inf. - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
IL: Set the infinite-layer case ifIL=true(orμ=Inf, orν=0), in which caseϵis the steepness parameter. Default isfalse.mesh: the mesh of collocation points. By default,mesh = Mesh(param);dealias: dealiasing with1/3Orszag rule iftrueor no dealiasing iffalse(by default);label: a label for future references (default is"Matsuno");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
Matsuno.f!to be called in explicit time-integration solvers; - a function
Matsuno.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
Matsuno.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
See also Matsuno_fast.
WaterWaves1D.Matsuno_fast — Type
Matsuno_fast(param; kwargs...)Same as Matsuno, but faster.
WaterWaves1D.NonHydrostatic — Type
NonHydrostatic(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the "non-hydrostatic" model proposed by Bristeau, Mangeney, Sainte-Marie and Seguin:
\[ \left\{\begin{array}{l} ∂_tη+∂_x\big( h u\big)=0,\\[1ex] ∂_tv+∂_x\big(η+\tfrac{ϵ}{2}v^2+\tfrac{μϵ}{2} ( w∂_x^2(hu) + ∂_x^2( hu w ) + ϵ (∂_xη)(∂_xw)u )\big) =0, \end{array}\right.\]
where $h=1 + ϵ η$ is the depth, $η$ the surface deformation, $v=∂_xψ$ the derivative of the trace of the velocity potential at the surface, $w=-(h ∂ₓu)/2$ and $u$ is obtained by solving the elliptic problem
\[ hu -\tfrac{μ}{4}∂_x( h^3 ∂_xu) = hv.\]
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"non-hydrostatic");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
NonHydrostatic.f!to be called in explicit time-integration solvers; - a function
NonHydrostatic.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
NonHydrostatic.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx;
- additionally, a handy function
NonHydrostatic.mapfrofullwhich from data matrix returns the Tuple of real vectors(η,v,u), whereucorresponds to the layer-averaged velocity.
WaterWaves1D.SaintVenant — Type
SaintVenant(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the de Saint-Venant (1871) (or shallow water) model
\[ \left\{\begin{array}{l} ∂_tη+∂_x((1+ϵη)v)=0,\\[1ex] ∂_tv+∂_xη+ϵv∂_xv=0. \end{array}\right.\]
where $η$ is the surface deformation and $v$ the horizontal velocity (essentially constant along the vertical variable).
Argument
param is of type NamedTuple and must contain
- the dimensionless parameter
ϵ(nonlinearity); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: no dealisasing if set to0orfalse(default), otherwise1/(3*dealias)modes are set to0(corresponding to standard 2/3 Orszag rule ifdealiasis set to1ortrue);smooth: A sharp low-pass filter (whose scaling is defined bydealias) if set to0orfalseis applied, otherwise only2/(3*dealias)*(1-smooth/2)modes are kept untouched;label: a label for future references (default is"Saint-Venant");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
SaintVenant.f!to be called in explicit time-integration solvers; - a function
SaintVenant.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
SaintVenant.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the layer-averaged velocity (or the derivative of the trace of the velocity potential) atx.
See also SaintVenant_fast.
WaterWaves1D.SaintVenant2D — Type
SaintVenant2D(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the de Saint-Venant (1871) (or shallow water) model
\[ \left\{\begin{array}{l} ∂_tη+\nabla\cdot((1+ϵη)\bm{v})=0,\\[1ex] ∂_tv+\nabla η+ϵ(\bm{v}\cdot\nabla)\bm{v}=0, \end{array}\right.\]
where $η$ is the surface deformation and $v$ the horizontal velocity (essentially constant along the vertical variable).
Argument
param is of type NamedTuple and must contain
- the dimensionless parameter
ϵ(nonlinearity); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: no dealisasing if set to0orfalse(default), otherwise1/(3*dealias)modes are set to0(corresponding to standard 2/3 Orszag rule ifdealiasis set to1ortrue);smooth: A smooth low-pass filter (whose scaling is defined by ) if set to0orfalse(default), otherwise only2/(3*dealias)*(1-smooth/2)modes are kept untouched;label: a label for future references (default is"Saint-Venant");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
SaintVenant2D.f!to be called in explicit time-integration solvers; - a function
SaintVenant2D.maptowhich from(η,vx,vy)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
SaintVenant2D.mapfrowhich from such data matrix returns the Tuple of real vectors(η,vx,vy,x,y), whereηis the values of surface deformation at collocation points(x,y);vx,vyare the velocity fields at collocation points(x,y).
See also SaintVenant2D_fast.
WaterWaves1D.SaintVenant2D_fast — Type
SaintVenant2D_fast(param;kwargs)Same as SaintVenant2D, but faster.
If the optional argument large_data is set to true (default is false), then the standard fft and ifft functions (instead of plans) are used. This may be faster, while using more allocations.
WaterWaves1D.SaintVenant_fast — Type
SaintVenant_fast(param;kwargs)Same as SaintVenant, but faster.
WaterWaves1D.SerreGreenNaghdi — Type
SerreGreenNaghdi(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the Serre-Green-Naghdi model (Serre (1953), Su and Gardner (1969), Green and Naghdi (1976)):
\[ \left\{\begin{array}{l} ∂_tη+∂_x\big( h u\big)=0,\\[1ex] ∂_tv+∂_x\big(η+ϵ uv - \tfrac{ϵ}{2}u^2-\tfrac{μϵ}2 (h∂_xu)^2\big) =0, \end{array}\right.\]
where $h=1 + ϵ η$ is the depth, $η$ the surface deformation, $v=∂_xψ$ the derivative of the trace of the velocity potential at the surface, and $u$ the layer-averaged horizontal velocity is obtained by solving the elliptic problem
\[ hu -\tfrac{μ}{3}∂_x( h^3 ∂_xu) = hv.\]
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Green-Naghdi");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
SerreGreenNaghdi.f!to be called in explicit time-integration solvers; - a function
SerreGreenNaghdi.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
SerreGreenNaghdi.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx;
- additionally, a handy function
SerreGreenNaghdi.mapfrofullwhich from data matrix returns the Tuple of real vectors(η,v,u), whereucorresponds to the layer-averaged velocity.
WaterWaves1D.SquareRootDepth — Type
SquareRootDepth(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the "√D" model proposed in Cotter et al. (2010):
\[ \left\{\begin{array}{l} ∂_tη+∂_x\big( h u\big)=0,\\[1ex] ∂_tv+∂_x\big(η+\tfrac{ϵ}{2}v^2+\tfrac{μϵ}{6h^2} (∂_x(hu))^2\big) =0, \end{array}\right.\]
where $h=1 + ϵ η$ is the depth, , $η$ the surface deformation, $v=∂_xψ$ the derivative of the trace of the velocity potential at the surface, and $u$ is obtained by solving the elliptic problem
\[ u -\tfrac{μ}{3}∂_x( h^{-1} ∂_x(hu)) = v.\]
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"square-root depth");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
SquareRootDepth.f!to be called in explicit time-integration solvers; - a function
SquareRootDepth.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
SquareRootDepth.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), whereηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx;
- additionally, a handy function
SquareRootDepth.mapfrofullwhich from data matrix returns the Tuple of real vectors(η,v,u), whereucorresponds to the layer-averaged velocity.
WaterWaves1D.WWn — Type
WWn(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the water waves expansion proposed by Dommermuth and Yue, West et al., Craig and Sulem (see also the account by Choi) with the "rectification" method proposed by Duchêne and Melinand.
In the case of the quadratic model (n=2) the equations read
\[ \left\{\begin{array}{l} ∂_tη-\tfrac{1}{\sqrtμ ν} T^μv + \tfrac{ϵ}{ν} ∂_x\big((J^δη) v + T^μ((J^δη) T^μ v)\big) =0,\\[1ex] ∂_tv+∂_xη+\frac{ϵ}{2ν}∂_xJ^δ\big( v^2-(T^μv)^2\big)=0, \end{array}\right.\]
where $η$ is the surface deformation, $v=∂_xψ$ is the derivative of the trace of the velocity potential at the surface, and
\[T^μ=-{\rm i}\tanh(\sqrtμ D)\]
is the Fourier multiplier sometimes called "Tilbert transform" (related to the Hilbert transform, the latter arising in the infinite layer configuration, $μ=∞$), and finally $J^δ=J_0(δD)$ is the rectification operator: typically $J_0(k)=\min(1,1/|k|)$ and the parameter $δ$ can be freely chosen, but is typically of the size of $\tfrac{ϵ}{ν}$.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - optionally,
νthe shallow/deep water scaling factor. By default,ν=1ifμ≦1andν=1/√μotherwise. Set the infinite-layer case ifν=0, orμ=Inf. - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
IL: Set the infinite-layer case ifIL=true(orμ=Inf, orν=0), in which caseϵis the steepness parameter. Default isfalse.n :: Int: the order of the expansion; linear system if1, quadratic if2, cubic if3, quartic if4(default and other values yield2);δandm: parameters of the rectifier operator, set ask->min(1,|δ*k|^m)ork->min(1,|δ*k|^m[1]*exp(1-|δ*k|^m[2]))ifmis a couple
(by default is δ=0, i.e. no regularization and m=-1. Notice m=-Inf and δ>0 yields a cut-off filter);
mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"WWn"withnthe order of the expansion);
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
WWn.f!to be called in explicit time-integration solvers (alsoWWn.f1!andWWn.f2!for the symplectic Euler solver);
Additionnally, two functions WaterWaves.f1! and WaterWaves.f2! for symplectic solvers;
- a function
WWn.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
WWn.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.WaterWaves — Type
WaterWaves(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the water waves system (via conformal mapping, see Dyachenko et al. (1996) or Choi and Camassa (1999)).
Specifically we solve
\[ \left\{\begin{array}{l} ∂_tη-\tfrac{1}{μν} G^μ[ϵη]ψ=0,\\[1ex] ∂_tψ+η+\frac{ϵ}{2ν}(∂_xψ)^2-\tfrac{ϵμ}{2ν}\frac{(\frac{1}{μ} G^μ[ϵη]ψ+ϵ(∂_xη)(∂_xψ))^2}{1+μϵ²(∂_xη)^2}=0, \end{array}\right.\]
where, by definition,
\[G^μ[ϵη]ψ=\big(∂_z\Phi-μϵ(∂_xη)(∂_xΦ)\big)\big\vert_{z=ϵη}\]
with $Φ$ being the unique solution to the elliptic boundary value problem
\[\left\{\begin{array}{ll} μ ∂_x^2 Φ + ∂_z^2 Φ=0& \text{ in } \{(x,z)\ : \ -1<z<ϵη(x)\} , \\ Φ= ψ & \text{ on } \{(x,z)\ : \ z=ϵη(x)\} ,\\ ∂_z Φ=0 & \text{ on } \{(x,z)\ : \ z=-1\} . \end{array}\right.\]
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - optionally,
νthe shallow/deep water scaling factor. By default,ν=1ifμ≦1andν=1/√μotherwise. Set the infinite-layer case ifν=0, orμ=Inf. - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
IL: Set the infinite-layer case ifIL=true, in which caseϵis the steepness parameter. Default isfalse.mesh: the mesh of collocation points. By default,mesh = Mesh(param);method ∈ {1,2,3}: method used to initialize the conformal mapping, as a fix-point problemF(u)=u- if
method == 1, use standard contraction fix-point iteration; - if
method == 2, use Newton algorithm with GMRES iterative solver to invert the Jacobian; - if
method == 3, use Newton algorithm with direct solver to invert the Jacobian;
- if
tol: (relative) tolerance of the fix-point algorithm (default is1e-16);maxiter: the maximal number of iteration in the fix-point algorithm (default is100);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"water waves");verbose: prints information iftrue(default istrue).
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
WaterWaves.f!to be called in the explicit time-integration solver (alsoWaterWaves.f1!andWaterWaves.f2!for the symplectic Euler solver);
Additionnally, two functions WaterWaves.f1! and WaterWaves.f2! for symplectic solvers;
- a function
WaterWaves.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
WaterWaves.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
xis a vector of collocation points (non-regularly spaced);ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.Whitham — Type
Whitham(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for two uncoupled Whitham equations:
\[∂_t u_\pm \mp M^μ ∂_x u_\pm \mp \frac{3ϵ}{4} ∂_x (u_\pm^2)=0,\]
where
\[M^μ=\big(\tfrac{\tanh(\sqrtμ D)}{\sqrtμ D}\big)^{1/2}\]
is a Fourier multiplier and $u_\pm$ are right- and left-going waves, combined to produce the physical solutions.
See Emerald for formulas and a full justification.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
KdV: iftrue(default isfalse), compute the standard KdV equations instead (seeKdV(param;kwargs));BBM: iftrue(default isfalse), compute the standard BBM equations instead (seeBBM(param;kwargs));improved_initial_data: iftrue(default), improves the naive (first-order) decomposition into right-going and left-going wave;mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Whitham","KdV"or"BBM"depending on the equation solved);
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
Whitham.f!to be called in explicit time-integration solvers;
Additionnally, a vector Whitham.D and a function Whitham.f! for exponential solvers;
- a function
Whitham.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed. - a function
Whitham.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.WhithamBoussinesq — Type
WhithamBoussinesq(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for a Boussinesq-type model with full-dispersion property:
\[ \left\{\begin{array}{l} ∂_tη+∂_x(F_1^μv + ϵ F_2^μ (η F_2^μv))=0,\\[1ex] ∂_tv+∂_xη+\tfrac{ϵ}{2}∂_x((F_2^μv)^2) =0, \end{array}\right.\]
where $η$ represents the surface deformation, $v=∂_xψ$ the derivative of the trace of the velocity potential at the surface, and $F_1^μ=\frac{\tanh(\sqrtμ D)}{\sqrtμ D}$, and $F_2^μ=(F_1^μ)^α$ are Fourier multipliers. The case $α = 1$ has been introduced in Dinvay et al. (2019), more general situations have been studied in Emerald (2021).
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
Boussinesq: iftrue(default isfalse), compute the standard Boussinesq system instead (seeBoussinesq(param;kwargs));- a parameter
αwhich determines the model solved:- If
α = 1(default), then the model has been introduced in Dinvay et al. (2019); - If
α = 1/2, then the model is a quasilinear version; - If
α < 1/2, then expect instabilities stemming from ill-posedness of the model.
- If
mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Whitham-Boussinesq");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
WhithamBoussinesq.f!to be called in explicit time-integration solvers; - a function
WhithamBoussinesq.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed. - a function
WhithamBoussinesq.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.WhithamGreenNaghdi — Type
WhithamGreenNaghdi(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the fully dispersive Green-Naghdi model proposed in Duchêne et al. (2015):
\[ \left\{\begin{array}{l} ∂_tη+∂_x\big( h u\big)=0,\\[1ex] ∂_tv+∂_x\big(η+ϵ uv - \tfrac{ϵ}{2}u^2-\tfrac{μϵ}2 (h F_0^μ∂_xu)^2\big) =0, \end{array}\right.\]
where $h=1 + ϵ η$ is the depth, $v=∂_xψ$ the derivative of the trace of the velocity potential at the surface, and $u$ the layer-averaged horizontal velocity is obtained by solving the elliptic problem
\[hu -\tfrac{μ}{3}F_0^μ∂_x( h^3 F_0^μ∂_xu) = hv.\]
Above, $F_0^μ=\sqrt{3((F_1^μ)^{-1}(D) - 1)}/D$ where $F_1^μ=\frac{\tanh(\sqrtμ D)}{\sqrtμ D}$ denote Fourier multipliers.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
SGN: iftrue(default isfalse), compute the Serre-Green-Naghdi (SGN) instead of Whitham-Green-Naghdi (WGN) system (seeSerreGreenNaghdi);mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Whitham-Green-Naghdi");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
WhithamGreenNaghdi.f!to be called in explicit time-integration solvers; - a function
WhithamGreenNaghdi.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
WhithamGreenNaghdi.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx;
- additionally, a handy function
WhithamGreenNaghdi.mapfrofullwhich from data matrix returns the Tuple of real vectors(η,v,u), where
ucorresponds to the layer-averaged velocity.
WaterWaves1D.modifiedMatsuno — Type
modifiedMatsuno(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for the modified Matsuno model (compare with Matsuno for the original Matsuno model) proposed by Duchêne and Melinand (2024):
\[ \left\{\begin{array}{l} ∂_tη-\tfrac{1}{\sqrtμ ν} T^μu + \tfrac{ϵ}{ν} ∂_x(η u) + \tfrac{ϵ}{ν} T^μ(η ∂_x T^μ u) =0,\\[1ex] ∂_tu+\exp\big(-ϵ\sqrtμ T^μ∂_xη\big)∂_xη+\frac{ϵ}{2ν}∂_x\big( u^2\big)=0. \end{array}\right.\]
where $η$ is the surface deformation, $v=∂_xψ$ is the derivative of the trace of the velocity potential at the surface, $u=∂_xψ-ϵ\sqrtμ(T^μ∂_xψ)(∂_xη)$ represents the horizontal velocity at the free surface, and
\[T^μ=-{\rm i}\tanh(\sqrtμ D)\]
is the Fourier multiplier sometimes called "Tilbert transform" (related to the Hilbert transform, the latter arising in the infinite layer configuration, $μ=∞$).
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - optionally,
νthe shallow/deep water scaling factor. By default,ν=1ifμ≦1andν=1/√μotherwise. Set the infinite-layer case ifν=0, orμ=Inf. - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
IL: Set the infinite-layer case ifIL=true(orμ=Inf, orν=0), in which caseϵis the steepness parameter. Default isfalse.mesh: the mesh of collocation points. By default,mesh = Mesh(param);ktol: tolerance of the low-pass Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"modified Matsuno");
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
modifiedMatsuno.f!to be called in explicit time-integration solvers; - a function
modifiedMatsuno.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
modifiedMatsuno.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx.
WaterWaves1D.relaxedGreenNaghdi — Type
relaxedGreenNaghdi(param; kwargs...)Define an object of type AbstractModel in view of solving the initial-value problem for a relaxed Green-Naghdi model proposed by N. Favrie and S. Gavrilyuk or C. Escalante, M. Dumbser and M. Castro and G. Richard.
In the latter works the model reads
\[ \left\{\begin{array}{l} ∂_tη+∂_x (hu)=0,\\[1ex] h(∂_tu+ϵu∂_x u+∂_x η)+aμ ∂_x (hp)=0,\\[1ex] h(∂_tp +ϵu∂_x p)+a(2w+h∂_xu)=0,\\[1ex] h(∂_tw+uϵ∂_x w) = a\tfrac{3}{2}p. \end{array}\right.\]
where $h=1 + ϵ η$ is the water depth, $η$ the surface deformation, $u$ the horizontal velocity and $p$ and $w$ are expected to approximate the layer-veraged pressure and vertical velocity when $a\gg1$. Notice the system has four evolution equations, in particular initial data for the augmented variables $p$ and $w$ must be suitably chosen.
Argument
param is of type NamedTuple and must contain
- dimensionless parameters
ϵ(nonlinearity) andμ(dispersion); - the relaxation parameter
a; - numerical parameters to construct the mesh of collocation points, if
meshis not provided as a keyword argument.
Optional keyword arguments
FG: iftrue(default isfalse), compute the Favrie-Gavrilyuk model, otherwise compute the Escalante-Dumbser-Castro model;id:∈{0,1,2}and represent the level of preparation of the initial data (default is1);mesh: the mesh of collocation points. By default,mesh = Mesh(param);iterative: solve the elliptic problem (to construct initial data) through GMRES iftrue, LU decomposition iffalse(default istrue);precond: use a (left) preconditioner for GMRES iftrue(default), chooseprecondas the preconditioner if provided;gtol: relative tolerance of the GMRES algorithm (default is1e-14);restart: the corresponding option of the GMRES algorithm (default is100);maxiter: the corresponding option of GMRES (default isnothing);ktol: tolerance of the Krasny filter (default is0, i.e. no filtering);dealias: dealiasing with Orszag rule1-dealias/(dealias+2)(default is0, i.e. no dealiasing);label: a label for future references (default is"Favrie-Gavrilyuk"ifFG==true,"Escalante-Dumbser-Castro"otherwise);
Return values
Generate necessary ingredients for solving an initial-value problem via solve!:
- a function
relaxedGreenNaghdi.f!to be called in explicit time-integration solvers; - a function
relaxedGreenNaghdi.maptowhich from(η,v)of typeInitialDataprovides the raw data matrix on which computations are to be executed; - a function
relaxedGreenNaghdi.mapfrowhich from such data matrix returns the Tuple of real vectors(η,v,x), where
ηis the values of surface deformation at collocation pointsx;vis the derivative of the trace of the velocity potential atx;
- additionally, a handy function
relaxedGreenNaghdi.mapfrofullwhich from data matrix returns the Tuple of real vectors(η,v,u,p,w), where
ucorresponds to the layer-averaged horizontal velocity.pcorresponds to the relaxed (artificial) layer-averaged non-hydrostatic pressure;wcorresponds to the relaxed (artificial) layer-averaged vertical velocity.
Solvers
WaterWaves1D.Euler — Type
Euler(arguments;realdata)Explicit Euler solver.
Construct an object of type TimeSolver to be used in Problem(model, initial, param; solver::TimeSolver)
Arguments can be either
- an object of type
AbstractModel; - an
Arrayof size(N,datasize)whereNis the number of collocation points anddatasizethe number of equations solved; (param,datasize)whereparamis aNamedTuplecontaining a keyN, anddatasizea integer (optional, by defaultdatasize=2).
The keyword argument realdata is optional, and determines whether pre-allocated vectors are real- or complex-valued. By default, they are either determined by the model or the type of the array in case 0. and 1., complex-valued in case 2..
The function step!(solver :: EulerExp, model :: AbstractModel , U, δt)
performs the integration step of the explicit Euler solver applied to solutions to the equation $u'=f(u)$.
It replaces the argument $U≈u(tₙ)$ with the next element of the recursive scheme approximating $u(tₙ+δt)$ through the formula
\[u(tₙ+δt)≈ u(tₙ) + δt f( u(tₙ) )\]
WaterWaves1D.EulerExp — Type
EulerExp(arguments;realdata)Exponential Euler solver Hochbruck and Ostermann (2010).
Construct an object of type TimeSolver to be used in Problem(model, initial, param; solver::TimeSolver)
Arguments can be either
- an object of type
AbstractModel, which contains the necessary; - an
Arrayof size(N,datasize)whereNis the number of collocation points anddatasizethe number of equations solved; (param,datasize)whereparamis aNamedTuplecontaining a keyN, anddatasizea integer (optional, by defaultdatasize=2).
The keyword argument realdata is optional, and determines whether pre-allocated vectors are real- or complex-valued. By default, they are either determined by the model or the type of the array in case 0. and 1., complex-valued in case 2..
The function step!(solver :: EulerExp, model :: AbstractModel , U, δt)`
performs the integration step of the exponential Euler solver applied to solutions to the equation $u'=D u + g(u)$.
It replaces the argument $U≈u(tₙ)$ with the next element of the recursive scheme approximating $u(tₙ+δt)$ through the formula
\[u(tₙ+δt)≈e^{δt D} u(tₙ) + δt \frac{e^{δt D} - 1}{δt D} g( u(tₙ) )\]
The matrix D should be diagonal and the vector of its diagonal values provided together with the nonlinear function g by model.
WaterWaves1D.EulerExp_naive — Type
EulerExp_naive()Exponential Euler solver.
A naive version of EulerExp, without argument since no pre-allocation is performed.
WaterWaves1D.EulerSymp — Type
EulerSymp(arguments;Niter,implicit,realdata)Symplectic Euler solver Hairer et al. (2003) for canonical Hamiltonian equations. The implicit Euler method is first used on one equation, then the explicit Euler method is used on the second one. The implicit problem is solved using explicit fixed-point iterations.
Construct an object of type TimeSolver to be used in Problem(model, initial, param; solver::TimeSolver)
Arguments can be either
- an object of type
AbstractModel; - an
Arrayof size(N,2)whereNis the number of collocation points; - a
NamedTuplecontaining a keyN.
The keyword argument Niter (optional, defaut value = 10) determines the number of steps in the Neumann iteration solver of the implicit step. The keyword argument implicit (optional, defaut value = 1) determines which equation is implicit (must be 1 or 2). The keyword argument realdata is optional, and determines whether pre-allocated vectors are real- or complex-valued. By default, they are either determined by the model or the type of the array in case 0. and 1., complex-valued in case 2..
The function step!(solver :: EulerSymp, model :: AbstractModel , U, δt)
performs the integration step of the symplectic Euler solver applied to solutions to the equation $(u₁,u₂)'=(f₁,f₂)(u₁,u₂)$.
It replaces the argument $U≈(u₁,u₂)(tₙ)$ with the next element of the recursive scheme approximating $(u₁,u₂)(tₙ+δt)$ through the formula
\[ \left\{\begin{array}{l} u₁(tₙ+δt)≈ u₁(tₙ) + δt f₁( u₁(tₙ+δt), u₂(tₙ) )\\ u₂(tₙ+δt)≈ u₂(tₙ) + δt f₂( u₁(tₙ+δt), u₂(tₙ) ) \end{array}\right.\]
(if the first equation is solved implicitly, as defined by implicit).
WaterWaves1D.Euler_naive — Type
Euler_naive()Explicit Euler solver.
A naive version of Euler, without argument since no pre-allocation is performed.
WaterWaves1D.RK4 — Type
RK4(arguments;realdata)Explicit Runge-Kutta fourth order solver.
Construct an object of type TimeSolver to be used in Problem(model, initial, param; solver::TimeSolver)
Arguments can be either
- an object of type
AbstractModel, typically the model you will solve with the solver; - an
Arraywhich has the size of the objects that the solver will manipulate (typically a vector ofsystemsizeelements of sizeNwhereNis the number of collocation points andsystemsizethe number of solved equations); - a
(datasize,systemsize)wheredatasizeis the size of scalar variables (typicallyNthe number of collocation points) anddatasize(optional, by defaultsystemsize=2) the number of solved equations); (param,systemsize)whereparamis aNamedTuplecontaining a keyNdescribing the number of collocation points, andsystemsizethe number of solved equations (optional, by defaultsystemsize=2).
The keyword argument realdata is optional, and determines whether pre-allocated vectors are real- or complex-valued. By default, they are either determined by the model or the type of the array in case 0. and 1., complex-valued in case 2..
The function step!(solver :: RK4, model :: AbstractModel , U, δt)
performs the integration step of the standard Runge-Kutta 4 solver applied to solutions to the equation $u'=f(u)$.
It replaces the argument $U≈u(tₙ)$ with the next element of the recursive scheme approximating $u(tₙ+δt)$ through the formula
\[u(tₙ+δt)≈ u(tₙ) + δt/6 * (u₁ + 2 u₂ + 2 u₃ + u₄ )\]
where
\[ \left\{\begin{array}{l} u₁ = f( u(tₙ) )\\ u₂ = f( u(tₙ) + δt/2 * f( u₁ ) )\\ u₃ = f( u(tₙ) + δt/2 * f( u₂ ) )\\ u₄ = f( u(tₙ) + δt * f( u₃ ) )\\ \end{array}\right.\]
WaterWaves1D.RK4_naive — Type
RK4_naive()Runge-Kutta fourth order solver.
A naive version of RK4, without argument since no pre-allocation is performed.
WaterWaves1D.StoermerVerlet — Type
StoermerVerlet(arguments;Niter,implicit,realdata)Störmer–Verlet solver Hairer et al. (2003) for canonical Hamiltonian equations. Combination of the composition of the two symplectic Euler methods (with different equations solved implicitly). The implicit problems are solved using explicit fixed-point iterations.
Construct an object of type TimeSolver to be used in Problem(model, initial, param; solver::TimeSolver)
Arguments can be either
- an object of type
AbstractModel; - an
Arrayof size(N,2)whereNis the number of collocation points; - a
NamedTuplecontaining a keyN.
The keyword argument Niter (optional, defaut value = 10) determines the number of steps in the Neumann iteration solver of the implicit step. The keyword argument implicit (optional, defaut value = 1) determines which equation is first solved implicitly (must be 1 or 2). The keyword argument realdata is optional, and determines whether pre-allocated vectors are real- or complex-valued. By default, they are either determined by the model or the type of the array in case 0. and 1., complex-valued in case 2..
The function step!(solver :: StoermerVerlet, model :: AbstractModel , U, δt)
performs the integration step of the symplectic Euler solver applied to solutions to the equation $(u₁,u₂)'=(f₁,f₂)(u₁,u₂)$.
It replaces the argument $U≈(u₁,u₂)(tₙ)$ with the next element of the recursive scheme approximating $(u₁,u₂)(tₙ+δt)$ through the formula
\[ \left\{\begin{array}{l} u₁(tₙ+δt/2)≈ u₁(tₙ) + δt/2 f₁( u₁(tₙ+δt/2), u₂(tₙ) )\\ u₂(tₙ+δt/2)≈ u₂(tₙ) + δt/2 f₂( u₁(tₙ+δt/2), u₂(tₙ) )\\ u₂(tₙ+δt)≈ u₂(tₙ+δt/2) + δt/2 f₂( u₁(tₙ+δt/2), u₂(tₙ+δt) )\\ u₁(tₙ+δt)≈ u₁(tₙ+δt/2) + δt/2 f₁( u₁(tₙ+δt/2), u₂(tₙ+δt) ) \end{array}\right.\]
(if the first equation is solved implicitly first, as defined by implicit).
Structures
WaterWaves1D.Init — Type
Init(data ; fast, label)Generate an initial data to be used in the function Problem.
data should contain either
- a function
ηand a functionv(in this order); - a
mesh(of typeMesh) and two vectors representingη(mesh.x)andv(mesh.x)(in this order); - an array of collocation points and two vectors representing
η(x)andv(x)(in this order).
In the last two cases, an optional keyword argument fast can be set to true, (default is false), in which case the algorithm is faster and uses less allocations, but is less precise.
In the last case, the collocation points must be regularly spaced, otherwise an ErrorException is raised.
If the keyword label::String (used to display information to the output stream) is not provided, then it is set to the "user-defined".
WaterWaves1D.Init2D — Type
Init2D(data ; fast, label)Generate a two-dimensional initial data to be used in the function Problem.
data should contain either
- a function
ηand a functionv(in this order); - a
mesh(of typeMesh) and two vectors representingη(mesh.x)andv(mesh.x)(in this order); - an array of collocation points and two vectors representing
η(x)andv(x)(in this order).
In the last two cases, an optional keyword argument fast can be set to true, (default is false), in which case the algorithm is faster and uses less allocations, but is less precise.
In the last case, the collocation points must be regularly spaced, otherwise an ErrorException is raised.
If the keyword label::String (used to display information to the output stream) is not provided, then it is set to the "user-defined".
WaterWaves1D.InitialData — Type
Abstract type defining initial data from which initial-value problems can be built, through Problem( model :: AbstractModel, initial :: InitialData, param :: NamedTuple )
WaterWaves1D.Mesh — Type
Mesh(args)Construct a periodic mesh of N collocation points regularly spaced between xmin (included) and xmax (excluded), and associated Fourier modes.
Arguments
Can be either
- a
NamedTuplecontainingNandxminandxmax; or - a
NamedTuplecontainingNandL(in which casexmin=-Landxmax=L); or - a vector of regularly spaced collocation points.
Return values
m=Mesh(args) is of parametric type and offers with
m.N: number of collocation points and Fourier modes;m.xmin: minimum of the mesh (included in the vector of collocation points);m.xmax: maximum of the mesh (excluded in the vector of collocation points);m.dx: distance between two collocation points;m.x: the vector of collocation points;m.k: the vector of wavenumbers;m.kmin: minimum of wavenumbers (included in the vector of wavenumbers);m.kmax: maximum of wavenumbers (included in the vector of wavenumbers);m.dk: distance between two Fourier modes.
WaterWaves1D.Problem — Type
Problem( model, initial, param ; solver, label)Build an initial-value problem which can then be solved (i.e. integrated in time) through solve!( problem )
Arguments
model :: AbstractModel, the system of equation solved.
May be built, e.g., by WaterWaves(param);
initial :: InitialData, the initial data.
May be buit, e.g., by Init(η,v) where η is the surface deformation and v the derivative of the trace of the velocity potential at the surface;
times :: Timesis the time grid, and may be built using the functionTimes.
Alternatively one can simply provide a NamedTuple with - T, the final time of integration - dt, the timestep - optionally, Ns the number of computed data or ns for storing data every ns computation steps (by default, every computed data is stored).
Optional keyword arguments
solver :: TimeSolver, the solver for time integration (default is explicit Runge-Kutta fourth order solver).
May be built, e.g., by RK4(model) or RK4_naive().
label :: Stringis used in future references (e.g.plot_solution).- Information are not printed if
verbose = false(default istrue).
WaterWaves1D.solve! — Method
solve!(problems; verbose)
Solve (i.e. integrate in time) a collection of initial-value problems.
The argument problems should be a collection (list, array...) of elements of type Problem.
Information are not printed if keyword argument verbose = false (default is true).
WaterWaves1D.solve! — Method
solve!(problem::Problem; verbose)
Solve (i.e. integrate in time) an initial-value problem
The argument problem should be of type Problem. It may be buit, e.g., by Problem(model, initial, param)
Information are not printed if keyword argument verbose = false (default is true).
WaterWaves1D.Data — Type
Data( m :: Matrix )Data structure to store the solution of an initial-value problem along time.
data=Data(m) is of parametric type and offers
data.U, a 1-element vector with a copy of the matrixm;(data.datalength,data.datasize)=size(m)wheredatalengthis the number of computed modes, anddatasizethe number of involved equations, typically 2.
WaterWaves1D.Times — Type
Times(param; ns, Ns)Constructs a mesh of times, to be used in initial-value problems (see Problem).
Arguments
param is either
- a
NamedTuplecontainingdtthe timestep andTthe final time of comuptation; or - a vector of computed times.
Optional keyword arguments
ns: data are stored everynscomputations (optional, default = 1).Ns:Nsdata (in addition to the initial datum) are stored (optional, by default `floor( tfin/dt)).
If both Ns and ns are given, Ns overrules ns.
Return values
t=Times(args) is of parametric type and offers
t.Nc: number of computed times (including initial datum);t.Ns: number of stored times (including initial datum);t.ns: number of computed times between two stored times;t.tfin: the final time;t.dt: the timestep;t.tc: the vector of computed times;t.ts: the vector of stored times.
Tools
WaterWaves1D.energy — Method
energy(p::Problem; T) -> Any
Compute the excess of mass of a solved initial-value problem pb at a given time T.
Keyword argument T is optional, the last computed time is used by default.
WaterWaves1D.energy_diff — Method
energy_diff(p::Problem; T, rel) -> Any
Compute the difference of energy of a solved initial-value problem pb between given time T and initial time.
Keyword argument T is optional, the last computed time is used by default.
If keyword argument rel=true (default is false), then compute the relative difference (with initial value as reference).
WaterWaves1D.interpolate — Method
interpolate(mesh::Mesh, vector, x; fast) -> Any
Interpolate a vector vector of values on a uniform collocation grid defined by mesh, on collocation points given by x.
If the collocation points x are regularly spaced and the optional keyword argument fast is set to true (default is false), then the algorithm is faster and uses less allocations, but is less precise.
Return the vector of values on collocation points.
WaterWaves1D.interpolate — Method
interpolate(mesh::Mesh, vector; n) -> Tuple{Mesh, Any}
Interpolate a vector vector of values on a uniform collocation grid defined by mesh.
Return (new_mesh,new_vector) a new uniform mesh with n times as many values, and the vector of values at these collocation points.
WaterWaves1D.mass — Method
mass(p::Problem; T) -> Float64
Compute the excess of mass of a solved initial-value problem pb at a given time T.
Keyword argument T is optional, the last computed time is used by default.
WaterWaves1D.mass_diff — Method
mass_diff(p::Problem; T, rel) -> Any
Compute the difference of excess of mass of a solved initial-value problem pb between given time T and initial time.
Keyword argument T is optional, the last computed time is used by default.
If keyword argument rel=true (default is false), then compute the relative difference (with initial value as reference).
WaterWaves1D.momentum — Method
momentum(p::Problem; T) -> Any
Compute the horizontal impulse of a solved initial-value problem pb at a given time T.
Keyword argument T is optional, the last computed time is used by default.
WaterWaves1D.momentum_diff — Method
momentum_diff(p::Problem; T, rel) -> Any
Compute the difference of horizontal impulse of a solved initial-value problem pb between given time T and initial time.
Keyword argument T is optional, the last computed time is used by default.
If keyword argument rel=true (default is false), then compute the relative difference (with initial value as reference).
WaterWaves1D.solution — Method
solution(p::Problem; T, x, interpolation, raw) -> Tuple
Give the solution of a solved initial-value problem at a given time T.
Arguments
- Argument
pbis of typeProblem. - Keyword argument
Tis optional, the last computed time is returned by default. - Keyword argument
xis optional, if provided the solution is interpolated to the collocation vectorx. - Keyword argument
interpolationis optional, if an integer is provided the solution is interpolated on as many collocation points (iftrue, then the default value2^3is chosen). - Keyword argument
rawis optional, if set totruethen(U,t)withUthe raw data andtthe time is returned (default isfalse).
Return values
Return (η,v,x,t) where
ηis the surface deformation at collocation points;vis the tangential velocity (derivative of the trace of the velocity potential) at collocation points;xis the vector of collocation points;tthe time (first computed time greater or equal to providedT).
Load and save
WaterWaves1D.load_data! — Method
load_data!(file_name :: String, problem :: Problem)Fills problem with raw data extracted from the file with name file_name (and extension ".h5").
WaterWaves1D.load_data — Method
load_data(file_name :: String)Load data from the file with name file_name (and extension ".h5").
WaterWaves1D.load_init — Method
load_init(file_name :: String; fast = false)Load initial data from the file with name file_name (and extension ".h5").
Keyword argument fast is optional (default is false), and corresponds the the keyword argument of the function Init.
Return an object of type InitialData.
Examples
WaterWaves1D.default_example — Method
default_example()Return the path to an example that can be used to quickly see DispersiveShallowWater.jl in action. See also examples_dir and get_examples.
Copied from Trixi.jl.
To run an example, use, e.g., include.
Example
include(default_example())WaterWaves1D.examples_dir — Method
examples_dir()Return the directory where the example files provided with WaterWaves1D.jl are located. If WaterWaves1D.jl is installed as a regular package (with ]add DispersiveShallowWater), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir.
Copied from Trixi.jl.
Example
readdir(examples_dir())WaterWaves1D.get_examples — Method
get_examples()Return a list of all examples that are provided by DispersiveShallowWater.jl. See also examples_dir and default_example. To run an example, use, e.g., include.
Copied from Trixi.jl.
Example
include(get_examples()[1])