Skip to content

Commit a111605

Browse files
authored
Merge pull request #40 from LukasFuchs/main
Finalizing falling block benchmark
2 parents 74183b0 + 33b7dd4 commit a111605

33 files changed

+1325
-192
lines changed

README.md

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The **Geod**ynamic **Mod**elling Tool**Box** is a julia package mainly used for
2525
- Solution of the conductive part -->
2626
------------------
2727
### [Heat Diffusion Equation](./examples/DiffusionEquation/1D/README.md)
28-
  The **GeoModBox** provides different finite difference (**FD**) schemes (e.g., [forward](./src/HeatEquation/ForwardEuler.jl) and [backward](./src/HeatEquation/BackwardEuler.jl) Euler, [Crank-Nicholson approach](./src/HeatEquation/CNA.jl), [ADI](./src/HeatEquation/ADI.jl)) to solve the diffusive part of the time-dependent or steady-state *temperature equation* including radioactive heating, in [1-D](./examples/DiffusionEquation/1D/README.md) and [2-D](./examples/DiffusionEquation/2D/README.md). The solvers are located in [src/HeatEquation](./src/HeatEquation/). So far, only *Dirichlet* and *Neumann* thermal boundary conditions are available. Currently, most of the functions assume constant thermal parameters.
28+
  The **GeoModBox** provides different finite difference (**FD**) schemes (e.g., [forward](./src/HeatEquation/ForwardEuler.jl) and [backward](./src/HeatEquation/BackwardEuler.jl) Euler, [Crank-Nicholson approach](./src/HeatEquation/CNA.jl), [ADI](./src/HeatEquation/ADI.jl)) to solve the *diffusive part* of the time-dependent or steady-state *temperature equation* including radioactive heating, in [1-D](./examples/DiffusionEquation/1D/README.md) and [2-D](./examples/DiffusionEquation/2D/README.md). The solvers are located in [src/HeatEquation](./src/HeatEquation/). So far, only *Dirichlet* and *Neumann* thermal boundary conditions are available. Currently, most of the functions assume constant thermal parameters (except for the 1-D solvers).
2929

3030
The examples of solving the *heat diffusion equation* include, amongst others:
3131
- the determination of an [oceanic](./examples/DiffusionEquation/1D/OceanicGeotherm_1D.jl) and [continental](./examples/DiffusionEquation/1D/ContinentalGeotherm_1D.jl) 1-D geotherm profile,
@@ -44,6 +44,25 @@ All numerical schemes methods can be used in the [thermal convection code]() and
4444
------------------ -->
4545

4646
### [Heat Advection Equation](./examples/AdvectionEquation/README.md)
47+
48+
  To solve the *advective part* of the *temperature equation*, the ```GeoModBox.jl``` provides the following different methods:
49+
- an upwind scheme,
50+
- the staggered -leaped frog scheme,
51+
- a semi-lagrangian advection, and
52+
- passive tracers/markers.
53+
54+
The solvers for a the tracer advection method are located in [./src/Tracers](./src/Tracers/), where the remaining advection routines are located in [./src/AdvectionEquation](./src/AdvectionEquation/). The routines are structured in such a way, that any property, as long as the property is defined on the *centroids* including *ghost nodes* on all boundaries, can be advected with the first **three** advection methods listed above. Using passive tracers, one can so far choose to either advect the temperature or to advect the phases. In case of advecting phases, one can define a certain rheology ($\eta$) or density ($\rho$) associated to each phase. The phase ID is used to interpolate the corresponding property from the tracers to the *centroids*.
55+
56+
  A key aspect for the advection equation is the conservation of the **amplitude** and the **shape** of an anomaly. Depending on the method, numerical diffusion or interpolation effects lead to strong deviations of the initial anomaly. For more details see [here](./examples/AdvectionEquation/README.md). The ```GeoModBox.jl``` contains several [routines](./src/InitialCondition/2Dini.jl) to setup a certain initial anomaly, either for properties defined on their correspondig grid (i.e., temperature, velocity, or phase) or for tracers advecting (so far) a certain temperature or phase. Within the examples and the exercise one can choose differen initial temperature and velocity conditions.
