Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/src/man/listoffunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Here an overview of all functions:
```@autodocs
Modules = [
GeoModBox,
GeoModBox.Scaling,
GeoModBox.HeatEquation.OneD,
GeoModBox.HeatEquation.TwoD,
GeoModBox.AdvectionEquation.OneD,
GeoModBox.AdvectionEquation.TwoD,
GeoModBox.InitialCondition,
GeoModBox.Tracers.OneD,
GeoModBox.Tracers.TwoD,
GeoModBox.MomentumEquation.OneD,
GeoModBox.MomentumEquation.TwoD,
]
```
20 changes: 10 additions & 10 deletions src/AdvectionEquation/1Dsolvers.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Dierckx

@doc raw"""
RK4O1D
"""
RK4O1D!( x, Δt, vx, xmin, xmax )

"""
function RK4O1D!( x, Δt, vx, xmin, xmax )
Expand All @@ -18,8 +18,8 @@ function RK4O1D!( x, Δt, vx, xmin, xmax )

end

@doc raw"""

"""
upwind1D!( A, vx, Δt, Δx )
"""
function upwind1D!( A, vx, Δt, Δx )
Aold = zeros(size(A))
Expand All @@ -35,8 +35,8 @@ function upwind1D!( A, vx, Δt, Δx )
end
end

@doc raw"""

"""
lax1D!( A, vx, Δt, Δx )
"""
function lax1D!( A, vx, Δt, Δx )
Aold = zeros(size(A))
Expand All @@ -47,8 +47,8 @@ function lax1D!( A, vx, Δt, Δx )
(vx*Δt/2/Δx) * ( Aold[3:end] - Aold[1:end-2])
end

@doc raw"""

"""
slf1D!( A, Aold2, vx, Δt, Δx )
"""
function slf1D!( A, Aold2, vx, Δt, Δx )
# Aold2 is old time step
Expand All @@ -62,8 +62,8 @@ function slf1D!( A, Aold2, vx, Δt, Δx )

end

@doc raw"""

"""
semilag1D!( A, xc, vx, Δt, Δx )
"""
function semilag1D!( A, xc, vx, Δt, Δx )
X = zeros(size(xc))
Expand Down
6 changes: 3 additions & 3 deletions src/AdvectionEquation/2Dsolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# -------------------------------------------------------------------- #
using Interpolations

@doc raw"""
"""
upwindc2D!()

Using the velocity on the centroids!
Expand All @@ -23,7 +23,7 @@ function upwindc2D!(P,P_ex,vxc,vyc,NC,Δt,Δx,Δy)
# ---------------------------------------------------------------- #
end

@doc raw"""
"""
slfc2D!
"""
function slfc2D!(P,P_ex,P_exo,vxc,vyc,NC,Δt,Δx,Δy)
Expand All @@ -40,7 +40,7 @@ function slfc2D!(P,P_ex,P_exo,vxc,vyc,NC,Δt,Δx,Δy)
# ---------------------------------------------------------------- #
end

@doc raw"""
"""
semilagc2D!()
"""
function semilagc2D!(P,P_ex,vxc,vyc,vxo,vyo,x,y,Δt)
Expand Down
3 changes: 3 additions & 0 deletions src/AnalyticalSolutions2D.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Dani_Solution_vec!(type,D,M,x,y,rad,mus_i,NC,NV)
"""
function Dani_Solution_vec!(type,D,M,x,y,rad,mus_i,NC,NV)
# [ Vx_N,Vx_S,Vx_W,Vx_E,Vy_N,Vy_S,Vy_W,Vy_E,Pa,Vxa,Vya ]
# ------------------------------------------------------------------------ #
Expand Down
32 changes: 16 additions & 16 deletions src/HeatEquation/2Dsolvers.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ExtendableSparse

@doc raw"""
ForwardEuler2Dc
"""
ForwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
"""
function ForwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
# Function to solve 2D heat diffusion equation using the explicit finite
Expand Down Expand Up @@ -43,8 +43,8 @@ function ForwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
# ------------------------------------------------------------------- #
end

@doc raw"""
ComputeResiduals2D
"""
ComputeResiduals2D!(R, T, T_ex, T0, ∂T, q, ρ, Cp, k, BC, Δ, Δt)
"""
function ComputeResiduals2D!(R, T, T_ex, T0, ∂T, q, ρ, Cp, k, BC, Δ, Δt)
@. T_ex[2:end-1,2:end-1] = T
Expand All @@ -59,8 +59,8 @@ function ComputeResiduals2D!(R, T, T_ex, T0, ∂T, q, ρ, Cp, k, BC, Δ, Δt)
@. R = ρ*Cp*(T - T0)/Δt + (q.x[2:end,:] - q.x[1:end-1,:])/Δ.x + (q.y[:,2:end] - q.y[:,1:end-1])/Δ.y
end

