Functions
Defining the Volume
Mire.Ellipsoid
— TypeEllipsoid{T<:Number} <: Volume{T}
Volume
type Ellipsoid
. Create by calling Ellipsoid(a,b,c)
, with a,b,c
the semi-axes. a,b,c
can be of any Number
type.
Examples: Ellipsoid(1.1,1.0,0.9)
is a Ellipsoid{Float64}
, Ellipsoid(1//1,1//2,1//5)
is a Ellispoid{Rational{Int64}}
.
Mire.Sphere
— TypeSphere{T<:Number} <: Volume{T}
Volume
type Sphere
. Create by calling Sphere{T}()
, with T
any Number
type. Default: Sphere(T)
gives a Sphere{Float64}()
. For other types use, e.g. Sphere{Rational{BigInt}}()
.
Vector bases
Mire.LebovitzBasis
— TypeLebovitzBasis{T<:Number,Vol<:Volume{T}} <: VectorBasis{T,Vol}
Basis of 3-D vector field, so that $\mathbf{u}\cdot\mathbf{n} = 0$ at $\partial\mathcal{V}$ and $\nabla\cdot\mathbf{u} = 0$ after Lebovitz (1989).
Mire.QGBasis
— TypeQGBasis{T<:Number,Vol<:Volume{T}} <: VectorBasis{T,Vol}
Basis of QG vector field (Gerick et al., 2020), so that $\mathbf{u}=\nabla(h^3x^ny^m)\times\nabla(z/h)$.
Mire.QGIMBasis
— TypeQGIMBasis{T<:Number,Vol<:Sphere{T}} <: VectorBasis{T,Vol}
Basis of complex QG inertial modes (Maffei et al., 2017). This basis is orthonormal.
Mire.QGRIMBasis
— TypeQGRIMBasis{T<:Number,Vol<:Sphere{T}} <: VectorBasis{T,Vol}
Real basis similar to the QG inertial modes (Maffei et al., 2017). They are not the solutions to the QG inertial mode equation and they are not orthogonal.
Mire.ConductingMFBasis
— TypeConductingMFBasis{T<:Number,Vol<:Volume{T}} <: VectorBasis{T,Vol}
Basis of 3-D magnetic field, so that $\mathbf{B}\cdot\mathbf{n} = 0$ at $\partial\mathcal{V}$ and $\nabla\cdot\mathbf{B} = 0$ after Lebovitz (1989). It is exactly the same as LebovitzBasis
.
Mire.InsulatingMFBasis
— TypeInsulatingMFBasis{T<:Number,Vol<:Sphere{T}} <: VectorBasis{T,Vol}
Basis of insulating magnetic fields following Gerick et al. (2021). For now, only for Vol<:Sphere{T}
, i.e. in a spherical domain.
Setting up the problem
Mire.HDProblem
— TypeHDProblem{T<:Number,Vol<:Volume{T}} <: MireProblem{T, Vol}
Defines hydrodynamic problem.
Example:
N = 5
Ω = [0,0,1.0]
V = Ellipsoid(1.1,1.0,0.9)
problem = HDProblem(N,V,Ω,LebovitzBasis)
Mire.MHDProblem
— TypeMHDProblem{T<:Number,Vol<:Volume{T}} <: MireProblem{T,Vol}
Defines magnetohydrodynamic problem.
Example for a hybrid QG model with 3-D magnetic field with conducting boundary condition and QG velocities:
N = 5
Ω = [0,0,1.0]
a,b,c = 1.1,1.0,0.9
V = Ellipsoid(a,b,c)
B0 = [-y/b^2,x/a^2,0] #Malkus field
problem = MHDProblem(N,V,Ω,B0,QGBasis,ConductingMFBasis)
Mire.assemble!
— Functionassemble!(P::HDProblem{T,V}; threads=false, verbose=false, kwargs...) where {T,V}
Assembles the matrices P.LHS
and P.RHS
, i.e. projecting the velocity basis P.vbasis
on the inertial acceleration and Coriolis force.
assemble!(P::MHDProblem{T,V}) where {T,V}
Assembles the matrices P.LHS
and P.RHS
, i.e. projecting the velocity and magnetic field bases on the inertial acceleration, Coriolis force, Lorentz force and mgnetic advection.
Low level functions
Functions for low level control of the problem.
Mire.projectforce
— Functionprojectforce(vs_i, vs_j, cmat, forcefun, args...; kwargs...)
Project basis vs_i
onto the forcing forcefun(vs_j, args...)
using precached monomials in cmat
.
Mire.projectforce!
— Functionprojectforce!(i0, j0, itemps, jtemps, valtemps, cmat, vs_i, vs_j, forcefun, args...; verbose=false, thresh=10eps())
Project basis vs_i
onto the forcing forcefun(vs_j, args...)
. Pushes indices and values of non-zero entries into the itemps
,jtemps
and valtems
arrays. i0
and j0
are the origin of indices (useful for combining multiple equations, should be 0 to have no shift in indices). See projectforce
to construct a sparse array from the indices and values.
Mire.projectforcet!
— Functionprojectforcet!(args...)
Multithreaded version of projectforce!
. Input has to be adapted to number of threads!
Mire.inner_product
— Functioninner_product(u, v, cmat)
Inner product in an ellipsoidal volume $\int \mathbf{u}\cdot \mathbf{v} dV$, using precached monomial integrations in cmat
.
inner_product(u, v, a, b, c)
Inner product in an ellipsoidal volume $\int \mathbf{u}\cdot \mathbf{v} dV$.
The factor $\pi$ is removed in the integration to be able to use exact integration using Rational
. Remember to reintroduce it when the actual value of the integration is needed!