List of all functions
Here an overview of all functions:
JustRelax.Geometry
— Typestruct Geometry{nDim,T}
A struct representing the geometry of a topological object in nDim dimensions.
Arguments
nDim
: The number of dimensions of the topological object.T
: The type of the elements in the topological object.
JustRelax.velocity_grids
— Methodvelocity_grids(xci, xvi, di::NTuple{N,T}) where {N,T}
Compute the velocity grids for N dimensionional problems.
Arguments
xci
: The x-coordinate of the cell centers.xvi
: The x-coordinate of the cell vertices.di
: A tuple containing the cell dimensions.
JustRelax.JustRelax2D.WENO_advection!
— MethodWENO_advection!(u, Vxi, weno, di, ni, dt)
Perform the advection step of the Weighted Essentially Non-Oscillatory (WENO) scheme for the solution of hyperbolic partial differential equations.
Arguments
u
: field to be advected.Vxi
: velocity field.weno
: structure containing the WENO scheme parameters and temporary variables.di
: grid spacing.ni
: number of grid points.dt
: time step.
Description
The function first calculates the fluxes using the WENO scheme. Then it performs three steps of the WENO scheme. Each step involves calculating the right-hand side of the WENO equation and updating the solution u
. The updating of the solution u
is done using different combinations of the original solution and the temporary solution weno.ut
.
JustRelax.JustRelax2D._heatdiffusion_PT!
— Methodheatdiffusion_PT!(thermal, pt_thermal, K, ρCp, dt, di; iterMax, nout, verbose)
Heat diffusion solver using Pseudo-Transient iterations. Both K
and ρCp
are n-dimensional arrays.
JustRelax.JustRelax2D._heatdiffusion_PT!
— Methodheatdiffusion_PT!(thermal, pt_thermal, rheology, dt, di; iterMax, nout, verbose)
Heat diffusion solver using Pseudo-Transient iterations.
JustRelax.JustRelax2D.allzero
— Methodallzero(x::Vararg{T,N}) where {T,N}
Check if all elements in x
are zero.
Arguments
x::Vararg{T,N}
: The input array.
Returns
Bool
:true
if all elements inx
are zero,false
otherwise.
JustRelax.JustRelax2D.assign!
— Methodassign!(B::AbstractArray{T,N}, A::AbstractArray{T,N}) where {T,N}
Assigns the values of array A
to array B
in parallel.
Arguments
B::AbstractArray{T,N}
: The destination array.A::AbstractArray{T,N}
: The source array.
JustRelax.JustRelax2D.compute_P!
— MethodcomputeP!(P, P0, RP, ∇V, ΔTc, η, rheology::NTuple{N,MaterialParams}, phaseratio::C, dt, r, θ_dτ)
Compute the pressure field P
and the residual RP
for the compressible case. This function introduces thermal stresses after the implementation of Kiss et al. (2023). The temperature difference ΔTc
on the cell center is used to compute this as well as α as the thermal expansivity.
JustRelax.JustRelax2D.compute_buoyancy
— Methodcompute_buoyancy(rheology, args, phase_ratios)
Compute the buoyancy forces based on the given rheology, arguments, and phase ratios.
Arguments
rheology
: The rheology used to compute the buoyancy forces.args
: Additional arguments required by the rheology.phase_ratios
: The ratios of the different phases.
JustRelax.JustRelax2D.compute_buoyancy
— Methodcompute_buoyancy(rheology, args)
Compute the buoyancy forces based on the given rheology and arguments.
Arguments
rheology
: The rheology used to compute the buoyancy forces.args
: Additional arguments required for the computation.
JustRelax.JustRelax2D.compute_buoyancy
— Methodcompute_buoyancy(rheology::MaterialParams, args, phase_ratios)
Compute the buoyancy forces for a given set of material parameters, arguments, and phase ratios.
Arguments
rheology
: The material parameters.args
: The arguments.phase_ratios
: The phase ratios.
JustRelax.JustRelax2D.compute_buoyancy
— Methodcompute_buoyancy(rheology::MaterialParams, args)
Compute the buoyancy forces based on the given rheology parameters and arguments.
Arguments
rheology::MaterialParams
: The material parameters for the rheology.args
: The arguments for the computation.
JustRelax.JustRelax2D.compute_dt
— Methodcompute_dt(S::JustRelax.StokesArrays, args...)
Compute the time step dt
for the simulation.
JustRelax.JustRelax2D.compute_maxloc!
— Methodmaxloc!(B, A; window)
Compute the maximum value of A
in the window = (width_x, width_y, width_z)
and store the result in B
.
JustRelax.JustRelax2D.compute_ρg!
— Methodcompute_ρg!(ρg, rheology, args)
Calculate the buoyance forces ρg
for the given GeoParams.jl rheology
object and correspondent arguments args
.
JustRelax.JustRelax2D.compute_ρg!
— Methodcompute_ρg!(ρg, phase_ratios, rheology, args)
Calculate the buoyance forces ρg
for the given GeoParams.jl rheology
object and correspondent arguments args
. The phase_ratios
are used to compute the density of the composite rheology.
JustRelax.JustRelax2D.continuation_log
— Methodcontinuation_log(x_new, x_old, ν)
Do a continuation step exp((1-ν)*log(x_old) + ν*log(x_new))
with damping parameter ν
JustRelax.JustRelax2D.flow_bcs!
— Methodflow_bcs!(stokes, bcs::VelocityBoundaryConditions)
Apply the prescribed flow boundary conditions bc
on the stokes
JustRelax.JustRelax2D.flow_bcs!
— Methodflow_bcs!(stokes, bcs::DisplacementBoundaryConditions)
Apply the prescribed flow boundary conditions bc
on the stokes
JustRelax.JustRelax2D.fn_ratio
— Methodfn_ratio(fn::F, rheology::NTuple{N, AbstractMaterialParamsStruct}, ratio) where {N, F}
Average the function fn
over the material phases in rheology
using the phase ratios ratio
.
JustRelax.JustRelax2D.interp_Vx_on_Vy!
— Methodinterp_Vx_on_Vy!(Vx_on_Vy, Vx)
Interpolates the values of Vx
onto the grid points of Vy
.
Arguments
Vx_on_Vy::AbstractArray
:Vx
atVy
grid points.Vx::AbstractArray
:Vx
at its staggered grid points.
JustRelax.JustRelax2D.rotate_stress!
— MethodJaumann derivative
τijo += vk * ∂τijo/∂xk - ωij * ∂τkjo + ∂τkjo * ωij
JustRelax.JustRelax2D.take
— Methodtake(fldr::String)
Create folder fldr
if it does not exist.
JustRelax.JustRelax2D.tensor_invariant!
— Methodtensor_invariant!(A::JustRelax.SymmetricTensor)
Compute the tensor invariant of the given symmetric tensor A
.
Arguments
A::JustRelax.SymmetricTensor
: The input symmetric tensor.
JustRelax.JustRelax2D.thermal_bcs!
— Methodthermal_bcs!(T, bcs::TemperatureBoundaryConditions)
Apply the prescribed heat boundary conditions bc
on the T
JustRelax.JustRelax2D.velocity2vertex!
— Methodvelocity2vertex!(Vx_v, Vy_v, Vz_v, Vx, Vy, Vz)
In-place interpolation of the velocity field Vx
, Vy
, Vz
from a staggered grid with ghost nodes onto the pre-allocated Vx_d
, Vy_d
, Vz_d
3D arrays located at the grid vertices.
JustRelax.JustRelax2D.velocity2vertex
— Methodvelocity2vertex(Vx, Vy, Vz)
Interpolate the velocity field Vx
, Vy
, Vz
from a staggered grid with ghost nodes onto the grid vertices.
JustRelax.JustRelax2D.@add
— Macro@add(I, args...)
Add I
to the scalars in args
JustRelax.JustRelax2D.@copy
— Macrocopy(B, A)
convenience macro to copy data from the array A
into array B
JustRelax.JustRelax2D.@displacement
— Macro@displacement(U)
Unpacks the displacement arrays U
from the StokesArrays A
.
JustRelax.JustRelax2D.@idx
— Macro@idx(args...)
Make a linear range from 1
to args[i]
, with i ∈ [1, ..., n]
JustRelax.JustRelax2D.@normal
— Macro@normal(A)
Unpacks the normal components of the symmetric tensor A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@plastic_strain
— Macro@plastic_strain(A)
Unpacks the plastic strain rate tensor ε_pl
from the StokesArrays A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@qT
— Macro@qT(V)
Unpacks the flux arrays qT_i
from the ThermalArrays A
.
JustRelax.JustRelax2D.@qT2
— Macro@qT2(V)
Unpacks the flux arrays qT2_i
from the ThermalArrays A
.
JustRelax.JustRelax2D.@residuals
— Macro@residuals(A)
Unpacks the momentum residuals from A
.
JustRelax.JustRelax2D.@shear
— Macro@shear(A)
Unpacks the shear components of the symmetric tensor A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@strain
— Macro@strain(A)
Unpacks the strain rate tensor ε
from the StokesArrays A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@strain_center
— Macro@strain_center(A)
Unpacks the strain rate tensor ε
from the StokesArrays A
, where its components are defined in the center of the grid cells. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@stress
— Macro@stress(A)
Unpacks the deviatoric stress tensor τ
from the StokesArrays A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@stress_center
— Macro@stress_center(A)
Unpacks the deviatoric stress tensor τ
from the StokesArrays A
, where its components are defined in the center of the grid cells. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@tensor
— Macro@tensor(A)
Unpacks the symmetric tensor A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@tensor_center
— Macro@tensor_center(A)
Unpacks the symmetric tensor A
, where its components are defined in the center of the grid cells. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax2D.@velocity
— Macro@velocity(V)
Unpacks the velocity arrays V
from the StokesArrays A
.
JustRelax.JustRelax3D.WENO_advection!
— MethodWENO_advection!(u, Vxi, weno, di, ni, dt)
Perform the advection step of the Weighted Essentially Non-Oscillatory (WENO) scheme for the solution of hyperbolic partial differential equations.
Arguments
u
: field to be advected.Vxi
: velocity field.weno
: structure containing the WENO scheme parameters and temporary variables.di
: grid spacing.ni
: number of grid points.dt
: time step.
Description
The function first calculates the fluxes using the WENO scheme. Then it performs three steps of the WENO scheme. Each step involves calculating the right-hand side of the WENO equation and updating the solution u
. The updating of the solution u
is done using different combinations of the original solution and the temporary solution weno.ut
.
JustRelax.JustRelax3D._heatdiffusion_PT!
— Methodheatdiffusion_PT!(thermal, pt_thermal, K, ρCp, dt, di; iterMax, nout, verbose)
Heat diffusion solver using Pseudo-Transient iterations. Both K
and ρCp
are n-dimensional arrays.
JustRelax.JustRelax3D._heatdiffusion_PT!
— Methodheatdiffusion_PT!(thermal, pt_thermal, rheology, dt, di; iterMax, nout, verbose)
Heat diffusion solver using Pseudo-Transient iterations.
JustRelax.JustRelax3D.allzero
— Methodallzero(x::Vararg{T,N}) where {T,N}
Check if all elements in x
are zero.
Arguments
x::Vararg{T,N}
: The input array.
Returns
Bool
:true
if all elements inx
are zero,false
otherwise.
JustRelax.JustRelax3D.assign!
— Methodassign!(B::AbstractArray{T,N}, A::AbstractArray{T,N}) where {T,N}
Assigns the values of array A
to array B
in parallel.
Arguments
B::AbstractArray{T,N}
: The destination array.A::AbstractArray{T,N}
: The source array.
JustRelax.JustRelax3D.compute_P!
— MethodcomputeP!(P, P0, RP, ∇V, ΔTc, η, rheology::NTuple{N,MaterialParams}, phaseratio::C, dt, r, θ_dτ)
Compute the pressure field P
and the residual RP
for the compressible case. This function introduces thermal stresses after the implementation of Kiss et al. (2023). The temperature difference ΔTc
on the cell center is used to compute this as well as α as the thermal expansivity.
JustRelax.JustRelax3D.compute_buoyancy
— Methodcompute_buoyancy(rheology, args, phase_ratios)
Compute the buoyancy forces based on the given rheology, arguments, and phase ratios.
Arguments
rheology
: The rheology used to compute the buoyancy forces.args
: Additional arguments required by the rheology.phase_ratios
: The ratios of the different phases.
JustRelax.JustRelax3D.compute_buoyancy
— Methodcompute_buoyancy(rheology, args)
Compute the buoyancy forces based on the given rheology and arguments.
Arguments
rheology
: The rheology used to compute the buoyancy forces.args
: Additional arguments required for the computation.
JustRelax.JustRelax3D.compute_buoyancy
— Methodcompute_buoyancy(rheology::MaterialParams, args, phase_ratios)
Compute the buoyancy forces for a given set of material parameters, arguments, and phase ratios.
Arguments
rheology
: The material parameters.args
: The arguments.phase_ratios
: The phase ratios.
JustRelax.JustRelax3D.compute_buoyancy
— Methodcompute_buoyancy(rheology::MaterialParams, args)
Compute the buoyancy forces based on the given rheology parameters and arguments.
Arguments
rheology::MaterialParams
: The material parameters for the rheology.args
: The arguments for the computation.
JustRelax.JustRelax3D.compute_dt
— Methodcompute_dt(S::JustRelax.StokesArrays, args...)
Compute the time step dt
for the simulation.
JustRelax.JustRelax3D.compute_maxloc!
— Methodmaxloc!(B, A; window)
Compute the maximum value of A
in the window = (width_x, width_y, width_z)
and store the result in B
.
JustRelax.JustRelax3D.compute_ρg!
— Methodcompute_ρg!(ρg, rheology, args)
Calculate the buoyance forces ρg
for the given GeoParams.jl rheology
object and correspondent arguments args
.
JustRelax.JustRelax3D.compute_ρg!
— Methodcompute_ρg!(ρg, phase_ratios, rheology, args)
Calculate the buoyance forces ρg
for the given GeoParams.jl rheology
object and correspondent arguments args
. The phase_ratios
are used to compute the density of the composite rheology.
JustRelax.JustRelax3D.continuation_log
— Methodcontinuation_log(x_new, x_old, ν)
Do a continuation step exp((1-ν)*log(x_old) + ν*log(x_new))
with damping parameter ν
JustRelax.JustRelax3D.flow_bcs!
— Methodflow_bcs!(stokes, bcs::VelocityBoundaryConditions)
Apply the prescribed flow boundary conditions bc
on the stokes
JustRelax.JustRelax3D.flow_bcs!
— Methodflow_bcs!(stokes, bcs::DisplacementBoundaryConditions)
Apply the prescribed flow boundary conditions bc
on the stokes
JustRelax.JustRelax3D.fn_ratio
— Methodfn_ratio(fn::F, rheology::NTuple{N, AbstractMaterialParamsStruct}, ratio) where {N, F}
Average the function fn
over the material phases in rheology
using the phase ratios ratio
.
JustRelax.JustRelax3D.interp_Vx_on_Vy!
— Methodinterp_Vx_on_Vy!(Vx_on_Vy, Vx)
Interpolates the values of Vx
onto the grid points of Vy
.
Arguments
Vx_on_Vy::AbstractArray
:Vx
atVy
grid points.Vx::AbstractArray
:Vx
at its staggered grid points.
JustRelax.JustRelax3D.rotate_stress!
— MethodJaumann derivative
τijo += vk * ∂τijo/∂xk - ωij * ∂τkjo + ∂τkjo * ωij
JustRelax.JustRelax3D.take
— Methodtake(fldr::String)
Create folder fldr
if it does not exist.
JustRelax.JustRelax3D.tensor_invariant!
— Methodtensor_invariant!(A::JustRelax.SymmetricTensor)
Compute the tensor invariant of the given symmetric tensor A
.
Arguments
A::JustRelax.SymmetricTensor
: The input symmetric tensor.
JustRelax.JustRelax3D.thermal_bcs!
— Methodthermal_bcs!(T, bcs::TemperatureBoundaryConditions)
Apply the prescribed heat boundary conditions bc
on the T
JustRelax.JustRelax3D.velocity2vertex!
— Methodvelocity2vertex!(Vx_v, Vy_v, Vz_v, Vx, Vy, Vz)
In-place interpolation of the velocity field Vx
, Vy
, Vz
from a staggered grid with ghost nodes onto the pre-allocated Vx_d
, Vy_d
, Vz_d
3D arrays located at the grid vertices.
JustRelax.JustRelax3D.velocity2vertex
— Methodvelocity2vertex(Vx, Vy, Vz)
Interpolate the velocity field Vx
, Vy
, Vz
from a staggered grid with ghost nodes onto the grid vertices.
JustRelax.JustRelax3D.@add
— Macro@add(I, args...)
Add I
to the scalars in args
JustRelax.JustRelax3D.@copy
— Macrocopy(B, A)
convenience macro to copy data from the array A
into array B
JustRelax.JustRelax3D.@displacement
— Macro@displacement(U)
Unpacks the displacement arrays U
from the StokesArrays A
.
JustRelax.JustRelax3D.@idx
— Macro@idx(args...)
Make a linear range from 1
to args[i]
, with i ∈ [1, ..., n]
JustRelax.JustRelax3D.@normal
— Macro@normal(A)
Unpacks the normal components of the symmetric tensor A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@plastic_strain
— Macro@plastic_strain(A)
Unpacks the plastic strain rate tensor ε_pl
from the StokesArrays A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@qT
— Macro@qT(V)
Unpacks the flux arrays qT_i
from the ThermalArrays A
.
JustRelax.JustRelax3D.@qT2
— Macro@qT2(V)
Unpacks the flux arrays qT2_i
from the ThermalArrays A
.
JustRelax.JustRelax3D.@residuals
— Macro@residuals(A)
Unpacks the momentum residuals from A
.
JustRelax.JustRelax3D.@shear
— Macro@shear(A)
Unpacks the shear components of the symmetric tensor A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@strain
— Macro@strain(A)
Unpacks the strain rate tensor ε
from the StokesArrays A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@strain_center
— Macro@strain_center(A)
Unpacks the strain rate tensor ε
from the StokesArrays A
, where its components are defined in the center of the grid cells. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@stress
— Macro@stress(A)
Unpacks the deviatoric stress tensor τ
from the StokesArrays A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@stress_center
— Macro@stress_center(A)
Unpacks the deviatoric stress tensor τ
from the StokesArrays A
, where its components are defined in the center of the grid cells. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@tensor
— Macro@tensor(A)
Unpacks the symmetric tensor A
, where its components are defined in the staggered grid. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@tensor_center
— Macro@tensor_center(A)
Unpacks the symmetric tensor A
, where its components are defined in the center of the grid cells. Shear components are unpack following Voigt's notation.
JustRelax.JustRelax3D.@velocity
— Macro@velocity(V)
Unpacks the velocity arrays V
from the StokesArrays A
.
JustRelax.DataIO.checkpoint_name
— Methodcheckpointing_jld2(dst, stokes, thermal, time, timestep, igg)
Save necessary data in dst
as a jld2 file to restart the model from the state at time
. If run in parallel, the file will be named after the corresponidng rank e.g. checkpoint0000.jld2
and thus can be loaded by the processor while restarting the simulation. If you want to restart your simulation from the checkpoint you can use load() and specify the MPI rank by providing a dollar sign and the rank number.
Example
```julia
checkpointing_jld2(
"path/to/dst",
stokes,
thermal,
t,
igg,
)
```
JustRelax.DataIO.checkpointing_hdf5
— Methodcheckpointing_hdf5(dst, stokes, T, η, time, timestep)
Save necessary data in dst
as and HDF5 file to restart the model from the state at time
JustRelax.DataIO.load_checkpoint_hdf5
— Methodload_checkpoint_hdf5(file_path)
Load the state of the simulation from an .h5 file.
Arguments
file_path
: The path to the .h5 file.
Returns
P
: The loaded state of the pressure variable.T
: The loaded state of the temperature variable.Vx
: The loaded state of the x-component of the velocity variable.Vy
: The loaded state of the y-component of the velocity variable.Vz
: The loaded state of the z-component of the velocity variable.η
: The loaded state of the viscosity variable.t
: The loaded simulation time.dt
: The loaded simulation time.
Example
```julia
Define the path to the .h5 file
file_path = "path/to/your/file.h5"
Use the load_checkpoint function to load the variables from the file
P, T, Vx, Vy, Vz, η, t, dt = load_checkpoint(file_path)
`
JustRelax.DataIO.load_checkpoint_jld2
— Methodload_checkpoint_jld2(file_path)
Load the state of the simulation from a .jld2 file.
Arguments
file_path
: The path to the .jld2 file.
Returns
stokes
: The loaded state of the stokes variable.thermal
: The loaded state of the thermal variable.time
: The loaded simulation time.timestep
: The loaded time step.
JustRelax.DataIO.metadata
— Methodmetadata(src, dst, files...)
Copy files...
, Manifest.toml, and Project.toml from src
to dst
JustRelax.DataIO.save_hdf5
— Methodfunction save_hdf5(dst, fname, data)
Save data
as the fname.h5
HDF5 file in the folder dst
JustRelax.DataIO.save_hdf5
— Methodfunction save_hdf5(fname, data)
Save data
as the fname.h5
HDF5 file