version 3.11-dev
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
porousmediumflow/richardsextended/localresidual.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
14#ifndef DUMUX_RICHARDSEXTENDED_LOCAL_RESIDUAL_HH
15#define DUMUX_RICHARDSEXTENDED_LOCAL_RESIDUAL_HH
16
24
25namespace Dumux {
26
32template<class TypeTag>
34{
35 using ParentType = RichardsLocalResidual<TypeTag>;
40 using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
42 using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView;
44 using FVElementGeometry = typename GridGeometry::LocalView;
45 using SubControlVolume = typename GridGeometry::SubControlVolume;
46 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
47 using GridView = typename GridGeometry::GridView;
48 using Element = typename GridView::template Codim<0>::Entity;
52 // first index for the mass balance
53 enum { conti0EqIdx = Indices::conti0EqIdx };
54
55 // phase & component indices
56 static constexpr auto liquidPhaseIdx = FluidSystem::phase0Idx;
57 static constexpr auto gasPhaseIdx = FluidSystem::phase1Idx;
58 static constexpr auto liquidCompIdx = FluidSystem::comp0Idx;
59
60public:
61 using ParentType::ParentType;
62
71 NumEqVector computeStorage(const Problem& problem,
72 const SubControlVolume& scv,
73 const VolumeVariables& volVars) const
74 {
75 NumEqVector storage = ParentType::computeStorage(problem, scv, volVars);
76 // for extended Richards we consider water in air
77 storage[conti0EqIdx] += volVars.porosity()
78 * volVars.molarDensity(gasPhaseIdx)
79 * volVars.moleFraction(gasPhaseIdx, liquidCompIdx)
80 * FluidSystem::molarMass(liquidCompIdx)
81 * volVars.saturation(gasPhaseIdx);
82
83 return storage;
84 }
85
86
97 NumEqVector computeFlux(const Problem& problem,
98 const Element& element,
99 const FVElementGeometry& fvGeometry,
100 const ElementVolumeVariables& elemVolVars,
101 const SubControlVolumeFace& scvf,
102 const ElementFluxVariablesCache& elemFluxVarsCache) const
103 {
104 FluxVariables fluxVars;
105 fluxVars.init(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
106 NumEqVector flux = ParentType::computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache);
107
108 // for extended Richards we consider water vapor diffusion in air
109 //check for the reference system and adapt units of the diffusive flux accordingly.
110 if (FluxVariables::MolecularDiffusionType::referenceSystemFormulation() == ReferenceSystemFormulation::massAveraged)
111 flux[conti0EqIdx] += fluxVars.molecularDiffusionFlux(gasPhaseIdx)[liquidCompIdx];
112 else
113 flux[conti0EqIdx] += fluxVars.molecularDiffusionFlux(gasPhaseIdx)[liquidCompIdx]*FluidSystem::molarMass(liquidCompIdx);
114
115 return flux;
116 }
117};
118
119} // end namespace Dumux
120
121#endif
Element-wise calculation of the Jacobian matrix for problems using the extended Richards fully implic...
Definition: porousmediumflow/richardsextended/localresidual.hh:34
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluates the rate of change of all conservation quantites (e.g. phase mass) within a sub-control vol...
Definition: porousmediumflow/richardsextended/localresidual.hh:71
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluates the mass flux over a face of a sub control volume.
Definition: porousmediumflow/richardsextended/localresidual.hh:97
Element-wise calculation of the Jacobian matrix for problems using the Richards fully implicit models...
Definition: porousmediumflow/richards/localresidual.hh:48
NumEqVector computeStorage(const Problem &problem, const SubControlVolume &scv, const VolumeVariables &volVars) const
Evaluates the rate of change of all conservation quantites (e.g. phase mass) within a sub-control vol...
Definition: porousmediumflow/richards/localresidual.hh:100
NumEqVector computeFlux(const Problem &problem, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolumeFace &scvf, const ElementFluxVariablesCache &elemFluxVarsCache) const
Evaluates the mass flux over a face of a sub control volume.
Definition: porousmediumflow/richards/localresidual.hh:129
Defines all properties used in Dumux.
Type traits.
Helper classes to compute the integration elements.
typename NumEqVectorTraits< PrimaryVariables >::type NumEqVector
A vector with the same size as numbers of equations This is the default implementation and has to be ...
Definition: numeqvector.hh:34
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
Definition: adapt.hh:17
A helper to deduce a vector with the same size as numbers of equations.
Element-wise calculation of the Jacobian matrix for problems using the Richards fully implicit models...
The reference frameworks and formulations available for splitting total fluxes into a advective and d...