diff --git a/NEWS.md b/NEWS.md index d868a4a6..b43af59f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,7 @@ for human readability. - The abstract interface `AbstractShallowWaterEquations` was added to unify several systems such as the `SerreGreenNaghdiEquations1D`, the `BBMBBMEquations1D`, and the `SvärdKalischEquations1D` ([#127]). +- A new conversion function `prim2phys` was introduced, defaulting to `prim2prim`. `prim2phys` is the default conversion function for plotting. ## Changes when updating to v0.4 from v0.3.x diff --git a/docs/src/overview.md b/docs/src/overview.md index 30cb9eb2..521fa40d 100644 --- a/docs/src/overview.md +++ b/docs/src/overview.md @@ -146,7 +146,7 @@ always plot to first subplot) and `plot_initial`. You can also provide a `conver of the primitive variables `q` at one node, and the `equations` as input and should return an `SVector` of any length as output. For a user defined conversion function, there should also exist a function `varnames(conversion, equations)` that returns a `Tuple` of the variable names used for labelling. The conversion function can, e.g., be [`prim2cons`](@ref) or [`waterheight_total`](@ref) if one only wants to plot the total water height. The resulting plot will have one subplot for each of the returned -variables of the conversion variable. By default, the conversion function is just [`prim2prim`](@ref), i.e. the identity. +variables of the conversion variable. By default, the conversion function is just [`prim2phys`](@ref), i.e., the identity for most equations. Plotting an animation over time can, e.g., be done by the following command, which uses `step` to plot the solution at a specific time step. diff --git a/src/equations/equations.jl b/src/equations/equations.jl index f081260e..92d66e2a 100644 --- a/src/equations/equations.jl +++ b/src/equations/equations.jl @@ -37,8 +37,8 @@ get_name(equations::AbstractEquations) = equations |> typeof |> nameof |> string Return the list of variable names when applying `conversion_function` to the conserved variables associated to `equations`. -Common choices of the `conversion_function` are [`prim2prim`](@ref) and -[`prim2cons`](@ref). +Common choices of the `conversion_function` are [`prim2prim`](@ref), +[`prim2cons`](@ref), and [`prim2phys`](@ref). """ function varnames end diff --git a/src/visualization.jl b/src/visualization.jl index e4a51d44..5eaf136f 100644 --- a/src/visualization.jl +++ b/src/visualization.jl @@ -141,22 +141,22 @@ end end @recipe function f(semisol::Pair{<:Semidiscretization, <:ODESolution}; plot_initial = false, - plot_bathymetry = true, conversion = prim2prim, step = -1) + plot_bathymetry = true, conversion = prim2phys, step = -1) PlotData(semisol, plot_initial, plot_bathymetry, conversion, step) end @recipe function f(semi::Semidiscretization, sol::ODESolution; plot_initial = false, - plot_bathymetry = true, conversion = prim2prim, step = -1) + plot_bathymetry = true, conversion = prim2phys, step = -1) PlotData(semi => sol, plot_initial, plot_bathymetry, conversion, step) end @recipe function f(semisol::Pair{<:Semidiscretization, <:ODESolution}, x_value; - conversion = prim2prim) + conversion = prim2phys) PlotDataOverTime(semisol, x_value, conversion) end @recipe function f(semi::Semidiscretization, sol::ODESolution, x_value; - conversion = prim2prim) + conversion = prim2phys) PlotDataOverTime(semi => sol, x_value, conversion) end