Skip to content

Commit 2cfb7ad

Browse files
authored
Merge pull request #80 from LukasFuchs/main
update list of functions
2 parents ab2d54d + cab587f commit 2cfb7ad

File tree

12 files changed

+112
-52
lines changed

12 files changed

+112
-52
lines changed

docs/src/man/listoffunctions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ Here an overview of all functions:
44
```@autodocs
55
Modules = [
66
GeoModBox,
7+
GeoModBox.Scaling,
78
GeoModBox.HeatEquation.OneD,
9+
GeoModBox.HeatEquation.TwoD,
10+
GeoModBox.AdvectionEquation.OneD,
11+
GeoModBox.AdvectionEquation.TwoD,
12+
GeoModBox.InitialCondition,
13+
GeoModBox.Tracers.OneD,
14+
GeoModBox.Tracers.TwoD,
15+
GeoModBox.MomentumEquation.OneD,
16+
GeoModBox.MomentumEquation.TwoD,
817
]
918
```

src/AdvectionEquation/1Dsolvers.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Dierckx
22

3-
@doc raw"""
4-
RK4O1D
3+
"""
4+
RK4O1D!( x, Δt, vx, xmin, xmax )
55
66
"""
77
function RK4O1D!( x, Δt, vx, xmin, xmax )
@@ -18,8 +18,8 @@ function RK4O1D!( x, Δt, vx, xmin, xmax )
1818

1919
end
2020

21-
@doc raw"""
22-
21+
"""
22+
upwind1D!( A, vx, Δt, Δx )
2323
"""
2424
function upwind1D!( A, vx, Δt, Δx )
2525
Aold = zeros(size(A))
@@ -35,8 +35,8 @@ function upwind1D!( A, vx, Δt, Δx )
3535
end
3636
end
3737

38-
@doc raw"""
39-
38+
"""
39+
lax1D!( A, vx, Δt, Δx )
4040
"""
4141
function lax1D!( A, vx, Δt, Δx )
4242
Aold = zeros(size(A))
@@ -47,8 +47,8 @@ function lax1D!( A, vx, Δt, Δx )
4747
(vx*Δt/2/Δx) * ( Aold[3:end] - Aold[1:end-2])
4848
end
4949

50-
@doc raw"""
51-
50+
"""
51+
slf1D!( A, Aold2, vx, Δt, Δx )
5252
"""
5353
function slf1D!( A, Aold2, vx, Δt, Δx )
5454
# Aold2 is old time step
@@ -62,8 +62,8 @@ function slf1D!( A, Aold2, vx, Δt, Δx )
6262

6363
end
6464

65-
@doc raw"""
66-
65+
"""
66+
semilag1D!( A, xc, vx, Δt, Δx )
6767
"""
6868
function semilag1D!( A, xc, vx, Δt, Δx )
6969
X = zeros(size(xc))

src/AdvectionEquation/2Dsolvers.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# -------------------------------------------------------------------- #
44
using Interpolations
55

6-
@doc raw"""
6+
"""
77
upwindc2D!()
88
99
Using the velocity on the centroids!
@@ -23,7 +23,7 @@ function upwindc2D!(P,P_ex,vxc,vyc,NC,Δt,Δx,Δy)
2323
# ---------------------------------------------------------------- #
2424
end
2525

26-
@doc raw"""
26+
"""
2727
slfc2D!
2828
"""
2929
function slfc2D!(P,P_ex,P_exo,vxc,vyc,NC,Δt,Δx,Δy)
@@ -40,7 +40,7 @@ function slfc2D!(P,P_ex,P_exo,vxc,vyc,NC,Δt,Δx,Δy)
4040
# ---------------------------------------------------------------- #
4141
end
4242

43-
@doc raw"""
43+
"""
4444
semilagc2D!()
4545
"""
4646
function semilagc2D!(P,P_ex,vxc,vyc,vxo,vyo,x,y,Δt)

src/AnalyticalSolutions2D.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Dani_Solution_vec!(type,D,M,x,y,rad,mus_i,NC,NV)
3+
"""
14
function Dani_Solution_vec!(type,D,M,x,y,rad,mus_i,NC,NV)
25
# [ Vx_N,Vx_S,Vx_W,Vx_E,Vy_N,Vy_S,Vy_W,Vy_E,Pa,Vxa,Vya ]
36
# ------------------------------------------------------------------------ #