57+
58+
  The examples for a two dimensional advection problem include:
59+
- [a 2-D advection, assuming a constant velocity field (e.g., a rigid body rotation)](./examples/AdvectionEquation/2D_Advection.jl), and
60+
- [a resolution test of the same advection example](./examples/AdvectionEquation/2D_Advection_ResolutionTest.jl).
61+
62+
  The exercises include a:
63+
- [1-D advection of a gaussian or block anomaly](./exercises/06_1D_Advection.ipynb), and
64+
- [a 2-D advection coupled with the solution of the diffusion equation](./exercises/07_2D_Energy_Equation.ipynb).
65+
4766
<!--
4867
- Different properties can be advected!
4968
### Discretization Schemes
@@ -54,9 +73,34 @@ All numerical schemes methods can be used in the [thermal convection code]() and
5473
------------------
5574
------------------
5675
## [Momentum Conservation Equation](./examples/StokesEquation/README.md)
76+
77+
<!--
78+
- Constant viscosity
79+
- Variable viscosity
80+
- Coefficients assembly
81+
- Right-hand side updates
82+
- Direct solution
83+
- Defect correction
84+
-->
85+
86+
------------------
87+
------------------
88+
## Code Structure
89+
90+
### Initial Conditions
91+
92+
<!---
93+
- IniTemperature, IniVelocity, IniPhase,
94+
- Tracer Initialization
95+
- ...
96+
-->
97+
98+
### Scaling
99+
57100
------------------
58101
------------------
59102
## [Benchmarks](./examples/)
103+
60104
### [Gaussian Temperature Diffusion](./examples/DiffusionEquation/2D/Gaussian_Diffusion.jl)
61105
<img src="./examples/DiffusionEquation/2D/Results/Gaussian_Diffusion_CNA_nx_100_ny_100.gif" alt="drawing" width="600"/> <br>
62106
**Figure 1. Gaussian Diffusion.** Time-dependent, diffusive solution of a 2-D Gaussian temperature anomaly using the [Crank-Nicholson approach](./src/HeatEquation/CNA.jl) in comparison to its analytical solution. Top Left: 2-D temperature field of the numerical solution and isotherms lines of the numerical (solid black) and analytical (dashed yellow) solution. Top Right: Total deviation to the analytical solution. Bottom Left: 1-D y-profile along x=0. Bottom Right: Root Mean Square total devation of the temperature over time.
@@ -74,6 +118,23 @@ All numerical schemes methods can be used in the [thermal convection code]() and
74118

75119
**Figure 3. Rigid-Body-Rotation.** Time-dependent solution of a rotating circular temperature anomaly using the **upwind (first)**, **semi-lagrangian (second)**, and **tracer (third)** method. Within a circular area of our model domain the velocity is set to the velocity of a rigid rotation and outside euqal to zero. The temperature is scaled by the maximum temperature of the anomaly.
76120

121+
### [Falling Block](./examples/StokesEquation/2D/FallingBlockBenchmark.jl)
122+
123+
<img src="./examples/StokesEquation/2D/Results/Falling_block_ηr_0.0_tracers.gif" alt="drawing" width="500"/> <br>
124+
125+
**Figure 4. Isoviscous Falling Block.** Time-dependent solution of an isoviscous falling block example. The problem is solved with a solver for variable viscosities. The tracers advect the phase ID, which is used to interpolate the density and viscosity on the centroids and vertices, respectively.
126+
127+
<img src="./examples/StokesEquation/2D/Results/FallingBlock_SinkingVeloc_tracers.png" alt="drawing" width="500"/> <br>
128+
129+
**Figure 5. Falling Block Sinking Velocity.** Sinking velocity of the block with respect to the viscosity ratio $\eta_r$ at the initial condition.
130+
131+
<img src="./examples/StokesEquation/2D/Results/FallingBlock_FinalStage_tracers.png" alt="drawing" width="500"/> <br>
132+
133+
**Figure 6. Falling Block Benchmark.** Final tracers distribution for specific cases with $\eta_r \ge 0$.
134+
135+
------------------
136+
------------------
137+
77138
<!--
78139
- Blanckenbach
79140
- Channel Flow
@@ -83,6 +144,3 @@ All numerical schemes methods can be used in the [thermal convection code]() and
83144
- Rigid Body Rotation, check!
84145
- Viscous Inclusion
85146
-->
86-
87-
------------------
88-
------------------

