Skip to content

Commit e52ceb7

Browse files
committed
Merge branch 'Corrections'
2 parents 011668d + a87221e commit e52ceb7

18 files changed

+91
-42
lines changed
-59.7 KB
Binary file not shown.
64 KB
Loading

docs/src/man/examples/AdvectionRestest2D.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ end
419419
# --------------------------------------------------------------------- #
420420
```
421421

422-
<!-- ![AdvResFinal](../../assets/2D_advection_circle_RigidBody_ResTest.png) -->
423-
![AdvResFinalA](../../../../examples/AdvectionEquation/Results/2D_advection_circle_RigidBody_ResTest.png)
422+
![AdvResFinal](../../assets/2D_advection_circle_RigidBody_ResTest.png)
424423

425424
**Figure 2. Advection Resolution Test.**
426425
Deviation, maximum, and mean temperature for each advection scheme across increasing grid resolutions.

docs/src/man/examples/RTI_growth_rate.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
# [RTI - Growth Rate Benchmark](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/examples/StokesEquation/2D/RTI_GrowthRate.jl)
22

3-
This script performs a benchmark for the growth rate of a Rayleigh–Taylor instability, following Gerya (2009). The benchmark is based on the analytical solution by Ramberg (1968) and is used to assess the accuracy of the velocity field in a purely gravity-driven flow.
3+
This script benchmarks the **growth rate of a Rayleigh–Taylor instability**, following *Gerya (2009)*.
4+
The benchmark is based on the analytical solution by *Ramberg (1968)* and is used to evaluate the accuracy of the velocity field in a purely gravity-driven flow.
45

5-
While small-amplitude perturbations can be analyzed theoretically—facilitated by the use of tracers and bilinear interpolation of density onto centroids—a relatively large perturbation amplitude is employed here to accommodate practical implementation constraints.
6+
The script calculates the **diapiric growth rate** at the tip of the perturbation for different **perturbation amplitudes** ($\delta A$), **wavelengths** ($\lambda$), and **viscosity ratios** ($\eta_r$).
7+
The numerical solution is plotted alongside the analytical one, which is arbitrarily scaled by certain constants for visualization purposes, following *Gerya (2009)*.
8+
9+
The amplitude of the cosine perturbation is defined as:
10+
11+
$\begin{equation}
12+
\delta A = \cos\left( 2\pi \frac{x_m - L/2}{\lambda} \right),
13+
\end{equation}$
14+
15+
where $x_m$ is the x-coordinate of the marker, and $L$ is the length of the model domain.
16+
The perturbation is applied to the tracers by adding the perturbation amplitude to the y-coordinate of an initially equally distributed or randomly perturbed tracer field.
17+
18+
Using a **bilinear interpolation scheme** to map tracer properties onto the regular numerical grid, one can test how accurately the Stokes solver reproduces the analytical growth rate of the diapiric instability.
19+
However, care must be taken when defining the initial tracer positions or when averaging tracer properties onto the grid to avoid numerical artifacts.
620

721
---
822

@@ -34,7 +48,7 @@ Pl = (
3448
)
3549
```
3650

37-
The parameters for an initial cosinusoidal tracer perturbation are defined for a two-layer model. For benchmarking purposes, a range of wavelengths is specified.
51+
The parameters for an initial cosinusoidal tracer perturbation are defined for a two-layer model. For benchmarking purposes, a range of wavelengths is specified. One can define, if the density is interpolated from the tracers to the centroids or the vertices.
3852