src/HeatEquation/2Dsolvers.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ExtendableSparse
22

3-
@doc raw"""
4-
ForwardEuler2Dc
3+
"""
4+
ForwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
55
"""
66
function ForwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
77
# Function to solve 2D heat diffusion equation using the explicit finite
@@ -43,8 +43,8 @@ function ForwardEuler2Dc!(D, κ, Δx, Δy, Δt, ρ, cp, NC, BC)
4343
# ------------------------------------------------------------------- #
4444
end
4545

46-
@doc raw"""
47-
ComputeResiduals2D
46+
"""
47+
ComputeResiduals2D!(R, T, T_ex, T0, ∂T, q, ρ, Cp, k, BC, Δ, Δt)
4848
"""
4949
function ComputeResiduals2D!(R, T, T_ex, T0, ∂T, q, ρ, Cp, k, BC, Δ, Δt)
5050
@. T_ex[2:end-1,2:end-1] = T
@@ -59,8 +59,8 @@ function ComputeResiduals2D!(R, T, T_ex, T0, ∂T, q, ρ, Cp, k, BC, Δ, Δt)
5959
@. 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
6060
end
6161

62-
@doc raw"""
63-
AssembleMatrix2D
62+
"""
63+
AssembleMatrix2D(rho, cp, k, BC, Num, nc, Δ, Δt)
6464
"""
6565
function AssembleMatrix2D(rho, cp, k, BC, Num, nc, Δ, Δt)
6666
# Linear system of equation
@@ -111,8 +111,8 @@ function AssembleMatrix2D(rho, cp, k, BC, Num, nc, Δ, Δt)
111111
return flush!(K)
112112
end
113113

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

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

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

469-
@doc raw"""
470-
Poisson2Dc
469+
"""
470+
Poisson2Dc!(D,NC,P,BC,Δ,K,rhs,Num)
471471
"""
472472
function Poisson2Dc!(D,NC,P,BC,Δ,K,rhs,Num)
473473
# Function to solve 2D heat diffusion equation using the explicit finite
@@ -531,8 +531,8 @@ function Poisson2Dc!(D,NC,P,BC,Δ,K,rhs,Num)
531531

532532
end
533533

534-
@doc raw"""
535-
Poisson2D
534+
"""
535+
Poisson2D!( T, Q, kx, ky, Δx, Δy, NC, BC, K, rhs, Num )
536536
"""
537537
function Poisson2D!( T, Q, kx, ky, Δx, Δy, NC, BC, K, rhs, Num )
538538
# --------------------------------------------- #

src/InitialCondition/2Dini.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Base.Threads
22
using GeoModBox
33

4-
@doc raw"""
4+
"""
55
IniTemperature!(type,M,NC,D,x,y;Tb=1000,Ta=1200,Ampl=200,σ=0.05)
66
77
Function to setup an initial temperature condition for a two dimensional
@@ -115,11 +115,8 @@ Possible initial temperature conditions are:
115115
return D
116116
end
117117

118-
@doc raw"""
118+
"""
119119
IniVelocity!(type,D,NC,Δ,M,x,y)
120-
#
121-
#
122-
# ---
123120
"""
124121
@views function IniVelocity!(type,D,BC,NC,NV,Δ,M,x,y;ε=1e-15)
125122
if type==:RigidBody
@@ -197,8 +194,8 @@ end
197194
return D, BC
198195
end
199196

200-
@doc raw"""
201-
IniPhase!
197+
"""
198+
IniPhase!(type,D,M,x,y,NC;phase=0)
202199
"""
203200
@views function IniPhase!(type,D,M,x,y,NC;phase=0)
204201

src/MomentumEquation/1Dsolvers.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ExtendableSparse
22

3-
@doc raw"""
4-
ComputeStokesResiduals1D! ()
3+
"""
4+
ComputeStokesResiduals1D!( D, ∂P∂x, Δy, BC)
55
"""
66
function ComputeStokesResiduals1D!( D, ∂P∂x, Δy, BC)
77
@. D.vₓₑ[2:end-1] = D.vₓ
@@ -18,8 +18,8 @@ function ComputeStokesResiduals1D!( D, ∂P∂x, Δy, BC)
1818
@. D.R = -∂P∂x + D.∂τxy∂y
1919
end
2020

