zeroeqncnimodel.hh 17.3 KB
Newer Older
Thomas Fetzer's avatar
Thomas Fetzer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// -*- 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
 * \brief Base class for all models which use the non-isothermal
 *        compositional ZeroEq box model.
 */
#ifndef DUMUX_ZEROEQNCNI_MODEL_HH
#define DUMUX_ZEROEQNCNI_MODEL_HH

#include "zeroeqncniindices.hh"
#include "zeroeqncniproperties.hh"
#include <dumux/freeflow/zeroeqnc/zeroeqncmodel.hh>


namespace Dumux
{
/*!
 * \ingroup BoxZeroEqncniModel
Thomas Fetzer's avatar
[docu]    
Thomas Fetzer committed
36
 * \brief Adaption of the box scheme to the non-isothermal compositional ZeroEq model.
Thomas Fetzer's avatar
Thomas Fetzer committed
37
 *
Hao Wu's avatar
Hao Wu committed
38
39
40
41
 * This model implements an single-phase non-isothermal compositional free flow
 * solving the mass and the momentum balance. For the momentum balance
 * the Reynolds-averaged Navier-Stokes (RANS) equation with zero equation
 * (algebraic) turbulence model is used.
Thomas Fetzer's avatar
Thomas Fetzer committed
42
 *
Hao Wu's avatar
Hao Wu committed
43
 * Mass balance:
Thomas Fetzer's avatar
Thomas Fetzer committed
44
 * \f[
Hao Wu's avatar
Hao Wu committed
45
 *  \frac{\partial \varrho_\textrm{g}}{\partial t}
Thomas Fetzer's avatar
Thomas Fetzer committed
46
 *  + \text{div} \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} \right)
Hao Wu's avatar
Hao Wu committed
47
 *  - q_\textrm{g} = 0
Thomas Fetzer's avatar
Thomas Fetzer committed
48
49
 * \f]
 *
Hao Wu's avatar
Hao Wu committed
50
 * Momentum Balance:
Thomas Fetzer's avatar
Thomas Fetzer committed
51
 * \f[
Hao Wu's avatar
Hao Wu committed
52
 *   \frac{\partial \left(\varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g}\right)}{\partial t}
Thomas Fetzer's avatar
Thomas Fetzer committed
53
 *   + \text{div} \left(
Hao Wu's avatar
Hao Wu committed
54
55
 *     \varrho_\textrm{g} {\boldsymbol{v}_\textrm{g} {\boldsymbol{v}}_\textrm{g}}
 *     - \left[ \mu_\textrm{g} + \mu_\textrm{g,t} \right]
Thomas Fetzer's avatar
Thomas Fetzer committed
56
57
 *       \left( \textbf{grad}\, \boldsymbol{v}_\textrm{g}
 *              + \textbf{grad}\, \boldsymbol{v}_\textrm{g}^T \right)
Hao Wu's avatar
Hao Wu committed
58
59
 *   \right)
 *   + \left(p_\textrm{g} {\bf {I}} \right)
Thomas Fetzer's avatar
Thomas Fetzer committed
60
 *   - \varrho_\textrm{g} {\bf g} = 0
Thomas Fetzer's avatar
Thomas Fetzer committed
61
62
 * \f]
 *
Hao Wu's avatar
Hao Wu committed
63
 * Component mass balance equations:
Thomas Fetzer's avatar
Thomas Fetzer committed
64
 * \f[
Hao Wu's avatar
Hao Wu committed
65
 *  \frac{\partial \left(\varrho_\textrm{g} X_\textrm{g}^\kappa\right)}{\partial t}
Thomas Fetzer's avatar
Thomas Fetzer committed
66
 *  + \text{div} \left( \varrho_\textrm{g} {\boldsymbol{v}}_\textrm{g} X_\textrm{g}^\kappa
Hao Wu's avatar
Hao Wu committed
67
 *  - \left[ D^\kappa_\textrm{g} + D^\kappa_\textrm{g,t} \right]
Thomas Fetzer's avatar
Thomas Fetzer committed
68
 *    \varrho_\textrm{g} \frac{M^\kappa}{M_\textrm{g}} \textbf{grad}\, x_\textrm{g}^\kappa \right)
Hao Wu's avatar
Hao Wu committed
69
 *  - q_\textrm{g}^\kappa = 0
Thomas Fetzer's avatar
Thomas Fetzer committed
70
71
 * \f]
 *
Hao Wu's avatar
Hao Wu committed
72
 * Energy balance equation:
Thomas Fetzer's avatar
Thomas Fetzer committed
73
 * \f[
Hao Wu's avatar
Hao Wu committed
74
 *  \frac{\partial (\varrho_\textrm{g}  u_\textrm{g})}{\partial t}
Thomas Fetzer's avatar
Thomas Fetzer committed
75
 *  + \text{div} \left( \varrho_\textrm{g} h_\textrm{g} {\boldsymbol{v}}_\textrm{g}
Hao Wu's avatar
Hao Wu committed
76
 *  - \sum_\kappa \left( h^\kappa_\textrm{g} \left[ D^\kappa_\textrm{g} + D^\kappa_\textrm{g,t} \right]
Thomas Fetzer's avatar
Thomas Fetzer committed
77
78
 *                       \varrho_\textrm{g} \frac{M^\kappa}{M_\textrm{g}} \textbf{grad}\, x^\kappa_\textrm{g} \right)
 *  - \left[ \lambda_\textrm{g} + \lambda_\textrm{g,t} \right] \textbf{grad}\, T \right)
Hao Wu's avatar
Hao Wu committed
79
 *  - q_\textrm{T} = 0
Thomas Fetzer's avatar
Thomas Fetzer committed
80
 * \f]
Thomas Fetzer's avatar
Thomas Fetzer committed
81
82
 * Please note that, even though it is n-component model, the diffusive
 * fluxes are still calculated with binary diffusion.
Thomas Fetzer's avatar
Thomas Fetzer committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
 *
 * This is discretized by a fully-coupled vertex-centered finite volume
 * (box) scheme in space and by the implicit Euler method in time.
 */
template<class TypeTag>
class ZeroEqncniModel : public ZeroEqncModel<TypeTag>
{
    typedef ZeroEqncModel<TypeTag> ParentType;
    typedef typename GET_PROP_TYPE(TypeTag, Model) Implementation;
    typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
    typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
    typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;

