You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where the energy is described as $E=c_{p} \rho T$, and $c_{p}$ is the specific heat capacity [ $J/kg/K$ ], $\rho$ is a reference density [ $kg/m^{3}$ ], $T$ is the temperature [ $K$ ], $t$ is the time [ $s$ ], $\overrightharpoon{v}$ is the velocity vector [ $m/s$ ], $q_{i}$ [ $W/m^{2}$ ] is the heat flux in direction of $i$, $\frac{\partial}{\partial{x_i}}$ is a directional derivative in direction of $i$, and $H$ the heat production rate per mass [ $W/kg$ ]. The repeated index means a summation of derivatives. This conservation law contains the variation of the heat flux in a certain direction, where the heat flux is defined by the Fourier’s law as followed:
9
+
where the energy is described as $E=c_{p} \rho T$, and $c_{p}$ is the specific heat capacity [ $J/kg/K$ ], $\rho$ is a reference density [ $kg/m^{3}$ ], $T$ is the temperature [ $K$ ], $t$ is the time [ $s$ ], $\overrightharpoon{v}$ is the velocity vector [ $m/s$ ], $q_{i}$ is the heat flux [ $W/m^{2}$ ] in direction of $i$, $\frac{\partial}{\partial{x_i}}$ is a directional derivative in direction of $i$, and $H$ the heat production rate per mass [ $W/kg$ ]. The repeated index means a summation of derivatives. This conservation law contains the variation of the heat flux in a certain direction, where the heat flux is defined by the Fourier’s law as followed:
10
10
11
11
$\begin{equation}
12
12
\overrightharpoon{q} = - k \overrightharpoon{\nabla} T,
@@ -29,7 +29,9 @@ The ```GeoModBox.jl``` provides different finite difference (**FD**) schemes to
29
29
- Crank-Nicholson approach, and
30
30
- Alternating-Direction Implicit (ADI).
31
31
32
-
For more details regarding each FD-scheme see the documentation of the [1-D](./DiffOneD.md) and [2-D](./DiffTwoD.md) solvers, respectively. Currently, only *Dirichlet* and *Neumann* thermal boundary conditions are available and most functions assume constant thermal parameters (except for the 1-D and some 2-D solvers). For more details on the implementation of the solvers see the [src/HeatEquation](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/HeatEquation/) directory.
32
+
For more details regarding each FD-scheme see the documentation of the [1-D](./DiffOneD.md) and [2-D](./DiffTwoD.md) solvers, respectively.
33
+
34
+
Currently, only *Dirichlet* and *Neumann* thermal boundary conditions are available and most functions assume constant thermal parameters (except for the 1-D and some 2-D solvers). For more details on the implementation of the solvers see the [src/HeatEquation](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/HeatEquation/) directory.
33
35
34
36
The examples of solving the *heat diffusion equation* include, amongst others:
35
37
- the determination of an [oceanic](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/examples/DiffusionEquation/1D/OceanicGeotherm_1D.jl) and [continental](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/examples/DiffusionEquation/1D/ContinentalGeotherm_1D.jl) 1-D geotherm,
@@ -53,13 +55,15 @@ To solve the *advective part* of the *temperature equation*, the ```GeoModBox.jl
53
55
- the semi-lagrangian advection scheme, and
54
56
- passive tracers/markers.
55
57
56
-
For more details regarding each advection scheme see the [documentation](./AdvectMain.md). The routines are structured in such a way, that any property can be advected with the first **three** advection methods listed above, as long as the property is defined on the *centroids* including *ghost nodes* on all boundaries. The velocity to advect the property also needs to be defined at the *centroids*. Using passive tracers, one can, so far, choose to either advect the (absolut) temperature or the phase ID. In case of advecting the phase ID, one must define a certain rheology ($\eta$) and/or density ($\rho$) associated to each phase. The phase ID is used to interpolate the corresponding property from the tracers to the *centroids* or the *vertices* (e.g., in the case of the viscosity). The tracers can be initialized with a certain random perturbation for their initial position and are advected using Runge-Kutta 4th order. For the tracer advection one can use the staggered velocity grid.
58
+
For more details regarding each advection scheme see the [documentation](./AdvectMain.md).
59
+
60
+
The routines are structured in such a way, that any property can be advected with the first **three** advection schemes listed above, as long as the property is defined on the *centroids* including *ghost nodes* on all boundaries. The velocity to advect the property also needs to be defined at the *centroids*.
57
61
58
-
For more details on the implementation of the tracer advection see [here](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/Tracers/2Dsolvers.jl)or [here](./AdvectMain.md). The solvers for the tracer advection method are located in [src/Tracers](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/Tracers/), where the remaining advection routines are located in [src/AdvectionEquation](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/AdvectionEquation/).
62
+
Using passive tracers, one can, so far, choose to either advect the (absolut) temperature or the phase ID. In case of advecting the phase ID, one must define a certain rheology ($\eta$) and/or density ($\rho$) associated to each phase. The phase ID is used to interpolate the corresponding property from the tracers to the *centroids* or the *vertices* (e.g., in the case of the viscosity). The tracers can be initialized with a certain random perturbation for their initial position and are advected using Runge-Kutta 4th order. For the tracer advection one can use the staggered velocity grid.
59
63
60
-
A key aspect for the advection is the **amplitude** and the **shape** of an advected property. For example, in case of a rigid body rotation, none of them should change. Depending on the method, however, numerical diffusion or interpolation effects can lead to strong deviations. Thus, care needs to be taken with respect to solving the *advection equation*.
64
+
For more details on the implementation of the tracer advection see the [solvers](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/Tracers/2Dsolvers.jl) or the [documentaion](./AdvectMain.md). The solvers for the tracer advection method are located in [src/Tracers](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/Tracers/), where the remaining advection routines are located in [src/AdvectionEquation](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/src/AdvectionEquation/).
61
65
62
-
The ```GeoModBox.jl``` contains several [routines](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/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. Within the examples and the exercise one can choose different initial temperature and velocity conditions. See [here](./Ini.md) for a more detailed explenation of the initial condition setup.
66
+
A key aspect for advection is the **amplitude** and the **shape** of the advected property. For example, in case of a rigid body rotation, none of them should change. Depending on the method, however, numerical diffusion or interpolation effects can lead to strong deviations. Thus, care needs to be taken with respect to solving the *advection equation*.
63
67
64
68
The examples for a two dimensional advection problem include:
65
69
-[a 2-D advection, assuming a constant velocity field (e.g., a rigid body rotation)](https://github.com/GeoSci-FFM/GeoModBox.jl/blob/main/examples/AdvectionEquation/2D_Advection.jl), and
Copy file name to clipboardExpand all lines: docs/src/man/DiffOneD.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ $\begin{equation}
20
20
21
21
where $\kappa = k/\rho /c_p$ is the thermal diffusivity [ $m^2/s$ ] and $Q=\rho H$ is the heat production rate per volume [ $W/m^3$ ]. Equation $(3)$ is a *parabolic partial differential equation* (PDE) which can be solved numerically in different manners, assuming initial and boundary conditions are defined.
22
22
23
-
First, let us discuss a simple, but effective, finite difference method to discretize and solve the equation, that is the **forward in time and centered in space (FTCS)** method in an **explicit** manner. This finite difference scheme will converge to the exact solution for small $\Delta{x}$ and $\Delta{t}$. The advantage of an explicit description is that it is **simple** to derive and rather **fast** computationally. However, it is only numerically stable as long as the *heat diffusion stability criterion* is fulfilled. The stability criterion can be determined by a *Von Neumann* stability analysis, which analyzes the growth of an eigenmode perturbation for a certain finite difference approach. In case of an **explicit 1-D finite difference approach**, the *heat diffusion stability criterion* is defined as (assuming equal grid spacing):
23
+
First, let's discuss a simple, but effective, finite difference method to discretize and solve the equation, that is the **forward in time and centered in space (FTCS)** method in an **explicit** manner. This finite difference scheme will converge to the exact solution for small $\Delta{x}$ and $\Delta{t}$. The advantage of an explicit description is that it is **simple** to derive and rather **fast** computationally. However, it is only numerically stable as long as the *heat diffusion stability criterion* is fulfilled. The stability criterion can be determined by a *Von Neumann* stability analysis, which analyzes the growth of an eigenmode perturbation for a certain finite difference approach. In case of an **explicit 1-D finite difference approach**, the *heat diffusion stability criterion* is defined as (assuming equal grid spacing):
24
24
25
25
$\begin{equation}
26
26
\Delta t < \frac{\Delta x^2}{2 \kappa}.
@@ -38,7 +38,7 @@ To numerically solve equation $(3)$ one needs to discretize the numerical domain
38
38
39
39
### Explicit, *FTCS* (or Forward Euler Method)
40
40
41
-
Using an*FTCS* explicit finite difference scheme to approximate the partial derivatives from equation $(3)$ results in:
41
+
Using a*FTCS* explicit finite difference scheme to approximate the partial derivatives from equation $(3)$ results in:
@@ -54,7 +54,9 @@ where $a = \frac{\kappa \Delta t}{\Delta{x^2}}$. Equation $(6)$ can be solved *i
54
54
55
55
#### Boundary Conditions
56
56
57
-
Different thermal boundary conditions can be set for which one utilizes the *ghost nodes*. Here, let us focus on two fundamental conditions, the *Dirichlet* and *Neumann* boundary conditions. To consider each boundary condition to solve the equations, one needs to define the temperature at the *ghost nodes*. The Dirichlet boundary condition defines a constant temperature along the boundary, such that the temperatures at the left (**west**) and right (**east**) *ghost nodes* are defined as:
57
+
Different thermal boundary conditions can be set for which one utilizes the *ghost nodes*. Here, let's focus on two fundamental conditions, the *Dirichlet* and *Neumann* boundary conditions. To consider each boundary condition to solve the equations, one needs to define the temperature at the *ghost nodes*.
58
+
59
+
The *Dirichlet* boundary condition defines a constant temperature along the boundary, such that the temperatures at the left (**West**) and right (**East**) *ghost nodes* are defined as:
58
60
59
61
$\begin{equation}
60
62
T_{G,W} = 2T_{BC,W} - T_{1},
@@ -66,7 +68,7 @@ T_{G,E} = 2T_{BC,E} - T_{nc},
66
68
67
69
where $T_{G,W}$, $T_{G,E}$ and $T_{BC,W}$, $T_{BC,E}$ are the temperature at the left and right *ghost nodes* and the constant temperatures at the left and right boundary, respectively, and $nc$ is the number of centroids.
68
70
69
-
The Neumann boundary condition defines that the variation of a certain parameter does not change across the boundary, that is, for example, the temperature across the boundary or thermal heat flux $q$ through the boundary. The temperature at the *ghost nodes* is then defined as:
71
+
The *Neumann* boundary condition defines that the variation of a certain parameter does not change across the boundary, that is, for example, the temperature across the boundary or thermal heat flux $q$ through the boundary. The temperature at the *ghost nodes* is then defined as:
70
72
71
73
$\begin{equation}
72
74
T_{G,W} = T_{1} - c_{W} \Delta{x},
@@ -104,7 +106,7 @@ $\begin{equation}
104
106
-a T_{i-1}^{n+1} + \left(2a + b \right) T_{i}^{n+1} - a T_{i+1}^{n+1} = b T_{i}^n + \frac{Q_{i}^n}{\rho c_p},
105
107
\end{equation}$
106
108
107
-
where $a = \frac{\kappa}{\Delta{x^2}}$ and $b = \frac{1}{\Delta{t}}$. This is a linear system of equation in the form of $\boldsymbol{A}\cdot \overrightharpoon{x} = \overrightharpoon{rhs}$, where $\boldsymbol{A}$ is a coefficient matrix (here with three non-zero diagonals), $\overrightharpoon{x}$ the unknown vector, and $\overrightharpoon{rhs}$ the known right-hand side. We choose to distribute the coefficients in such a way and kept the time step on the right-hand side of the euqation to ensure that the coefficient matrix is the same as used in the *defect correction* method.
109
+
where $a = \frac{\kappa}{\Delta{x^2}}$ and $b = \frac{1}{\Delta{t}}$. This is a linear system of equation in the form of $\boldsymbol{A}\cdot \overrightharpoon{x} = \overrightharpoon{rhs}$, where $\boldsymbol{A}$ is a coefficient matrix (here with three non-zero diagonals), $\overrightharpoon{x}$ the unknown vector, and $\overrightharpoon{rhs}$ the known right-hand side. We choose to distribute the coefficients in such a way and to keep the time step on the right-hand side of the equation to ensure that the coefficient matrix is the same as used in the *defect correction* method.
108
110
109
111
The main advantage of the implicit method is that there are no restrictions on the time step. However, this does not mean that it is more accurate. Taking too large time steps may result in an inaccurate solution for features with small spatial scales.
110
112
@@ -246,19 +248,19 @@ $\begin{equation}
246
248
247
249
However, the band-width of the coefficient matrix increases as in the fully implicit case. Thus, the method becomes memory intensiv for models with a high resoltuion. For more details on how this is implemented, see [*1Dsolvers.jl*](https://github.com/LukasFuchs/GeoModBox.jl/blob/main/src/HeatEquation/1Dsolvers.jl).
248
250
249
-
For the explicit solver and the defect correction method, one needs the extended temperature field, which includes the *ghost nodes*, to solve the *temperature equation*. Thereby, the current temperature field is assigned to the centroids of the extended field to use it as the *old* temperature and calculate the temperature at the new time step. For the remaining solvers, we assign the current temperature to the known righ-hand side vector, collect the coefficients for each matrix and solve for the unknown temperature.
251
+
For the explicit solver and the defect correction method, one needs the extended temperature field, which includes the *ghost nodes*, to solve the *temperature equation*. Thereby, the current temperature field is assigned to the *centroids* of the extended field to use it as the *old* temperature and to calculate the temperature at the new time step. For the remaining solvers, we assign the current temperature at the *centroids* to the known righ-hand side vector, collect the coefficients for each matrix and solve for the unknown temperature.
250
252
251
253
### Variable Thermal Parameters
252
254
253
-
To sove the *conductive* part of the 1-D *temperature equation* assuming variable thermal parameters one needs a proper conserving finite difference scheme. That is, the heat flow is calculated on the *vertices* and the temperature is defined on the *centroids*, respectively. The 1-D temperature equation is then given by:
255
+
To solve the *conductive* part of the 1-D *temperature equation* assuming variable thermal parameters one needs a proper conserving finite difference scheme. That is, the heat flow is calculated on the *vertices* and the temperature is defined on the *centroids*, respectively. The 1-D temperature equation is then given by:
where $\rho, c_{p}, T, t, k, H,$ and $y$ are the density [ $kg/m^3$ ], the specific heat capacity [ $J/kg/K$ ], the temperature [ $K$ ], the time [ $s$ ], the thermal conductivity [ $W/m/K$ ], the heat generation rate per mass [ $W/kg$ ], and the depth [ $m$ ], respectively.
260
262
261
-
A proper conservative finite difference scheme means that the 1-D vertical heat flux $q_y$ and the thermal conductivity $k$ are defined on the vertices, where $q_x$ is defined as:
263
+
A proper conservative finite difference scheme means that the 1-D vertical heat flux $q_y$ and the thermal conductivity $k$ are defined on the vertices, where $q_y$ is defined as:
0 commit comments