version 3.11-dev
freeflow/navierstokes/mass/1pnc/iofields.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//
12#ifndef DUMUX_NAVIERSTOKES_MASS_1PNC_IO_FIELDS_HH
13#define DUMUX_NAVIERSTOKES_MASS_1PNC_IO_FIELDS_HH
14
15#include <dumux/io/name.hh>
16
17namespace Dumux {
18
23template<class BaseOutputFields>
25{
27 template <class OutputModule>
28 static void initOutputModule(OutputModule& out)
29 {
30 BaseOutputFields::initOutputModule(out);
31
32 // TODO only output molar density if we use mole fractions
33 out.addVolumeVariable([](const auto& v){ return v.molarDensity(); }, IOName::molarDensity());
34
35 using FluidSystem = typename OutputModule::VolumeVariables::FluidSystem;
36 for (int j = 0; j < FluidSystem::numComponents; ++j)
37 {
38 out.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, IOName::massFraction<FluidSystem>(0, j));
39 out.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, IOName::moleFraction<FluidSystem>(0, j));
40
41 if (j != FluidSystem::getMainComponent(0))
42 {
43 out.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(0,0, j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
44 }
45 }
46 }
47
49 template <class ModelTraits, class FluidSystem>
50 static std::string primaryVariableName(int pvIdx = 0, int state = 0)
51 {
52 // priVars: p, x_0, ..., x_numComp-1, otherPv ..., T
53 if (pvIdx > 0 && pvIdx < ModelTraits::numFluidComponents() + 1)
54 return ModelTraits::useMoles() ? IOName::moleFraction<FluidSystem>(0, pvIdx - 1)
55 : IOName::massFraction<FluidSystem>(0, pvIdx - 1);
56 else
57 return BaseOutputFields::template primaryVariableName<ModelTraits, FluidSystem>(pvIdx, state);
58
59 }
60
61 template<class VolumeVariables>
62 static double getEffectiveDiffusionCoefficient_(const VolumeVariables& volVars, const int phaseIdx, const int compIdx)
63 {
64 return volVars.effectiveDiffusionCoefficient(phaseIdx, VolumeVariables::FluidSystem::getMainComponent(phaseIdx), compIdx);
65 }
66};
67
68} // end namespace Dumux
69
70#endif
A collection of input/output field names for common physical quantities.
std::string molarDensity(int phaseIdx) noexcept
I/O name of molar density for multiphase systems.
Definition: name.hh:71
Definition: adapt.hh:17
Adds I/O fields specific to the FreeflowNC model.
Definition: freeflow/navierstokes/mass/1pnc/iofields.hh:25
static std::string primaryVariableName(int pvIdx=0, int state=0)
return the names of the primary variables
Definition: freeflow/navierstokes/mass/1pnc/iofields.hh:50
static void initOutputModule(OutputModule &out)
Initialize the FreeflowNC specific output fields.
Definition: freeflow/navierstokes/mass/1pnc/iofields.hh:28
static double getEffectiveDiffusionCoefficient_(const VolumeVariables &volVars, const int phaseIdx, const int compIdx)
Definition: freeflow/navierstokes/mass/1pnc/iofields.hh:62