Skip to content

WaterWavesModels/WaterWaves1D.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaterWaves1D.jl

Build Status codecov DOI

Installation

(v1.8) pkg> add WaterWaves1D
using WaterWaves1D

Overview

WaterWaves1D.jl is a Julia package providing a framework to study and compare several models for the propagation of unidimensional surface gravity waves (a.k.a. "water waves").

Several models are already implemented, including (but not limited to) the so-called water waves system, its truncated spectral expansion, the Green-Naghdi system, the Matsuno system, and so on. You may easily add your favorite one to the gang: see the how-to guide.

Documentation

See here.

Example

A simple example of a typical use of the package can be found below. More advanced examples are available at the examples and notebooks folders.

Gather parameters of the problem.

param = (
    # Physical parameters. Variables are non-dimensionalized as in Lannes, The water waves problem, isbn:978-0-8218-9470-5
    μ  = 1,     # shallow-water dimensionless parameter
    ϵ  = 1/4,   # nonlinearity dimensionless parameter
    # Numerical parameters
    N  = 2^11,  # number of collocation points
    L  = 10,    # half-length of the numerical tank (-L,L)
    T  = 5,     # final time of computation
    dt = 0.01,  # timestep
                );

Define initial data (here, a "heap of water").

z(x) = exp.(-abs.(x).^4); # surface deformation
v(x) = 0*exp.(-x.^2);     # zero initial velocity
init = Init(z,v);         # generate the initial data with correct type

Set up initial-value problems for different models to compare.

# Build models
model_WW=WaterWaves(param,verbose=false) # The water waves system
model_WW2=WWn(param;n=2,dealias=1=1/10) # The quadratic model (WW2)
# Build problems
problem_WW=Problem(model_WW, init, param) ;
problem_WW2=Problem(model_WW2, init, param) ;

Integrate in time the initial-value problems.

solve!([problem_WW problem_WW2]);

Plot solutions at final time.

using Plots
plot([problem_WW, problem_WW2])

Generate an animation.

anim = @animate for t = LinRange(0,5,101)
    plot([problem_WW, problem_WW2];T=t,ylims=(-0.5,1))
end
gif(anim, "Example.gif", fps=15)

Developers

WaterWaves1D.jl is being developed by Vincent Duchêne and Pierre Navaro.

Citing

The code is citable via zenodo. Please cite as:

V. Duchêne, P. Navaro. WaterWaves1D.jl (Version v0.1.0). Zenodo. https://doi.org/10.5281/zenodo.7142921