    enum {
        dim = GridView::dimension,
        dimWorld = GridView::dimensionworld,
        intervals = GET_PROP_VALUE(TypeTag, NumberOfIntervals),
        walls = (GET_PROP_VALUE(TypeTag, BBoxMinIsWall) ? 1 : 0)
Thomas Fetzer's avatar
Thomas Fetzer committed
101
                + (GET_PROP_VALUE(TypeTag, BBoxMaxIsWall) ? 1 : 0)
Thomas Fetzer's avatar
Thomas Fetzer committed
102
    };
Thomas Fetzer's avatar
Thomas Fetzer committed
103
104
    enum { transportCompIdx = Indices::transportCompIdx,
           numComponents = Indices::numComponents };
Thomas Fetzer's avatar
Thomas Fetzer committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    enum { phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx) };

    typedef typename GridView::template Codim<0>::Iterator ElementIterator;
    typedef typename GridView::IntersectionIterator IntersectionIterator;

    typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;

    typedef typename GridView::template Codim<0>::Entity Element;
    typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
    typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;

    typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
    typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
    typedef typename GET_PROP_TYPE(TypeTag, FluxVariables) FluxVariables;
    typedef typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables) ElementVolumeVariables;


public:
    ZeroEqncniModel()
        : flowNormal_(GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, FlowNormal))
        , wallNormal_(GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, WallNormal))
    {
        eps_ = 1e-6;

        // check whether sand grain roughness may be used
        if (GET_PARAM_FROM_GROUP(TypeTag, Scalar, ZeroEq, BBoxMinSandGrainRoughness) > 0
            || GET_PARAM_FROM_GROUP(TypeTag, Scalar, ZeroEq, BBoxMaxSandGrainRoughness) > 0)
        {
            Dune::dwarn << "warning: surface roughness will not be used for eddy conductivity models." << std::endl;
        }
    }

Hao Wu's avatar
Hao Wu committed
137
    //! \copydoc ImplicitModel::addOutputVtkFields