@doc raw"""
AssembleMatrix2D
"""
AssembleMatrix2D(rho, cp, k, BC, Num, nc, Δ, Δt)
"""
function AssembleMatrix2D(rho, cp, k, BC, Num, nc, Δ, Δt)
# Linear system of equation
Expand Down Expand Up @@ -111,8 +111,8 @@ function AssembleMatrix2D(rho, cp, k, BC, Num, nc, Δ, Δt)
return flush!(K)
end

@doc raw"""
BackwardEuler2Dc
"""
BackwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC, rhs, K, Num)
"""
function BackwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC, rhs, K, Num)
# dT/dt = kappa*d^2T_ij/dx_i^2 + Q_ij/rho/cp
Expand Down Expand Up @@ -178,8 +178,8 @@ D.T_ex[2:end-1,2:end-1] .= D.T
# ------------------------------------------------------------------- #
end

@doc raw"""
CNA2Dc
"""
CNA2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC, rhs, K1, K2, Num)
"""
function CNA2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC, rhs, K1, K2, Num)
# dT/dt = kappa*d^2T_ij/dx_i^2 + Q_ij/rho/cp
Expand Down Expand Up @@ -276,8 +276,8 @@ D.T_ex[2:end-1,2:end-1] .= D.T
# ------------------------------------------------------------------- #
end

@doc raw"""
ADI2Dc
"""
ADI2Dc!(T, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
"""
function ADI2Dc!(T, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
# Function to solve 2D heat diffusion equation using the alternating direct
Expand Down Expand Up @@ -466,8 +466,8 @@ function ADI2Dc!(T, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
T.T_ex[2:end-1,2:end-1] .= T.T
end

@doc raw"""
Poisson2Dc
"""
Poisson2Dc!(D,NC,P,BC,Δ,K,rhs,Num)
"""
function Poisson2Dc!(D,NC,P,BC,Δ,K,rhs,Num)
# Function to solve 2D heat diffusion equation using the explicit finite
Expand Down Expand Up @@ -531,8 +531,8 @@ function Poisson2Dc!(D,NC,P,BC,Δ,K,rhs,Num)

end

@doc raw"""
Poisson2D
"""
Poisson2D!( T, Q, kx, ky, Δx, Δy, NC, BC, K, rhs, Num )
"""
function Poisson2D!( T, Q, kx, ky, Δx, Δy, NC, BC, K, rhs, Num )
# --------------------------------------------- #
Expand Down
11 changes: 4 additions & 7 deletions src/InitialCondition/2Dini.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Base.Threads
using GeoModBox

@doc raw"""
"""
IniTemperature!(type,M,NC,D,x,y;Tb=1000,Ta=1200,Ampl=200,σ=0.05)

Function to setup an initial temperature condition for a two dimensional
Expand Down Expand Up @@ -115,11 +115,8 @@ Possible initial temperature conditions are:
return D
end

@doc raw"""
"""
IniVelocity!(type,D,NC,Δ,M,x,y)
#
#
# ---
"""
@views function IniVelocity!(type,D,BC,NC,NV,Δ,M,x,y;ε=1e-15)
if type==:RigidBody
Expand Down Expand Up @@ -197,8 +194,8 @@ end
return D, BC
end

@doc raw"""
IniPhase!
"""
IniPhase!(type,D,M,x,y,NC;phase=0)
"""
@views function IniPhase!(type,D,M,x,y,NC;phase=0)

Expand Down
12 changes: 6 additions & 6 deletions src/MomentumEquation/1Dsolvers.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ExtendableSparse

@doc raw"""
ComputeStokesResiduals1D! ()
"""
ComputeStokesResiduals1D!( D, ∂P∂x, Δy, BC)
"""
function ComputeStokesResiduals1D!( D, ∂P∂x, Δy, BC)
@. D.vₓₑ[2:end-1] = D.vₓ
Expand All @@ -18,8 +18,8 @@ function ComputeStokesResiduals1D!( D, ∂P∂x, Δy, BC)
@. D.R = -∂P∂x + D.∂τxy∂y
end

@doc raw"""
AssembleStokesMatrix1D()
"""
AssembleStokesMatrix1D(nc, η, Δy, BC, K)
"""
function AssembleStokesMatrix1D(nc, η, Δy, BC, K)
# Zusammenstellen der Koeffizientenmatrix ------------------------------- #
Expand Down Expand Up @@ -49,8 +49,8 @@ function AssembleStokesMatrix1D(nc, η, Δy, BC, K)
return flush!(K)
end

@doc raw"""
Stokes_1D()
"""
Stokes_1D_direct(vₓ,η,Δy,nc,BC,K,rhs)
"""
function Stokes_1D_direct(vₓ,η,Δy,nc,BC,K,rhs)

Expand Down
18 changes: 18 additions & 0 deletions src/MomentumEquation/2Dsolvers.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using ExtendableSparse

"""
Assemblyc(NC, NV, Δ, η, BC, Num)
"""
function Assemblyc(NC, NV, Δ, η, BC, Num)

# Linear system of equation ---
Expand Down Expand Up @@ -95,6 +98,9 @@ function Assemblyc(NC, NV, Δ, η, BC, Num)
return flush!(K)
end

"""
updaterhsc(NC, NV, Δ, η, ρ, g, BC, Num)
"""
function updaterhsc(NC, NV, Δ, η, ρ, g, BC, Num)

rhs = zeros(maximum(Num.Pt)) # Right-hand Side
Expand Down Expand Up @@ -145,6 +151,9 @@ function updaterhsc(NC, NV, Δ, η, ρ, g, BC, Num)
return rhs
end

"""
Residuals2Dc!(D,BC,ε,τ,divV,Δ,η,g,Fm,FPt)
"""
function Residuals2Dc!(D,BC,ε,τ,divV,Δ,η,g,Fm,FPt)
@. D.vx[:,1] = (BC.type.S==:freeslip)*D.vx[:,2] + (BC.type.S==:noslip||BC.type.S==:const)*(2*BC.val.S - D.vx[:,2])
@. D.vx[:,end] = (BC.type.N==:freeslip)*D.vx[:,end-1] + (BC.type.N==:noslip||BC.type.N==:const)*(2*BC.val.N - D.vx[:,end-1])
Expand All @@ -166,6 +175,9 @@ function Residuals2Dc!(D,BC,ε,τ,divV,Δ,η,g,Fm,FPt)
@. FPt = divV
end

"""
Assembly(NC, NV, Δ, ηc, ηv, BC, Num)
"""
function Assembly(NC, NV, Δ, ηc, ηv, BC, Num)

# Linear system of equation ---
Expand Down Expand Up @@ -281,6 +293,9 @@ function Assembly(NC, NV, Δ, ηc, ηv, BC, Num)
return flush!(K)
end

"""
updaterhs(NC, NV, Δ, ηc, ηv, ρ, g, BC, Num)
"""
function updaterhs(NC, NV, Δ, ηc, ηv, ρ, g, BC, Num)

rhs = zeros(maximum(Num.Pt)) # Right-hand Side
Expand Down Expand Up @@ -331,6 +346,9 @@ function updaterhs(NC, NV, Δ, ηc, ηv, ρ, g, BC, Num)
return rhs
end

"""
Residuals2D!(D,BC,ε,τ,divV,Δ,ηc,ηv,g,Fm,FPt)
"""
function Residuals2D!(D,BC,ε,τ,divV,Δ,ηc,ηv,g,Fm,FPt)
@. D.vx[:,1] = (BC.type.S==:freeslip)*D.vx[:,2] + (BC.type.S==:noslip||BC.type.S==:const)*(2*BC.val.S - D.vx[:,2])
@. D.vx[:,end] = (BC.type.N==:freeslip)*D.vx[:,end-1] + (BC.type.N==:noslip||BC.type.N==:const)*(2*BC.val.N - D.vx[:,end-1])
Expand Down
9 changes: 9 additions & 0 deletions src/Scaling.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Constants
"""
@kwdef mutable struct Constants
hsc ::Float64 = 0.0
tsc ::Float64 = 0.0
Expand All @@ -7,6 +10,9 @@
Qsc ::Float64 = 0.0
end

"""
ScalingConstants!(M,P)
"""
function ScalingConstants!(M,P)

S = Constants()
Expand All @@ -22,6 +28,9 @@ function ScalingConstants!(M,P)

end

"""
ScaleParameters!(S,M,Δ,T,P,D)
"""
function ScaleParameters!(S,M,Δ,T,P,D)
# Geometry ---
M.xmin /= S.hsc
Expand Down
12 changes: 12 additions & 0 deletions src/Structures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ end
# c ::
# end

"""
Physics()
"""
@kwdef mutable struct Physics
# Physical parameters ---
#
Expand All @@ -52,11 +55,17 @@ end
Ra ::Float64 = 1e5 # Rayleigh number
end

"""
GridSpacing()
"""
@kwdef mutable struct GridSpacing
x ::Float64 = 0.0
y ::Float64 = 0.0
end

"""
DataFields()
"""
@kwdef mutable struct DataFields
# Data fields ---
Q ::Matrix{Float64} = zeros(1,1)
Expand All @@ -81,6 +90,9 @@ end
Tmean ::Float64 = 0.0
end

"""
TimeParameter()
"""
@kwdef mutable struct TimeParameter
# Time Parameters ---
const year ::Float64 = 365.25*3600*24 # Seconds per year
Expand Down
6 changes: 6 additions & 0 deletions src/Tracers/1Dsolvers.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Itp1D_Centers2Markers!( Tm, xm, Tc, xc, Δx, xmin )
"""
function Itp1D_Centers2Markers!( Tm, xm, Tc, xc, Δx, xmin )
# Biliniear
for i = 1:length(xm)
Expand All @@ -7,6 +10,9 @@ function Itp1D_Centers2Markers!( Tm, xm, Tc, xc, Δx, xmin )
end
end

"""
Itp1D_Markers2Centers!( Tc, xc, Tm, xm, dx, xmin )
"""
function Itp1D_Markers2Centers!( Tc, xc, Tm, xm, dx, xmin )
Tc .= 0.0
Wc = zero(Tc)
Expand Down
Loading
Loading