21-
@doc raw"""
22-
AssembleStokesMatrix1D()
21+
"""
22+
AssembleStokesMatrix1D(nc, η, Δy, BC, K)
2323
"""
2424
function AssembleStokesMatrix1D(nc, η, Δy, BC, K)
2525
# Zusammenstellen der Koeffizientenmatrix ------------------------------- #
@@ -49,8 +49,8 @@ function AssembleStokesMatrix1D(nc, η, Δy, BC, K)
4949
return flush!(K)
5050
end
5151

52-
@doc raw"""
53-
Stokes_1D()
52+
"""
53+
Stokes_1D_direct(vₓ,η,Δy,nc,BC,K,rhs)
5454
"""
5555
function Stokes_1D_direct(vₓ,η,Δy,nc,BC,K,rhs)
5656

src/MomentumEquation/2Dsolvers.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using ExtendableSparse
22

3+
"""
4+
Assemblyc(NC, NV, Δ, η, BC, Num)
5+
"""
36
function Assemblyc(NC, NV, Δ, η, BC, Num)
47

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

101+
"""
102+
updaterhsc(NC, NV, Δ, η, ρ, g, BC, Num)
103+
"""
98104
function updaterhsc(NC, NV, Δ, η, ρ, g, BC, Num)
99105

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

154+
"""
155+
Residuals2Dc!(D,BC,ε,τ,divV,Δ,η,g,Fm,FPt)
156+
"""
148157
function Residuals2Dc!(D,BC,ε,τ,divV,Δ,η,g,Fm,FPt)
149158
@. 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])
150159
@. 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])
@@ -166,6 +175,9 @@ function Residuals2Dc!(D,BC,ε,τ,divV,Δ,η,g,Fm,FPt)
166175
@. FPt = divV
167176
end
168177

178+
"""
179+
Assembly(NC, NV, Δ, ηc, ηv, BC, Num)
180+
"""
169181
function Assembly(NC, NV, Δ, ηc, ηv, BC, Num)
170182

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

296+
"""
297+
updaterhs(NC, NV, Δ, ηc, ηv, ρ, g, BC, Num)
298+
"""
284299
function updaterhs(NC, NV, Δ, ηc, ηv, ρ, g, BC, Num)
285300

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

349+
"""
350+
Residuals2D!(D,BC,ε,τ,divV,Δ,ηc,ηv,g,Fm,FPt)
351+
"""
334352
function Residuals2D!(D,BC,ε,τ,divV,Δ,ηc,ηv,g,Fm,FPt)
335353
@. 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])
336354
@. 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])

src/Scaling.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Constants
3+
"""
14
@kwdef mutable struct Constants
25
hsc ::Float64 = 0.0
36
tsc ::Float64 = 0.0
@@ -7,6 +10,9 @@
710
Qsc ::Float64 = 0.0
811
end
912

13+
"""
14+
ScalingConstants!(M,P)
15+
"""
1016
function ScalingConstants!(M,P)
1117

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

2329
end
2430

31+
"""
32+
ScaleParameters!(S,M,Δ,T,P,D)
33+
"""
2534
function ScaleParameters!(S,M,Δ,T,P,D)
2635
# Geometry ---
2736
M.xmin /= S.hsc

src/Structures.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ end
3535
# c ::
3636
# end
3737

38+
"""
39+
Physics()
40+
"""
3841
@kwdef mutable struct Physics
3942
# Physical parameters ---
4043
#
@@ -52,11 +55,17 @@ end
5255
Ra ::Float64 = 1e5 # Rayleigh number
5356
end
5457

58+
"""
59+
GridSpacing()
60+
"""
5561
@kwdef mutable struct GridSpacing
5662
x ::Float64 = 0.0
5763
y ::Float64 = 0.0
5864
end
5965

66+
"""
67+
DataFields()
68+
"""
6069
@kwdef mutable struct DataFields
6170
# Data fields ---
6271
Q ::Matrix{Float64} = zeros(1,1)
@@ -81,6 +90,9 @@ end
8190
Tmean ::Float64 = 0.0
8291
end
8392

93+
"""
94+
TimeParameter()
95+
"""
8496
@kwdef mutable struct TimeParameter
8597
# Time Parameters ---
8698
const year ::Float64 = 365.25*3600*24 # Seconds per year

0 commit comments

Comments
 (0)