Thomas Fetzer's avatar
Thomas Fetzer committed
138
139
140
141
142
    template <class MultiWriter>
    void addOutputVtkFields(const SolutionVector &sol,
                            MultiWriter &writer)
    {
        typedef Dune::BlockVector<Dune::FieldVector<Scalar, 1> > ScalarField;
Thomas Fetzer's avatar
Thomas Fetzer committed
143
        typedef Dune::BlockVector<Dune::FieldVector<Scalar, dim> > VectorField;
Thomas Fetzer's avatar
Thomas Fetzer committed
144
145
146

        // create the required scalar fields
        unsigned numVertices = this->gridView_().size(dim);
Thomas Fetzer's avatar
Thomas Fetzer committed
147
        unsigned numElements = this->gridView_().size(0);
Thomas Fetzer's avatar
Thomas Fetzer committed
148
149
        ScalarField &pN = *writer.allocateManagedBuffer(numVertices);
        ScalarField &delP = *writer.allocateManagedBuffer(numVertices);
Thomas Fetzer's avatar
Thomas Fetzer committed
150
151
        ScalarField *moleFraction[numComponents];
        ScalarField *massFraction[numComponents];
Thomas Fetzer's avatar
Thomas Fetzer committed
152
        ScalarField &rho = *writer.allocateManagedBuffer(numVertices);
Thomas Fetzer's avatar
Thomas Fetzer committed
153
        VectorField &velocity = *writer.template allocateManagedBuffer<Scalar, dim> (numVertices);
Thomas Fetzer's avatar
Thomas Fetzer committed
154
        ScalarField &mu = *writer.allocateManagedBuffer(numVertices);
Thomas Fetzer's avatar
Thomas Fetzer committed
155
        ScalarField &D = *writer.allocateManagedBuffer(numVertices);
Thomas Fetzer's avatar
Thomas Fetzer committed
156
        ScalarField &T = *writer.allocateManagedBuffer(numVertices);
Thomas Fetzer's avatar
Thomas Fetzer committed
157
158
        ScalarField &lambda = *writer.allocateManagedBuffer(numVertices);
        ScalarField &mut = *writer.allocateManagedBuffer(numElements);
Thomas Fetzer's avatar
Thomas Fetzer committed
159
        ScalarField &nut = *writer.allocateManagedBuffer(numElements);
Thomas Fetzer's avatar
Thomas Fetzer committed
160
161
162
163
164
        ScalarField &lmix = *writer.allocateManagedBuffer(numElements);
        ScalarField &uPlus = *writer.allocateManagedBuffer(numElements);
        ScalarField &yPlus = *writer.allocateManagedBuffer(numElements);
        ScalarField &Dt = *writer.allocateManagedBuffer(numElements);
        ScalarField &lambdat = *writer.allocateManagedBuffer(numElements);
Thomas Fetzer's avatar
Thomas Fetzer committed
165
        ScalarField &rank = *writer.allocateManagedBuffer(numElements);
Thomas Fetzer's avatar
Thomas Fetzer committed
166
167
168
169
170
171
172
173
174
        for (int i = 0; i < numComponents; ++i)
            moleFraction[i] = writer.template allocateManagedBuffer<Scalar, 1>(numVertices);
        for (int i = 0; i < numComponents; ++i)
            massFraction[i] = writer.template allocateManagedBuffer<Scalar, 1>(numVertices);

        // write volume values to .vtu and .csv
        std::ofstream volVarsFile("volVarsData.csv", std::ios_base::out);
        asImp_().writeVolVarsHeader(volVarsFile);
        volVarsFile << std::endl;
Thomas Fetzer's avatar
Thomas Fetzer committed
175
176
177
178

        FVElementGeometry fvGeometry;
        VolumeVariables volVars;

Hao Wu's avatar
Hao Wu committed
179
180
181
        ElementIterator eIt = this->gridView_().template begin<0>();
        ElementIterator eEndIt = this->gridView_().template end<0>();
        for (; eIt != eEndIt; ++eIt)
Thomas Fetzer's avatar
Thomas Fetzer committed
182
        {
Hao Wu's avatar
Hao Wu committed
183
            int idx = this->elementMapper().map(*eIt);
Thomas Fetzer's avatar
Thomas Fetzer committed
184
185
            rank[idx] = this->gridView_().comm().rank();

Hao Wu's avatar
Hao Wu committed
186
            fvGeometry.update(this->gridView_(), *eIt);
Thomas Fetzer's avatar
Thomas Fetzer committed
187

Hao Wu's avatar
Hao Wu committed
188
            int numLocalVerts = eIt->template count<dim>();
Thomas Fetzer's avatar
Thomas Fetzer committed
189
190
            for (int i = 0; i < numLocalVerts; ++i)
            {
Hao Wu's avatar
Hao Wu committed
191
192
                int vIdxGlobal = this->vertexMapper().map(*eIt, i, dim);
                volVars.update(sol[vIdxGlobal],
Thomas Fetzer's avatar
Thomas Fetzer committed
193
                               this->problem_(),
Hao Wu's avatar
Hao Wu committed
194
                               *eIt,
Thomas Fetzer's avatar
Thomas Fetzer committed
195
196
197
198
                               fvGeometry,
                               i,
                               false);

Thomas Fetzer's avatar
Thomas Fetzer committed
199
200
                pN[vIdxGlobal] = volVars.pressure();
                delP[vIdxGlobal] = volVars.pressure() - 1e5;
Thomas Fetzer's avatar
Thomas Fetzer committed
201
202
203
204
205
206
207
                for (int compIdx = 0; compIdx < numComponents; ++compIdx)
                {
                    (*moleFraction[compIdx])[vIdxGlobal]= volVars.moleFraction(compIdx);
                    (*massFraction[compIdx])[vIdxGlobal]= volVars.massFraction(compIdx);
                    Valgrind::CheckDefined((*moleFraction[compIdx])[vIdxGlobal]);
                    Valgrind::CheckDefined((*massFraction[compIdx])[vIdxGlobal]);
                }
Thomas Fetzer's avatar
Thomas Fetzer committed
208
209
210
                rho[vIdxGlobal] = volVars.density();
                mu[vIdxGlobal] = volVars.dynamicViscosity();
                D[vIdxGlobal] = volVars.diffusionCoeff(transportCompIdx);
Hao Wu's avatar
Hao Wu committed
211
                T[vIdxGlobal] = volVars.temperature();
Thomas Fetzer's avatar
Thomas Fetzer committed
212
213
214
215
                velocity[vIdxGlobal] = volVars.velocity();

                asImp_().writeVolVarsData(volVarsFile, volVars);
                volVarsFile << std::endl;
Thomas Fetzer's avatar
Thomas Fetzer committed
216
217
            }
        }
Thomas Fetzer's avatar
Thomas Fetzer committed
218
219
        volVarsFile.close();

Thomas Fetzer's avatar
Thomas Fetzer committed
220
221
        writer.attachVertexData(pN, "P");
        writer.attachVertexData(delP, "delP");
Thomas Fetzer's avatar
Thomas Fetzer committed
222
223
224
225
226
227
228
229
230
231
232
233
234

        for (int j = 0; j < numComponents; ++j)
        {
            std::ostringstream moleFrac, massFrac;
            moleFrac << "x_" << FluidSystem::phaseName(phaseIdx)
                     << "^" << FluidSystem::componentName(j);
            writer.attachVertexData(*moleFraction[j], moleFrac.str().c_str());

            massFrac << "X_" << FluidSystem::phaseName(phaseIdx)
                     << "^" << FluidSystem::componentName(j);
            writer.attachVertexData(*massFraction[j], massFrac.str().c_str());
        }

Thomas Fetzer's avatar
Thomas Fetzer committed
235
236
        writer.attachVertexData(rho, "rho");
        writer.attachVertexData(mu, "mu");
Thomas Fetzer's avatar
Thomas Fetzer committed
237
238
        writer.attachVertexData(D, "D");
        writer.attachVertexData(lambda, "lambda");
Thomas Fetzer's avatar
Thomas Fetzer committed
239
        writer.attachVertexData(T, "temperature");
Thomas Fetzer's avatar
Thomas Fetzer committed
240
        writer.attachVertexData(velocity, "v", dim);
Thomas Fetzer's avatar
Thomas Fetzer committed
241

Thomas Fetzer's avatar
Thomas Fetzer committed
242
        // ensure that the actual values are given out
Thomas Fetzer's avatar
Thomas Fetzer committed
243
244
        asImp_().updateWallProperties();

Thomas Fetzer's avatar
Thomas Fetzer committed
245
246
247
248
249
        // write flux values to .vtu and .csv
        std::ofstream fluxFile("fluxVarsData.csv", std::ios_base::out);
        asImp_().writeFluxVarsHeader(fluxFile);
        fluxFile << std::endl;

Hao Wu's avatar
Hao Wu committed
250
251
252
        eIt = this->gridView_().template begin<0>();
        eEndIt = this->gridView_().template end<0>();
        for (; eIt != eEndIt; ++eIt)
Thomas Fetzer's avatar
Thomas Fetzer committed
253
        {
Hao Wu's avatar
Hao Wu committed
254
            fvGeometry.update(this->gridView_(), *eIt);
Thomas Fetzer's avatar
Thomas Fetzer committed
255
256
257

            ElementVolumeVariables elemVolVars;
            elemVolVars.update(this->problem_(),
Hao Wu's avatar
Hao Wu committed
258
                               *eIt,
Thomas Fetzer's avatar
Thomas Fetzer committed
259
260
261
                               fvGeometry,
                               false);

Thomas Fetzer's avatar
Thomas Fetzer committed
262
263
            unsigned int numFluxVars = 0;
            Scalar sumDynamicEddyViscosity = 0.0;
Thomas Fetzer's avatar
Thomas Fetzer committed
264
            Scalar sumKinematicEddyViscosity = 0.0;
Thomas Fetzer's avatar
Thomas Fetzer committed
265
266
267
268
269
            Scalar sumMixingLength = 0.0;
            Scalar sumUPlus = 0.0;
            Scalar sumYPlus = 0.0;
            Scalar sumEddyDiffusivity = 0.0;
            Scalar sumEddyConducitivity = 0.0;
Thomas Fetzer's avatar
Thomas Fetzer committed
270

Thomas Fetzer's avatar
Thomas Fetzer committed
271
272
273
            IntersectionIterator isIt = this->gridView_().ibegin(*eIt);
            IntersectionIterator isEndIt = this->gridView_().iend(*eIt);
            for (; isIt != isEndIt; ++isIt)
Thomas Fetzer's avatar
Thomas Fetzer committed
274
            {
Hao Wu's avatar
Hao Wu committed
275
                int fIdx = isIt->indexInInside();
Thomas Fetzer's avatar
Thomas Fetzer committed
276
277

                FluxVariables fluxVars(this->problem_(),
Hao Wu's avatar
Hao Wu committed
278
                                                    *eIt,
Thomas Fetzer's avatar
Thomas Fetzer committed
279
                                                    fvGeometry,
Hao Wu's avatar
Hao Wu committed
280
                                                    fIdx,
Thomas Fetzer's avatar
Thomas Fetzer committed
281
282
283
                                                    elemVolVars,
                                                    false);

Thomas Fetzer's avatar
Thomas Fetzer committed
284
285
                asImp_().writeFluxVarsData(fluxFile, fluxVars);
                fluxFile << std::endl;
Thomas Fetzer's avatar
Thomas Fetzer committed
286

Thomas Fetzer's avatar
Thomas Fetzer committed
287
                sumDynamicEddyViscosity += fluxVars.dynamicEddyViscosity();
Thomas Fetzer's avatar
Thomas Fetzer committed
288
                sumKinematicEddyViscosity += fluxVars.kinematicEddyViscosity();
Thomas Fetzer's avatar
Thomas Fetzer committed
289
290
291
292
293
294
                sumMixingLength += fluxVars.mixingLength();
                sumUPlus += fluxVars.uPlus();
                sumYPlus += fluxVars.yPlusRough();
                sumEddyDiffusivity += fluxVars.eddyDiffusivity();
                sumEddyConducitivity += fluxVars.thermalEddyConductivity();
                numFluxVars += 1;
Thomas Fetzer's avatar
Thomas Fetzer committed
295
            }
Thomas Fetzer's avatar
Thomas Fetzer committed
296
297
298

            int eIdxGlobal = this->elementMapper().map(*eIt);
            mut[eIdxGlobal] = sumDynamicEddyViscosity / numFluxVars;
Thomas Fetzer's avatar
Thomas Fetzer committed
299
            nut[eIdxGlobal] = sumKinematicEddyViscosity / numFluxVars;
Thomas Fetzer's avatar
Thomas Fetzer committed
300
301
302
303
304
            lmix[eIdxGlobal] = sumMixingLength / numFluxVars;
            uPlus[eIdxGlobal] = sumUPlus / numFluxVars;
            yPlus[eIdxGlobal] = sumYPlus / numFluxVars;
            Dt[eIdxGlobal] = sumEddyDiffusivity / numFluxVars;
            lambdat[eIdxGlobal] = sumEddyConducitivity / numFluxVars;
Thomas Fetzer's avatar
Thomas Fetzer committed
305
        }
Thomas Fetzer's avatar
Thomas Fetzer committed
306
307
308
        fluxFile.close();

        writer.attachCellData(mut, "mu_t");
Thomas Fetzer's avatar
Thomas Fetzer committed
309
        writer.attachCellData(nut, "nu_t");
Thomas Fetzer's avatar
Thomas Fetzer committed
310
311
312
313
314
        writer.attachCellData(lmix, "l_mix");
        writer.attachCellData(uPlus, "u^+");
        writer.attachCellData(yPlus, "y^+");
        writer.attachCellData(Dt, "D_t");
        writer.attachCellData(lambdat, "lambda_t");
Thomas Fetzer's avatar
Thomas Fetzer committed
315
316
    }

