Skip to content

Commit

Permalink
Merging master
Browse files Browse the repository at this point in the history
  • Loading branch information
jcotela committed Feb 20, 2024
2 parents dedcddd + 4bc739d commit af0a38e
Show file tree
Hide file tree
Showing 533 changed files with 42,130 additions and 12,169 deletions.
64 changes: 32 additions & 32 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,71 +109,71 @@ Additionaly, Visual Studio is required to compile in *Windows*.
MingGw compilation details are hidden by default to avoid confusion, please click the button below to show them.
<details>
<summary>Show MinGW compilation details</summary>
*MinGW* means minimal GNU for *Windows*. There are different manners of installing, the simplest one using *MSYS2*.
- MSYS2
First, we download *MSYS2* in the following [link](https://www.msys2.org/). This will install *MinGW*, which allows to easiy install packages *a la* Arch-Linux (Pacman package manager). We install it, and with it the first thing we do is to update as follows ([in the *MSYS2* bash](https://www.msys2.org/docs/terminals/)):
![](https://www.msys2.org/docs/mintty.png) ![](https://www.msys2.org/docs/launchers.png)
```Shell
pacman -Syu
```
It is very relevant to add to the *Windows* `PATH` your `msys64\mingw64\bin` folder in order that the system locates the binaries.
- Git
The first thing you will need is the *Kratos* Multiphysics source code. To download the code you will have to use a git. You can install the default git by using this command:
```Shell
pacman -S git
```
Once git is installed you can fetch the code by using these commands:
```Shell
git clone https://github.com/KratosMultiphysics/Kratos Kratos
```
- Dev Packages
You will need a series of packages with some *Kratos* dependencies. These include the compilers (*GCC*,*Clang/LLVM*), *CMake*, *Blas and Lapack* libraries and the *OpenMP* support. The command below will install all the packages needed. The command below will install all the packages needed.
```Shell
pacman -S mingw64/mingw-w64-x86_64-lapack mingw64/mingw-w64-x86_64-openblas mingw64/mingw-w64-x86_64-cmake mingw64/mingw-w64-x86_64-clang mingw64/mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-make mingw64/mingw-w64-x86_64-openmp mingw64/mingw-w64-x86_64-dlfcn
```
- Python
- Python
You will need at least *Python* 3.8 (recommended 3.8/3.9/3.10) in your computer in order to compile *Kratos*. You can download python from its official webpage:
* [Download Python](http://www.python.org/downloads/)
Please, take special care to download a installer that suits your desired architecture **x86 for 32 bits** compilations and **x86_64 for 64 bits** compilations. Otherwise it won't work.

Unfortunately, we cannot use right now *MSYS2* directly, as the development files are not available (`python3-dev` equivalent to *GNU/Linux*).

- Boost
The next step will consist in obtain Boost. *Kratos Multiphysics* needs *Boost* libraries to support some of its functions. You can use any version from `version 1.67` onward. For that, we will use `pacman` again:

```Shell
pacman -S mingw64/mingw-w64-x86_64-boost
```

##### Using UCRT64

UCRT (Universal C Runtime) is a newer version which is also used by Microsoft Visual Studio by default, see https://www.msys2.org/docs/environments/. It should work and behave as if the code was compiled with MSVC.

- Better compatibility with MSVC, both at build time and at run time.
- It only ships by default on Windows 10 and for older versions you have to provide it yourself or depend on the user having it installed.

If using UCRT64 the dependencies will be like:

```Shell
pacman -S ucrt64/mingw-w64-ucrt-x86_64-lapack ucrt64/mingw-w64-ucrt-x86_64-openblas ucrt64/mingw-w64-ucrt-x86_64-cmake ucrt64/mingw-w64-ucrt-x86_64-clang ucrt64/mingw-w64-ucrt-x86_64-gcc ucrt64/mingw-w64-ucrt-x86_64-gcc-fortran mingw-w64-ucrt-x86_64-make ucrt64/mingw-w64-ucrt-x86_64-openmp ucrt64/mingw-w64-ucrt-x86_64-dlfcn ucrt64/mingw-w64-ucrt-x86_64-boost
```
</details>

### Specific Application Dependencies

Some applications have additional dependencies. Please check the `README` files of the applications that are compiled
Expand Down Expand Up @@ -236,7 +236,7 @@ The example scripts for every system are shown next.
### GNU/Linux
```bash
```console
# Function to add apps
add_app () {
export KRATOS_APPLICATIONS="${KRATOS_APPLICATIONS}$1;"
Expand Down Expand Up @@ -373,7 +373,7 @@ sh %KRATOS_BUILD%\configure_MINGW.sh
And the second is the bash script that will be called by the former script (it is similar to the one in *GNU/Linux*):
```bash
```console
# Function to add apps
add_app () {
export KRATOS_APPLICATIONS="${KRATOS_APPLICATIONS}$1;"
Expand Down Expand Up @@ -417,7 +417,7 @@ cmake --build "${KRATOS_BUILD}/${KRATOS_BUILD_TYPE}" --target install -- -j$(npr
```
### MacOS
```bash
```console
# Function to add apps
add_app () {
export KRATOS_APPLICATIONS="${KRATOS_APPLICATIONS}$1;"
Expand Down Expand Up @@ -488,7 +488,7 @@ For *Windows* with *MinGW* it works in the same way as in *GNU/Linux* as it work
As *Kratos* is not an executable but a set of modules and libraries, you will need to add them to the path. In order to do that please add the *Kratos* install folder (If you didn't touch anything should be `$KRATOS_SOURCE/bin/Release`)

### GNU/Linux
```bash
```console
export PYTHONPATH=$PYTHONPATH:$HOME/Kratos/bin/Release
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/Kratos/bin/Release/libs
```
Expand Down Expand Up @@ -518,9 +518,9 @@ from KratosMultiphysics import *
The result should be:

```
| / |
' / __| _` | __| _ \ __|
. \ | ( | | ( |\__ \
| / |
' / __| _` | __| _ \ __|
. \ | ( | | ( |\__ \
_|\_\_| \__,_|\__|\___/ ____/
Multi-Physics 9.X.Y-4afb88094a-Release-ARM64
Compiled for GNU/Linux and Python3.8 with GCC-8.5
Expand Down
4 changes: 3 additions & 1 deletion applications/GeoMechanicsApplication/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Clang-format commits
42812c76886157f305718ef13f66c6b4274f3780
42812c76886157f305718ef13f66c6b4274f3780
ab13f86f8770ccaaa23ef69c63f14f443da8bea0
206d114e8082ce70ebf375e2a4d4e84f366c6696
130 changes: 130 additions & 0 deletions applications/GeoMechanicsApplication/custom_elements/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Transient Thermal Element

## Introduction
The calculation of geothermal processes relies on a profound understanding of heat transport mechanisms within the Earth's subsurface. Central to this understanding is the heat transport equation. In this context, the heat transport equation becomes a linchpin for designing sustainable and efficient geothermal systems.

## Governing Equations
The primary governing equation for heat transport in geothermal applications is the heat convection-conduction equation, which describes how heat flows through a porous medium.

$$ \left(n S \rho^w c^w + (1- n) \rho^s c^s \right) \frac{\partial T}{\partial t} = -\rho^w c^w q_i \frac{\partial T}{\partial x_i} + \frac{\partial}{\partial x_i} \left( D_{ij} \frac{\partial T}{\partial x_j} \right) \qquad \text{on} \quad \Omega $$

where,

- $c^w$ = specific heat capacity liquid phase $\mathrm{[J/kg ^{\circ}C]}$
- $c^s$ = specific heat capacity solid phase $\mathrm{[J/kg ^{\circ}C]}$
- $D_{ij}$ = hydrodynamic thermal dispersion $\mathrm{[W/m ^{\circ}C]}$
- $T$ = temperature $\mathrm{[ ^{\circ}C]}$
- $\rho^s$ = density solid phase $\mathrm{[kg/m^3]}$
- $\rho^w$ = water density $\mathrm{[kg/m^3]}$
- $q$ = specific discharge $\mathrm{[m/s]}$
- $S$ = degree of saturation $\mathrm{[-]}$
- $n$ = porosity $\mathrm{[-]}$

The hydrodynamic thermal dispersion is defined as:

$$ D_{ij}= nS \lambda^w \delta_{ij} + \left(1-n\right) \lambda_{ij}^s + c^w \rho^w \left( (\alpha_l - \alpha_t) \frac{q_i q_j}{q} + \delta_{ij} \alpha_t q \right) $$

where

- $\alpha_l$ = longitudinal dispersivity $\mathrm{[m]}$
- $\alpha_t$ = transverse dispersivity $\mathrm{[m]}$
- $\delta_{ij}$ = Kronecker delta $\mathrm{[-]}$
- $\lambda^w$ = thermal conductivity water $\mathrm{[W/m ^{\circ}C]}$
- $\lambda^s$ = thermal conductivity solid matrix $\mathrm{[W/m ^{\circ}C]}$

In the absence of ground water flow, these equations are simplified to,

$$ \left(n S \rho^w c^w + (1- n) \rho^s c^s \right) \frac{\partial T}{\partial t} = \frac{\partial}{\partial x_i} \left( D_{ij} \frac{\partial T}{\partial x_j} \right) \qquad \text{on} \quad \Omega $$

$$ D_{ij}= nS \lambda^w \delta_{ij} + \left(1-n\right) \lambda_{ij}^s $$

## Boundary Conditions

### Dirichlet Boundary Condition
$$ T = \overline T \qquad \text{on} \quad \Gamma_{1}^T $$

where $\overline T$ $\mathrm{\left[ ^{\circ}C \right]}$ is a prescribed temperature

### Neumann Boundary Condition
$$ D_{ij} \frac{\partial T}{\partial x_j} n_i = \overline{f} \qquad \text{on} \quad \Gamma_{2}^T $$

where $\overline f$ $\mathrm{\left[ W/m^2 \right]}$ is a prescribed conductive heat flux.

### Robin Boundary Condition
$$ D_{ij} \frac{\partial T}{\partial x_j} n_i = \overline{g} - \rho^w c^w q_n T \qquad \text{on} \quad \Gamma_{3}^T $$

where $\overline g$ $\mathrm{\left[ W/m^2 \right]}$ is a prescribed convective-conductive heat flux and $q_n$ is the specific discharge $\mathrm{\left[ m/s \right]}$ at the boundary.


## Derived Properties

The density of the porous media $\rho$ $\mathrm{\left[ kg/m^3 \right]}$ is calculated as,

$$ \rho = n S \rho^w + \left( 1 - n \right) \rho^s $$

And the heat capacity of the porous media $C$ $\mathrm{\left[ J/m^{3 \circ}C \right]}$ is:

$$ C = n S \rho^w c^w + \left( 1 - n \right) \rho^s c^s $$

The thermal conductivity of the porous media $\lambda$ $\mathrm{\left[ W/m ^{\circ}C \right]}$

$$ \lambda = n S \lambda^w + \left( 1 - n \right) \lambda^s $$

dynamic viscosity $\mu$ $[\mathrm {Pas}$] of pure water as a function of temperature is given by:

$$ \mu = 2.4318 \cdot 10^{-5} \cdot 10^{{247.8} / {\left(T+133.0\right]}} $$

density of water $\rho^w$ $[\mathrm {kg/m^3}]$ is a function of temperature and Diersch (2014) proposes a sixth order Taylor expansion which is approximated here by:

$$ \rho^w = 9.998396 \cdot 10^2 + 6.764771 \cdot 10^{-2} \cdot T - 8.993699 \cdot 10^{-3} \cdot T^2 + 9.143518 \cdot 10^{-5} \cdot T^3 - 8.907391 \cdot 10^{-7} \cdot T^4 + 5.291959 \cdot 10^{-9} \cdot T^5 - 1.359813 \cdot 10^{-11} \cdot T^6 $$

Note: the dependency of water density and viscosity to temperature is user defined and the user can turn this feature on or off in the JSON file.

## Finite Element Formulation

Kratos solves the equations based on an incremental method. In the frame of Generalized Newmark method (GN11), the fully implicit incremental temperature formulation read as,

$$ \left(\frac{1}{\theta \Delta t} \boldsymbol{S} + \boldsymbol{A} + \boldsymbol{H} + \boldsymbol{W}^l \right) \boldsymbol{\Delta T} = \left( \frac{1}{\theta} - 1 \right) \boldsymbol{S} \frac{dT^n}{dt} - \left(\boldsymbol{A} + \boldsymbol{H} + \boldsymbol{W}^l \right) \boldsymbol{T}^{n} + \left( \boldsymbol{V} + \boldsymbol{W}^r \right) $$

with $\theta = 1$ this formulation leads to backward Euler formulation. It reads,

$$ \left(\frac{1}{\Delta t} \boldsymbol{S} + \boldsymbol{A} + \boldsymbol{H} + \boldsymbol{W}^l \right) \boldsymbol{\Delta T} = - \left(\boldsymbol{A} + \boldsymbol{H} + \boldsymbol{W}^l \right) \boldsymbol{T}^{n} + \left( \boldsymbol{V} + \boldsymbol{W}^r \right) $$

Note: the user can choose either Newmark or backward Euler from the JSON file.

***Compressibility matrix***

$$ \boldsymbol{S} = \int_{\Omega^e} \left( n S \rho^w c^w + \left(1-n\right) \rho^s c^s \right)^{n+1} \boldsymbol{N}^T \boldsymbol{N} d \Omega $$

***Convectivity matrix***

$$ \boldsymbol{A} = \int_{\Omega^e} \left(\rho^w c^w\right)^{n+1} \boldsymbol{N}^T \boldsymbol{q}^{T,n+1} \boldsymbol{\nabla N} d \Omega $$

***Conductivity matrix***

$$ \boldsymbol{H} = \int_{\Omega^e} \boldsymbol{\nabla N}^T \boldsymbol{D}^{n+1} \boldsymbol{\nabla N} d \Omega $$

***Neumann condition (conductive boundary)***

$$ \boldsymbol{V} = \int_{\Gamma_2^{ep}} f^{n+1} \boldsymbol{N}^T d \Gamma $$

***Robin condition (convective boundary)***

$$ \boldsymbol{W^r} = \int_{\Gamma_3^{ep}} g^{n+1} \boldsymbol{N}^T d \Gamma $$

$$ \boldsymbol{W^l} = \int_{\Gamma_3^{ep}} \left( \rho^w c^w q_n \right)^{n+1} \boldsymbol{N}^T \boldsymbol{I} d \Gamma $$

where

- $\Delta t$ = time step $\mathrm{\left[s \right]}$
- $\Delta T$ = temperature increment $T^{n+1} - T^n$ $\mathrm{\left[^\circ C \right]}$
- $\boldsymbol N$ = shape function array $\mathrm{\left[ - \right]}$
- $\theta$ = a coefficient in Newmark time integration $\mathrm{\left[ - \right]}$
- $\Omega$ = domain region
- $\Gamma$ = boundary region

The superscripts $^l$ and $^r$ for Robin boundary condition indicate the left hands side (matrix) and right hand side (vector), respectively. The superscripts $^e$ and $^{ep}$ for $\Omega$ and $\Gamma$ indicate values in the element volume and perpendicular to element boundaries, respectively.


## Bibliography
Diersch, H.-J. G., 2014. FEFLOW; Finite Element Modeling of Flow, Mass and Heat Transport in Porous and Fractured Media. Springer.
Loading

0 comments on commit af0a38e

Please sign in to comment.