simplebiominreactions.hh 4.91 KB
Newer Older
Simon Scholz's avatar
Simon Scholz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
 *   See the file COPYING for full copying permissions.                      *
 *                                                                           *
 *   This program is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
 *   the Free Software Foundation, either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
 *****************************************************************************/
/*!
 * \file
 * \ingroup Chemistry
22
 * \brief The source and sink terms due to reactions are calculated in this class.
Simon Scholz's avatar
Simon Scholz committed
23
24
25
26
27
28
29
30
 */
#ifndef DUMUX_BIOMIN_REACTIONS_HH
#define DUMUX_BIOMIN_REACTIONS_HH

namespace Dumux {

/*!
 * \ingroup Chemistry
31
 * \brief The source and sink terms due to reactions are calculated in this class.
Simon Scholz's avatar
Simon Scholz committed
32
 */
33
template< class NumEqVector, class VolumeVariables >
Simon Scholz's avatar
Simon Scholz committed
34
35
class SimpleBiominReactions
{
36
37
38
    using SolidSystem = typename VolumeVariables::SolidSystem;
    using FluidSystem = typename VolumeVariables::FluidSystem;
    using Scalar = typename FluidSystem::Scalar;
Simon Scholz's avatar
Simon Scholz committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

public:

    SimpleBiominReactions()
    {   //ureolysis kinetic parameters
        kub_ = getParam<Scalar>("UreolysisCoefficients.Kub");
        kurease_ = getParam<Scalar>("UreolysisCoefficients.Kurease");
        ku_ = getParam<Scalar>("UreolysisCoefficients.Ku");
    }

    static constexpr int liquidPhaseIdx = FluidSystem::liquidPhaseIdx;
    static constexpr int numComponents = FluidSystem::numComponents;

    static constexpr int H2OIdx = FluidSystem::H2OIdx;
    static constexpr int CO2Idx = FluidSystem::CO2Idx;
    static constexpr int CaIdx = FluidSystem::CaIdx;
    static constexpr int UreaIdx = FluidSystem::UreaIdx;

    // phase indices when used for the SolidSystem context (e.g. density)
    static constexpr int BiofilmPhaseIdx = SolidSystem::BiofilmIdx;
    // overall indices when used in the problem context (source term)
    static constexpr int BiofilmIdx = SolidSystem::BiofilmIdx+numComponents;
    static constexpr int CalciteIdx = SolidSystem::CalciteIdx+numComponents;

    /*!
     * \brief Returns the molality of a component x (mol x / kg solvent) for a given
     * mole fraction (mol x / mol solution)
     * The salinity and the mole Fraction of CO2 are considered
     *
     */
    static Scalar moleFracToMolality(Scalar moleFracX, Scalar moleFracSalinity, Scalar moleFracCTot)
    {
        Scalar molalityX = moleFracX / (1 - moleFracSalinity - moleFracCTot) / FluidSystem::molarMass(H2OIdx);
        return molalityX;
    }

    /*!
     * \brief Calculate the source/sink term due to reactions.
     *
     * \param Source The source
     * \param volVars The volume variables
     */
81
    void reactionSource(NumEqVector &q, const VolumeVariables &volVars)
Simon Scholz's avatar
Simon Scholz committed
82
83
84
85
86
87
88
89
90
    {
        //   define and compute some parameters for convenience:
        Scalar xwCa = volVars.moleFraction(liquidPhaseIdx,CaIdx);
        Scalar densityBiofilm = volVars.solidComponentDensity(BiofilmPhaseIdx);

        Scalar volFracBiofilm = volVars.solidVolumeFraction(BiofilmPhaseIdx);

        if (volFracBiofilm < 0)
            volFracBiofilm = 0;
91

Simon Scholz's avatar
Simon Scholz committed
92
93
94
95
96
97
98
99
100
101
102
        // TODO: dumux-course-task
        // implement mass of biofilm

        Scalar molalityUrea = moleFracToMolality(volVars.moleFraction(liquidPhaseIdx,UreaIdx),
                                                 xwCa,
                                                 volVars.moleFraction(liquidPhaseIdx,CO2Idx));  // [mol_urea/kg_H2O]

        // TODO: dumux-course-task
        // compute rate of ureolysis by implementing Z_urease,biofilm and r_urea

        // compute/set dissolution and precipitation rate of calcite
103
104
        Scalar rprec = 0.0;
        rprec = rurea;
Simon Scholz's avatar
Simon Scholz committed
105
106
107
108

        // set source terms
        // TODO: dumux-course-task
        // update terms according to stochiometry
109
110
111
112
113
114
        q[H2OIdx]     += 0.0;
        q[CO2Idx]     += 0.0;
        q[CaIdx]      += 0.0;
        q[UreaIdx]    += 0.0;
        q[BiofilmIdx] += 0.0;
        q[CalciteIdx] += 0.0;
Simon Scholz's avatar
Simon Scholz committed
115
    }
116

Simon Scholz's avatar
Simon Scholz committed
117
118
119
120
121
122
123
124
125
126
private:
    // urease parameters
    Scalar kub_;
    Scalar kurease_;
    Scalar ku_;
};

} //end namespace Dumux

#endif