Thomas Fetzer's avatar
Thomas Fetzer committed
317
318
    //! \copydoc ZeroEqModel::writeFluxVarsHeader
    void writeFluxVarsHeader(std::ofstream &stream)
Thomas Fetzer's avatar
Thomas Fetzer committed
319
    {
Thomas Fetzer's avatar
Thomas Fetzer committed
320
321
        ParentType::writeFluxVarsHeader(stream);
        stream << "," << "EddyConductivity";
Thomas Fetzer's avatar
Thomas Fetzer committed
322
323
    }

Thomas Fetzer's avatar
Thomas Fetzer committed
324
325
    //! \copydoc ZeroEqModel::writeFluxVarsData
    void writeFluxVarsData(std::ofstream &stream, const FluxVariables &fluxVars)
Thomas Fetzer's avatar
Thomas Fetzer committed
326
    {
Thomas Fetzer's avatar
Thomas Fetzer committed
327
328
        ParentType::writeFluxVarsData(stream, fluxVars);
        stream << "," << fluxVars.thermalEddyConductivity();
Thomas Fetzer's avatar
Thomas Fetzer committed
329
330
    }

Thomas Fetzer's avatar
Thomas Fetzer committed
331
332
333
334
    /*!
     * \name Wall properties
     */
    // \{