3953
```Julia
4054
# Define Initial Condition ========================================== #
@@ -480,6 +494,6 @@ end
480494

481495
**Figure 2. RTI Growth Rate.** Growth rate of an initial cosinusoidal perturbation in a two-layer system across various wavelengths $\lambda$. The growth rate is arbitrarily scaled using $b_1$ and $b_2$ for visualization, following the approach of Gerya (2000). The lines are the analytical solutions for different viscosity ratios $\eta_r$ and the markers show the corresponding numerical results for models with decreasing amplitudes (black - scaled by 15, red - scaled by 150, yellow - scaled by 1500). The rising velocity is numerically calculated following the approach shown in Figure 1.
482496

483-
<!-- ![RTI_Growth_Rate_Res_test](../../assets/RTI_Growth_Rate_Res_Test.png)
497+
![RTI_Growth_Rate_Res_test](../../assets/RTI_Growth_Rate_Res_Test_const_NM_arith.png)
484498

485-
**Figure 3. RTI Resolution Test.** Resolution test for the RTI growth rate using a fixed layer thickness (1500 km), a fixed wavelength $\lambda = 4000 \text{ km}$ and fixed numerical resolution of 50x50 centroids for different numbers of markers per cell $\left(nm_x,nm_y\right)$, different perturbation amplitudes $\left(\delta{A}\right)$ (colored markers), different viscosity ratios $\eta_r$, and without (top row) and with (bottom row) additional noise ontop of the initial marker position (before assigning the layer phases). -->
499+
**Figure 3. RTI Resolution Test.** Resolution test for the RTI growth rate using a fixed layer thickness (1500 km), a fixed wavelength $\lambda = 4000 \text{ km}$ and fixed number of markers per cell (5x5) for different horizontal and vertical grid resolutions $\left(nc_x,nc_y\right)$, different perturbation amplitudes $\left(\delta{A}\right)$ (colored markers), different viscosity ratios $\eta_r$, and without (top row) and with (bottom row) additional noise ontop of the initial marker position (before assigning the layer phases). The viscosity is interpolate from the tracers to the centroids and the vertices using an arithmetic mean.

examples/StokesEquation/2D/RTI_Growth_Rate_Res_Test.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function RTI_GrowthRate()
1313
@timeit to "Ini" begin
1414
plot_fields =:no
1515
save_fig = 1
16+
avgm =:arith # Averaging Method for η - default arith
1617
Pl = (
1718
qinc = 5,
1819
qsc = 100*(60*60*24*365.25)*5e1,
@@ -259,7 +260,7 @@ function RTI_GrowthRate()
259260
end
260261
end
261262
# Interpolate Viscosity ---
262-
Markers2Cells(Ma,nmark,MAVG.PC_th,D.ηce,MAVG.wte_th,D.wte,x,y,Δ,Aparam,η)
263+
Markers2Cells(Ma,nmark,MAVG.PC_th,D.ηce,MAVG.wte_th,D.wte,x,y,Δ,Aparam,η;avgm)
263264
D.ηc .= D.ηce[2:end-1,2:end-1]
264265
Markers2Vertices(Ma,nmark,MAVG.PV_th,D.ηv,MAVG.wtv_th,D.wtv,x,y,Δ,Aparam,η)
265266
end
@@ -331,8 +332,6 @@ function RTI_GrowthRate()
331332
end
332333

333334
if l == 1 && k == 1 && n == 1 && o == 1
334-
# @show l,k,n,o
335-
# @show (n-1)*size(ηᵣ,2)+o
336335
scatter!(q,(1/(maximum(nm)+2)/(maximum(nm)+2),
337336
PP.Kₐ[o]),
338337
ms=ms[1],markershape=:circle,
@@ -342,8 +341,8 @@ function RTI_GrowthRate()
342341
title=string("ηᵣ = ",ηᵣ[o]),
343342
layout=(size(addnoise,2),size(ηᵣ,2)),
344343
subplot=((n-1)*size(ηᵣ,2)+o),
345-
xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
346-
ylims=(PP.Kₐ[o]-0.5*PP.Kₐ[o], PP.Kₐ[o]+0.5*PP.Kₐ[o])
344+
# xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
345+
# ylims=(PP.Kₐ[o]-0.5*PP.Kₐ[o], PP.Kₐ[o]+0.5*PP.Kₐ[o])
347346
)
348347
elseif l == 1 && k == 1
349348
scatter!(q,(1/(maximum(nm)+2)/(maximum(nm)+2),
@@ -354,8 +353,8 @@ function RTI_GrowthRate()
354353
title=string("ηᵣ = ",ηᵣ[o]),
355354
layout=(size(addnoise,2),size(ηᵣ,2)),
356355
subplot=((n-1)*size(ηᵣ,2)+o),
357-
xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
358-
ylims=(PP.Kₐ[o]-0.5*PP.Kₐ[o], PP.Kₐ[o]+0.5*PP.Kₐ[o])
356+
# xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
357+
# ylims=(PP.Kₐ[o]-0.5*PP.Kₐ[o], PP.Kₐ[o]+0.5*PP.Kₐ[o])
359358
)
360359
end
361360
if plot_fields==:yes
@@ -425,7 +424,7 @@ function RTI_GrowthRate()
425424
end # Loop addnoise - n
426425
end
427426
if save_fig == 1
428-
savefig(q,string("./examples/StokesEquation/2D/Results/RTI_Growth_Rate_Res_Test.png"))
427+
savefig(q,string("./examples/StokesEquation/2D/Results/RTI_Growth_Rate_Res_Test_",avgm,".png"))
429428
else
430429
display(q)
431430
end

examples/StokesEquation/2D/RTI_Growth_Rate_Res_Test_2.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function RTI_GrowthRate()
1313
@timeit to "Ini" begin
1414
plot_fields =:no
1515
save_fig = 1
16+
avgm =:geom # Averaging Method for η - default arith
1617
Pl = (
1718
qinc = 5,
1819
qsc = 100*(60*60*24*365.25)*5e1,
@@ -261,7 +262,7 @@ function RTI_GrowthRate()
261262
end
262263
end
263264
# Interpolate Viscosity ---
264-
Markers2Cells(Ma,nmark,MAVG.PC_th,D.ηce,MAVG.wte_th,D.wte,x,y,Δ,Aparam,η)
265+
Markers2Cells(Ma,nmark,MAVG.PC_th,D.ηce,MAVG.wte_th,D.wte,x,y,Δ,Aparam,η;avgm)
265266
D.ηc .= D.ηce[2:end-1,2:end-1]
266267
Markers2Vertices(Ma,nmark,MAVG.PV_th,D.ηv,MAVG.wtv_th,D.wtv,x,y,Δ,Aparam,η)
267268
end
@@ -383,8 +384,8 @@ function RTI_GrowthRate()
383384
xlabel="1/nmx/nmy",ylabel="ε [ % ]",
384385
xscale=:log10, yscale=:log10,
385386
title=string("ηᵣ = ",ηᵣ[o]),
386-
xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
387-
ylims=(1e-1, 1e2),
387+
# xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
388+
# ylims=(1e-1, 1e2),
388389
layout=(size(addnoise,2),size(ηᵣ,2)),
389390
subplot=((n-1)*size(ηᵣ,2)+o))
390391
else
@@ -394,8 +395,8 @@ function RTI_GrowthRate()
394395
xlabel="1/nmx/nmy",ylabel="ε [ % ]",
395396
xscale=:log10,yscale=:log10,
396397
title=string("ηᵣ = ",ηᵣ[o]),
397-
xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
398-
ylims=(1e-1, 1e2),
398+
# xlims=(1/(maximum(nm)+3)/(maximum(nm)+3), .5),
399+
# ylims=(1e-1, 1e2),
399400
layout=(size(addnoise,2),size(ηᵣ,2)),
400401
subplot=((n-1)*size(ηᵣ,2)+o))
401402
end
@@ -408,7 +409,7 @@ function RTI_GrowthRate()
408409
end # Loop addnoise - n
409410
end
410411
if save_fig == 1
411-
savefig(q,string("./examples/StokesEquation/2D/Results/RTI_Growth_Rate_Res_Test_const_NC.png"))
412+
savefig(q,string("./examples/StokesEquation/2D/Results/RTI_Growth_Rate_Res_Test_const_NC_",avgm,".png"))
412413
else
413414
display(q)
414415
end

examples/StokesEquation/2D/RTI_Growth_Rate_Res_Test_3.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function RTI_GrowthRate()
1313
@timeit to "Ini" begin
1414
plot_fields =:no
1515
save_fig = 1
16+
avgm =:geom # Averaging Method for η - default arith
1617
Pl = (
1718
qinc = 5,
1819
qsc = 100*(60*60*24*365.25)*5e1,
@@ -261,7 +262,7 @@ function RTI_GrowthRate()
261262
end
262263
end
263264
# Interpolate Viscosity ---
264-
Markers2Cells(Ma,nmark,MAVG.PC_th,D.ηce,MAVG.wte_th,D.wte,x,y,Δ,Aparam,η)
265+
Markers2Cells(Ma,nmark,MAVG.PC_th,D.ηce,MAVG.wte_th,D.wte,x,y,Δ,Aparam,η;avgm)
265266
D.ηc .= D.ηce[2:end-1,2:end-1]
266267
Markers2Vertices(Ma,nmark,MAVG.PV_th,D.ηv,MAVG.wtv_th,D.wtv,x,y,Δ,Aparam,η)
267268
end
@@ -383,8 +384,8 @@ function RTI_GrowthRate()
383384
xlabel="1/ncx/ncy",ylabel="ε [ % ]",
384385
xscale=:log10, yscale=:log10,
385386
title=string("ηᵣ = ",ηᵣ[o]),
386-
xlims=(1/(maximum(nc)+20)/(maximum(nc)+20), .1),
387-
ylims=(1e-2, 1e2),
387+
# xlims=(1/(maximum(nc)+20)/(maximum(nc)+20), .1),
388+
# ylims=(1e-2, 1e2),
388389
layout=(size(addnoise,2),size(ηᵣ,2)),
389390
subplot=((n-1)*size(ηᵣ,2)+o))
390391
else
@@ -394,8 +395,8 @@ function RTI_GrowthRate()
394395
xlabel="1/ncx/ncy",ylabel="ε [ % ]",
395396
xscale=:log10,yscale=:log10,
396397
title=string("ηᵣ = ",ηᵣ[o]),
397-
xlims=(1/(maximum(nc)+20)/(maximum(nc)+20), .1),
398-
ylims=(1e-2, 1e2),
398+
# xlims=(1/(maximum(nc)+20)/(maximum(nc)+20), .1),
399+
# ylims=(1e-2, 1e2),
399400
layout=(size(addnoise,2),size(ηᵣ,2)),
400401
subplot=((n-1)*size(ηᵣ,2)+o))
401402
end
@@ -408,7 +409,7 @@ function RTI_GrowthRate()
408409
end # Loop addnoise - n
409410
end
410411
if save_fig == 1
411-
savefig(q,string("./examples/StokesEquation/2D/Results/RTI_Growth_Rate_Res_Test_const_NM.png"))
412+
savefig(q,string("./examples/StokesEquation/2D/Results/RTI_Growth_Rate_Res_Test_const_NM_",avgm,".png"))
412413
else
413414
display(q)
414415
end
71.3 KB
Loading
Binary file not shown.
63.2 KB
Loading

0 commit comments

Comments
 (0)