examples/AdvectionEquation/2D_Advection.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ using GeoModBox.InitialCondition
2727
using Base.Threads
2828
using Printf
2929

30-
@doc raw"""
31-
Advection_2D()
32-
33-
...
34-
35-
"""
3630
function Advection_2D()
3731

3832
@printf("Running on %d thread(s)\n", nthreads())
@@ -175,7 +169,7 @@ if FD.Method.Adv==:tracers
175169
wt_th = [similar(D.wt) for _ = 1:nthreads()], # per thread
176170
)
177171
MPC = merge(MPC,MPC1)
178-
Ma = IniTracer2D(Aparam,nmx,nmy,Δ,M,NC,noise)
172+
Ma = IniTracer2D(Aparam,nmx,nmy,Δ,M,NC,noise,0,0)
179173
# RK4 weights ---
180174
rkw = 1.0/6.0*[1.0 2.0 2.0 1.0] # for averaging
181175
rkv = 1.0/2.0*[1.0 1.0 2.0 2.0] # for time stepping
@@ -242,7 +236,7 @@ for i=2:nt
242236
CountMPC(Ma,nmark,MPC,M,x,y,Δ,NC,i)
243237

244238
# Interpolate temperature from tracers to grid ---
245-
Markers2Cells(Ma,nmark,MPC.PG_th,D.T,MPC.wt_th,D.wt,x,y,Δ,Aparam)
239+
Markers2Cells(Ma,nmark,MPC.PG_th,D.T,MPC.wt_th,D.wt,x,y,Δ,Aparam,0)
246240
D.T_ex[2:end-1,2:end-1] .= D.T
247241
end
248242

examples/AdvectionEquation/2D_Advection_ResolutionTest.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ for m = 1:ns # Loop over advection schemes
167167
wt_th = [similar(D.wt) for _ = 1:nthreads()], # per thread
168168
)
169169
MPC = merge(MPC,MPC1)
170-
Ma = IniTracer2D(Aparam,nmx,nmy,Δ,M,NC,noise)
170+
Ma = IniTracer2D(Aparam,nmx,nmy,Δ,M,NC,noise,Ini.p,phase)
171171
# RK4 weights ---
172172
rkw = 1.0/6.0*[1.0 2.0 2.0 1.0] # for averaging
173173
rkv = 1.0/2.0*[1.0 1.0 2.0 2.0] # for time stepping
@@ -233,7 +233,7 @@ for m = 1:ns # Loop over advection schemes
233233
CountMPC(Ma,nmark,MPC,M,x,y,Δ,NC,i)
234234

235235
# Interpolate temperature from tracers to grid ---
236-
Markers2Cells(Ma,nmark,MPC.PG_th,D.T,MPC.wt_th,D.wt,x,y,Δ,Aparam)
236+
Markers2Cells(Ma,nmark,MPC.PG_th,D.T,MPC.wt_th,D.wt,x,y,Δ,Aparam,0)
237237
end
238238

239239
display(string("ΔT = ",((maximum(filter(!isnan,D.T))-D.Tmax[1])/D.Tmax[1])*100))
-2.64 KB
Loading
0 Bytes
Binary file not shown.

examples/StokesEquation/2D/Fallin_block_var_eta.jl

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)