Thomas Fetzer's avatar
Thomas Fetzer committed
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367


    //! \copydoc ZeroEqModel::resetWallProperties
    void resetWallProperties()
    {
        ParentType::resetWallProperties();

        for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
            for (int posIdx = 0; posIdx < intervals; ++posIdx)
            {
                this->wall[wallIdx].maxTemperature[posIdx] = 0.0;
            }
    }

    //! \copydoc ZeroEqModel::calculateMaxFluxVars
    void calculateMaxFluxVars(const FluxVariables &fluxVars, const GlobalPosition &globalPos)
    {
        ParentType::calculateMaxFluxVars(fluxVars, globalPos);

        int posIdx = this->getPosIdx(globalPos);
        int wallIdx = this->getWallIdx(globalPos, posIdx);
        if (this->wall[wallIdx].maxTemperature[posIdx] < fluxVars.temperature())
            for (int wallIdx = 0; wallIdx < walls; ++wallIdx)
                this->wall[wallIdx].maxTemperature[posIdx] = fluxVars.temperature();
    }

    //! \copydoc ZeroEqModel::doInterpolationFluxValues
    const void doInterpolationFluxValues(const int wallIdx, const int posIdx, const int prevIdx, const int nextIdx)
    {
        ParentType::doInterpolationFluxValues(wallIdx, posIdx, prevIdx, nextIdx);
        this->wall[wallIdx].maxTemperature[posIdx] = this->interpolation(posIdx, prevIdx, this->wall[wallIdx].maxTemperature[prevIdx], nextIdx, this->wall[wallIdx].maxTemperature[nextIdx]);
    }

