forked from idaholab/moose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request idaholab#15684 from WilkAndy/geochem_transport_156…
…68_15683 Transport kernels added to geochem module
- Loading branch information
Showing
19 changed files
with
719 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
modules/geochemistry/doc/content/source/kernels/GeochemistryDispersion.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# GeochemistryDispersion | ||
|
||
This Kernel implements the PDE fragment | ||
\begin{equation} | ||
\nabla(\phi D\nabla c) \ , | ||
\end{equation} | ||
which is part of the [transport](transport.md) equations. Here | ||
|
||
- $\phi$ is the porosity, which may be a fixed real number or may be an `AuxVariable` that is spatially-dependent | ||
- $D$ is the hydrodynamic dispersion tensor (called `tensor_coeff` in the input file) | ||
- $c$ is the concentration (mol/m$^{3}$(aqueous solution)) of an aqueous species | ||
- $\nabla$ denotes the vector of spatial derivatives | ||
|
||
!syntax parameters /Kernels/GeochemistryDispersion | ||
|
||
!syntax inputs /Kernels/GeochemistryDispersion | ||
|
||
!syntax children /Kernels/GeochemistryDispersion | ||
|
23 changes: 23 additions & 0 deletions
23
modules/geochemistry/doc/content/source/kernels/GeochemistryTimeDerivative.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# GeochemistryTimeDerivative | ||
|
||
This Kernel implements the PDE fragment | ||
\begin{equation} | ||
\phi \frac{\partial c}{\partial t} \ , | ||
\end{equation} | ||
which is part of the [transport](transport.md) equations. Here | ||
|
||
- $\phi$ is the porosity, which may be a fixed real number or may be an `AuxVariable` that is spatially-dependent | ||
- $c$ is the concentration (mol/m$^{3}$(aqueous solution)) of an aqueous species | ||
- $t$ is time | ||
|
||
Two notable features of this Kernel are: | ||
|
||
- it should not be used for cases were porosity is time-dependent (in this case $\phi$ should be inside the time derivative); | ||
- mass lumping to the nodes is used in order to reduce the possibility that concentration becomes negative. | ||
|
||
!syntax parameters /Kernels/GeochemistryTimeDerivative | ||
|
||
!syntax inputs /Kernels/GeochemistryTimeDerivative | ||
|
||
!syntax children /Kernels/GeochemistryTimeDerivative | ||
|
32 changes: 32 additions & 0 deletions
32
modules/geochemistry/include/kernels/GeochemistryDispersion.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "AnisotropicDiffusion.h" | ||
|
||
/** | ||
* Kernel describing grad(porosity * dispersion * grad(concentration)), where porosity is an | ||
* AuxVariable, dispersion is the hydrodynamic dispersion tensor (input by user as tensor_coeff), | ||
* and concentration is the variable for this Kernel | ||
*/ | ||
class GeochemistryDispersion : public AnisotropicDiffusion | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
GeochemistryDispersion(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real computeQpResidual() override; | ||
virtual Real computeQpJacobian() override; | ||
|
||
private: | ||
const VariableValue & _porosity; | ||
}; |
34 changes: 34 additions & 0 deletions
34
modules/geochemistry/include/kernels/GeochemistryTimeDerivative.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#pragma once | ||
|
||
#include "TimeKernel.h" | ||
|
||
/** | ||
* Kernel describing porosity * d(concentration)/dt, where porosity is an AuxVariable. | ||
* This Kernel should not be used if porosity is time-dependent. | ||
* Mass lumping is employed for numerical stability | ||
*/ | ||
class GeochemistryTimeDerivative : public TimeKernel | ||
{ | ||
public: | ||
static InputParameters validParams(); | ||
|
||
GeochemistryTimeDerivative(const InputParameters & parameters); | ||
|
||
protected: | ||
virtual Real computeQpResidual() override; | ||
virtual Real computeQpJacobian() override; | ||
|
||
private: | ||
const VariableValue & _nodal_u_dot; | ||
const VariableValue & _nodal_du_dot_du; | ||
const VariableValue & _porosity; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "GeochemistryDispersion.h" | ||
|
||
registerMooseObject("GeochemistryApp", GeochemistryDispersion); | ||
|
||
InputParameters | ||
GeochemistryDispersion::validParams() | ||
{ | ||
InputParameters params = AnisotropicDiffusion::validParams(); | ||
params.addCoupledVar("porosity", 1.0, "Porosity"); | ||
params.addClassDescription("Kernel describing grad(porosity * tensor_coeff * " | ||
"grad(concentration)), where porosity is an AuxVariable (or just " | ||
"a real number), tensor_coeff is the hydrodynamic dispersion tensor " | ||
"and concentration is the 'variable' for this Kernel"); | ||
return params; | ||
} | ||
|
||
GeochemistryDispersion::GeochemistryDispersion(const InputParameters & parameters) | ||
: AnisotropicDiffusion(parameters), _porosity(coupledValue("porosity")) | ||
{ | ||
} | ||
|
||
Real | ||
GeochemistryDispersion::computeQpResidual() | ||
{ | ||
return _porosity[_qp] * AnisotropicDiffusion::computeQpResidual(); | ||
} | ||
|
||
Real | ||
GeochemistryDispersion::computeQpJacobian() | ||
{ | ||
return _porosity[_qp] * AnisotropicDiffusion::computeQpJacobian(); | ||
} |
47 changes: 47 additions & 0 deletions
47
modules/geochemistry/src/kernels/GeochemistryTimeDerivative.C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//* This file is part of the MOOSE framework | ||
//* https://www.mooseframework.org | ||
//* | ||
//* All rights reserved, see COPYRIGHT for full restrictions | ||
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT | ||
//* | ||
//* Licensed under LGPL 2.1, please see LICENSE for details | ||
//* https://www.gnu.org/licenses/lgpl-2.1.html | ||
|
||
#include "GeochemistryTimeDerivative.h" | ||
|
||
registerMooseObject("GeochemistryApp", GeochemistryTimeDerivative); | ||
|
||
InputParameters | ||
GeochemistryTimeDerivative::validParams() | ||
{ | ||
InputParameters params = TimeKernel::validParams(); | ||
params.addCoupledVar("porosity", 1.0, "Porosity"); | ||
params.addClassDescription( | ||
"Kernel describing porosity * d(concentration)/dt, where porosity is an AuxVariable (or just " | ||
"a real number) and concentration is the 'variable' for this Kernel. This Kernel should not " | ||
"be used if porosity is time-dependent. Mass lumping is employed for numerical stability"); | ||
return params; | ||
} | ||
|
||
GeochemistryTimeDerivative::GeochemistryTimeDerivative(const InputParameters & parameters) | ||
: TimeKernel(parameters), | ||
_nodal_u_dot(_var.dofValuesDot()), | ||
_nodal_du_dot_du(_var.dofValuesDuDotDu()), | ||
_porosity(coupledValue("porosity")) | ||
{ | ||
} | ||
|
||
Real | ||
GeochemistryTimeDerivative::computeQpResidual() | ||
{ | ||
return _test[_i][_qp] * _porosity[_qp] * _nodal_u_dot[_i]; | ||
} | ||
|
||
Real | ||
GeochemistryTimeDerivative::computeQpJacobian() | ||
{ | ||
if (_i == _j) | ||
return _test[_i][_qp] * _porosity[_qp] * _nodal_du_dot_du[_j]; | ||
else | ||
return 0.0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# A step-like initial concentration is advected to the right using a constant velocity. | ||
# Because of the Dirichlet BC on the left, the step-like concentration profile is maintained (up to the usual numerical diffusion) | ||
# Because upwinding_type=full in the ConservativeAdvection Kernel, there are no overshoots and undershoots | ||
# The total amount of "conc" should increase by dt * velocity every timestep, as recorded by the front_position Postprocessor | ||
[Mesh] | ||
type = GeneratedMesh | ||
dim = 1 | ||
nx = 100 | ||
[] | ||
|
||
[Variables] | ||
[./conc] | ||
[../] | ||
[] | ||
|
||
[ICs] | ||
[./conc] | ||
type = FunctionIC | ||
function = 'if(x<=0.25, 1, 0)' | ||
variable = conc | ||
[../] | ||
[] | ||
|
||
[BCs] | ||
[./left] | ||
type = DirichletBC | ||
boundary = left | ||
value = 1.0 | ||
variable = conc | ||
[../] | ||
[] | ||
|
||
[Kernels] | ||
[./dot] | ||
type = GeochemistryTimeDerivative | ||
variable = conc | ||
[../] | ||
[./adv] | ||
type = ConservativeAdvection | ||
velocity = velocity | ||
upwinding_type = full | ||
variable = conc | ||
[../] | ||
[] | ||
|
||
[AuxVariables] | ||
[./velocity] | ||
family = MONOMIAL_VEC | ||
order = CONSTANT | ||
[../] | ||
[] | ||
|
||
[AuxKernels] | ||
[./velocity] | ||
type = VectorFunctionAux | ||
function = vel_fcn | ||
variable = velocity | ||
[../] | ||
[] | ||
|
||
[Functions] | ||
[./vel_fcn] | ||
type = ParsedVectorFunction | ||
value_x = 1 | ||
value_y = 0 | ||
value_z = 0 | ||
[../] | ||
[] | ||
|
||
[Executioner] | ||
type = Transient | ||
solve_type = Newton | ||
dt = 0.01 | ||
end_time = 0.1 | ||
[] | ||
|
||
[Postprocessors] | ||
[./front_position] | ||
type = ElementIntegralVariablePostprocessor | ||
variable = conc | ||
[../] | ||
[] | ||
|
||
[Outputs] | ||
csv = true | ||
[] | ||
|
Oops, something went wrong.