dumux issueshttps://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues2024-03-25T10:31:55Zhttps://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/1256[porousmedia] Energy balance implementation2024-03-25T10:31:55ZTimo Kochtimokoch@math.uio.no[porousmedia] Energy balance implementationWe currently have some inconsistencies in the energy balance for porous media. For thermal equilibrium models, we implement
```math
\frac{\partial \left( n_s \rho_s u_s + n_f \rho_f u_f \right)}{\partial t} =
- \nabla\cdot{\left( \rho...We currently have some inconsistencies in the energy balance for porous media. For thermal equilibrium models, we implement
```math
\frac{\partial \left( n_s \rho_s u_s + n_f \rho_f u_f \right)}{\partial t} =
- \nabla\cdot{\left( \rho_f h_f \boldsymbol{v}_f \right)} + \nabla\cdot{\left( \left\lbrace n_f \lambda_f + n_s \lambda_s \right\rbrace \nabla T \right)}.
```
but the correct balance would be
```math
\frac{\partial \left( n_s \rho_s u_s + n_f \rho_f \left\lbrace u_f - g z \right\rbrace \right)}{\partial t} =
- \nabla\cdot{\left( \left\lbrace \rho_f h_f - \rho_f g z\right\rbrace \boldsymbol{v}_f \right)} + \nabla\cdot{\left( \left\lbrace n_f \lambda_f + n_s \lambda_s \right\rbrace \nabla T \right)}.
```
This might seem like a small change but the difference actually shows some inconsistency. It's not just an omitted term.
Only looking at the fluid balance, the gravity term can also be written like this
```math
\frac{\partial \left( n_f \rho_f u_f \right)}{\partial t} = - \nabla\cdot{\left( \rho_f h_f \boldsymbol{v}_f \right)} + \nabla\cdot{\left(n_f \lambda_f \nabla T \right)} + \rho_f \boldsymbol{v}_f \cdot \boldsymbol{g} = - \nabla\cdot{\left( (\rho_f u_f + p) \boldsymbol{v}_f \right)} + \nabla\cdot{\left(n_f \lambda_f \nabla T \right)} + \rho_f \boldsymbol{v}_f \cdot \boldsymbol{g}.
```
Essentially, if we consider gravity in Darcy's law, we should also consider the corresponding term in the energy balance for consistency.
Subtracting the momentum balance multiplied by the velocity gives the balance of internal energy (non-conservative because only total energy is conserved):
```math
\frac{\partial \left( n_f \rho_f u_f \right)}{\partial t} = - \nabla\cdot{\left( \rho_f u_f \boldsymbol{v}_f \right)} + \nabla\cdot{\left(n_f \lambda_f \nabla T \right)} \underbrace{- p \left(\nabla\cdot{\boldsymbol{v}_f}\right)}_{\text{volume work}} \underbrace{+ \mu_f \boldsymbol{K}^{-1} \boldsymbol{v}_f \cdot \boldsymbol{v}_f}_{\text{viscous dissipation}}
```
This shows that there are conversion terms resulting in modification of the internal energy. Even if we assume that one of these is small, or both of these are small, we don't arrive at the implemented equation. If we don't have the gravity/potential energy term in the original balance, there would be an additional gravity term popping up here that mingles with the other energy conversion terms.
The gravity term vanishes if the fluid only moves perpendicular to the gravity field. However, for scenarios with strong upward/downward movement, this should have an effect.3.9Tufan GhoshTufan Ghoshhttps://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/988[Forchheimer] Does this work for multi-phase flow?2023-12-13T11:13:08ZDennis Gläser[Forchheimer] Does this work for multi-phase flow?In !2414, @martins and I discussed if Forchheimer (or our implementation of it) works for multi-phase settings. It is permitted in the code and, but some variables have names that suggest one-phase flow regimes. Moreover, there is this c...In !2414, @martins and I discussed if Forchheimer (or our implementation of it) works for multi-phase settings. It is permitted in the code and, but some variables have names that suggest one-phase flow regimes. Moreover, there is this comment:
```cpp
// This is important in the case of a one-phase region in two-phase flow. The non-existing
// phase has a velocity of zero (kr=0).
```
see line 472 in https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/59ee4e5e26d6646dcf7670df8b4f7193a6fe3fda/dumux/flux/cctpfa/forchheimerslaw.hhRoman WinterRoman Winterhttps://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/1160Prototypical math models for testing and as examples2023-09-23T18:14:28ZTimo Kochtimokoch@math.uio.noPrototypical math models for testing and as examples__Proposed feature__:
Many models in Dumux are relatively general and support many variations. This can also often be distracting both when understanding the code and when thinking about general concepts and structure. I propose (someth...__Proposed feature__:
Many models in Dumux are relatively general and support many variations. This can also often be distracting both when understanding the code and when thinking about general concepts and structure. I propose (something similar has been proposed in dumux-repositories/dumux-course#17) to add some models with simple structure. For example:
* Poisson's equation
* Heat equation / Diffusion equation
* Wave equation
* Burger's equation
* Cahn-Hillard equation(s)
* (Multidomain) Incompressible Stokes equations
These prototypical models have the advantage that we can mostly assume scalar constant parameters (no need for fluid systems and so on), a small number of primary variables (e.g. 1 scalar), and simple local residual. Parameter names could be generic and not imply specific physics.
__The goal would be to use such models__
* to demonstrate (to users and developers) what the essential and minimal ingredients of a new model are
* to use them as starting point for new models
* to test if our software components work well in isolation and are small enough (testing). If they turn out not to be these models should be good candidates to think about better abstractions (development).
* to have simple demonstrators for teaching/outreach
* to use them directly as tools/components
__Open questions:__
* In which folder would such models go?
* Do we even want to hard-code some models for one spatial discretization scheme to further simplify?
_Examples where a procedure like this helped to improve the code:_
* #867https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/1000[freeflow] Properly include the volume work term in the energy balance2023-07-24T13:11:04ZKilian Weishaupt[freeflow] Properly include the volume work term in the energy balanceWe currently implement
$`\frac{\partial}{\partial t}(\rho u) = - \nabla \cdot (\rho \mathbf{v}h) + \nabla \cdot (\lambda \nabla T)`$
with $`h = u + \frac{p}{\rho}`$
However, the a correct form of the energy balance equation is (see ...We currently implement
$`\frac{\partial}{\partial t}(\rho u) = - \nabla \cdot (\rho \mathbf{v}h) + \nabla \cdot (\lambda \nabla T)`$
with $`h = u + \frac{p}{\rho}`$
However, the a correct form of the energy balance equation is (see !2473, !2471)
$`\frac{\partial}{\partial t}(\rho u) = - \nabla \cdot (\rho \boldsymbol{v}u) + \nabla \cdot (\lambda \nabla T) \underbrace{- p \left(\nabla\cdot{\boldsymbol{v}}\right)}_{\text{volume work}} + \underbrace{2\mu\boldsymbol{D}(\boldsymbol{v}) : \boldsymbol{D}(\boldsymbol{v})}_{\text{viscous dissipation}} `$
where $`\vec{D}(\vec{v}) = \frac{1}{2}\left( \nabla{\vec{v}} + \nabla{\vec{v}}^T \right)`$.
Viscous dissipation can often be neglected. Replacing enthalpy with internal energy in the first divergence term is simple but
the discretization of
$`p \nabla \cdot \mathbf{v}`$
is not straight-forward.
A possible simple solution would be:
Include in calculation of flux terms, i.e., evaluate $`\nabla \cdot \mathbf{v}`$
and assume a cell-constant $`p`$ which is just multiplied to the term. This gives a first-order scheme but should be ok since the term is often small. For incompressible flow the term also vanishes discretely since $`\nabla \cdot \mathbf{v} = 0`$.
This seems to work for cell-centered schemes without much additional effort (!2494).
For the box method it seems more difficult since the code assumes that fluxes on scvfs are symmetric. However the energy contribution (assembled on the scvfs) is different depending on the control volume (different control volume pressure).
Another solution is to implement the full conservative form of the energy equation
```math
\frac{\partial}{\partial t}\left( \frac{1}{2}\rho ||{\boldsymbol{v}}||^2 + \rho u \right) =
- \nabla\cdot{\left( \left[\frac{1}{2}\rho ||{\boldsymbol{v}}||^2 + \rho u \right] \boldsymbol{v}\right)}
+ \nabla\cdot{\left( \boldsymbol{T} \boldsymbol{v} + \lambda \nabla T\right)}
+ \rho \boldsymbol{v}\cdot \vec{g},
```
where $`\boldsymbol{T} = 2\mu\boldsymbol{D}(\boldsymbol{v}) - p\boldsymbol{I}`$.
__Edit 24 Jul 23 (@timok):__ included viscous dissipation term, annotations and conservative energy balance.https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/970Check brine fluidsystem2022-03-30T22:04:42ZTheresa SchollenbergerCheck brine fluidsystemThe binary diffusion coefficient of NaCl seems to be wrong. Also there is no source available for the implemented one. Because of that the implemented parameters should be checked and sources sould be added.
Further there are relations e...The binary diffusion coefficient of NaCl seems to be wrong. Also there is no source available for the implemented one. Because of that the implemented parameters should be checked and sources sould be added.
Further there are relations e.g. for density where the source is not mentioned in the comments. Also there are some todos left to do which could be essential.
- [x] correct diffusion coefficient
- [x] check parameters and add sources
- [x] improve comments and add sources for relationships
- [x] todo check contribution of NaCl on thermal conductivity
- [x] todo find better description for calculation of the isobaric heat capacity
- [x] check solid heat capacity of NaCl which is given in J/mol K
- [x] check fugacity coefficient in brine and brineair
- [x] update reference solutions3.5Theresa SchollenbergerTheresa Schollenbergerhttps://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/1013SimpleH20 does not consider enthalpy of vaporization2022-03-30T18:41:30ZKilian WeishauptSimpleH20 does not consider enthalpy of vaporizationI suggest to add $`h_\mathrm{vap}`$ here:
```c++
static const Scalar gasEnthalpy(Scalar temperature,
Scalar pressure)
{
static const Scalar tRef = getParam<Scalar>("SimpleH2O.Reference...I suggest to add $`h_\mathrm{vap}`$ here:
```c++
static const Scalar gasEnthalpy(Scalar temperature,
Scalar pressure)
{
static const Scalar tRef = getParam<Scalar>("SimpleH2O.ReferenceTemperature", 293.15);
return gasHeatCapacity(temperature, pressure)*(temperature - tRef) + 2453.5e3;
}
```
We could even make $`h_\mathrm{vap}`$ depending on $`T_\mathrm{ref}`$ as there as simple equations for that.
http://www.personal.psu.edu/users/m/r/mrh318/physical-consts/Popiel-Wojtkawiak-HTE-1998.pdf
https://www.scirp.org/pdf/AS20120200008_25514260.pdf (Bananas!)
It would still be a constant.3.5Katharina HeckKatharina Heckhttps://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/issues/690[material][co2] create co2 tables with pressures less than 1 bar2022-03-30T09:17:22ZKatharina Heck[material][co2] create co2 tables with pressures less than 1 barthe current co2 tables start at 1 bar pressure but in the fluidsystems e.g. brineco2 we calculate e.g. the gas density based on partial pressure (which can be less than 1 bar). That can lead to wrong results if the partial pressure is le...the current co2 tables start at 1 bar pressure but in the fluidsystems e.g. brineco2 we calculate e.g. the gas density based on partial pressure (which can be less than 1 bar). That can lead to wrong results if the partial pressure is less than 1 bar. Then the value of 1 bar is taken from the table and added to the density calculation (which is especially wrong if no co2 is present at all)
Possibly this could be a task for a Hiwi to look into a meaningful relationship for densities etc for co2 and create new tables.3.5Johannes HommelJohannes Hommel