Thomas Fetzer's avatar
Thomas Fetzer committed
368
369
    // \} // wall properties

Thomas Fetzer's avatar
Thomas Fetzer committed
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
    /*!
     * \brief Returns the name of used the eddy conductivity model.
     */
    const char *eddyConductivityModelName() const
    {
        switch (GET_PARAM_FROM_GROUP(TypeTag, int, ZeroEq, EddyConductivityModel))
        {
            case EddyConductivityIndices::noEddyConductivityModel: // 0
                return "noEddyConductivityModel";
                break;
            case EddyConductivityIndices::reynoldsAnalogy: // 1
                return "reynoldsAnalogy";
                break;
            case EddyConductivityIndices::modifiedVanDriest: // 2
                return "modifiedVanDriest";
                break;
            case EddyConductivityIndices::deissler: // 3
                return "deissler";
                break;
            case EddyConductivityIndices::meier: // 4
                return "meier";
                break;
            default:
                DUNE_THROW(Dune::NotImplemented, "This eddy conductivity model is not implemented.");
        }
    }

private:
    Scalar eps_;
    const int flowNormal_;
    const int wallNormal_;

    Implementation &asImp_()
    { return *static_cast<Implementation*>(this); }
    const Implementation &asImp_() const
    { return *static_cast<const Implementation*>(this); }
};

}

#include "zeroeqncnipropertydefaults.hh"

#endif // DUMUX_ZEROEQNCNI_MODEL_HH