version 3.8
porousmediumflow/mpnc/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-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_MPNC_IO_FIELDS_HH
14#define DUMUX_MPNC_IO_FIELDS_HH
15
16#include <dune/common/exceptions.hh>
17
18#include <dumux/io/name.hh>
20
21namespace Dumux {
22
28{
29public:
30 template <class OutputModule>
31 static void initOutputModule(OutputModule& out)
32 {
33 using VolumeVariables = typename OutputModule::VolumeVariables;
34 using FluidSystem = typename VolumeVariables::FluidSystem;
35
36 for (int i = 0; i < VolumeVariables::numFluidPhases(); ++i)
37 {
38 out.addVolumeVariable([i](const auto& v){ return v.saturation(i); },
39 IOName::saturation<FluidSystem>(i));
40 out.addVolumeVariable([i](const auto& v){ return v.pressure(i); },
41 IOName::pressure<FluidSystem>(i));
42 out.addVolumeVariable([i](const auto& v){ return v.density(i); },
43 IOName::density<FluidSystem>(i));
44 out.addVolumeVariable([i](const auto& v){ return v.mobility(i); },
45 IOName::mobility<FluidSystem>(i));
46
47 for (int j = 0; j < VolumeVariables::numFluidComponents(); ++j)
48 out.addVolumeVariable([i,j](const auto& v){ return v.moleFraction(i,j); },
49 IOName::moleFraction<FluidSystem>(i, j));
50 }
51
52 for (int j = 0; j < VolumeVariables::numFluidComponents(); ++j)
53 out.addVolumeVariable([j](const auto& v){ return v.fugacity(j); },
54 "fugacity^"+ FluidSystem::componentName(j));
55
56
57 out.addVolumeVariable([](const auto& v){ return v.porosity(); },
59 }
60
61 template <class ModelTraits, class FluidSystem, class SolidSystem = void>
62 static std::string primaryVariableName(int pvIdx, int state=0)
63 {
64 if (pvIdx < ModelTraits::numFluidComponents())
65 return "fugacity^"+ FluidSystem::componentName(pvIdx);
66 else if (pvIdx < ModelTraits::numEq()-1)
67 return "S_"+ FluidSystem::phaseName(pvIdx - ModelTraits::numFluidComponents());
68 else
69 {
70 switch (ModelTraits::pressureFormulation())
71 {
73 return "p_"+ FluidSystem::phaseName(0);
75 return "p_"+ FluidSystem::phaseName(ModelTraits::numFluidPhases()-1);
76 default: DUNE_THROW(Dune::InvalidStateException, "Invalid formulation ");
77 }
78 }
79 }
80
81};
82
83} // end namespace Dumux
84
85#endif
Adds I/O fields specific to the mpnc model.
Definition: porousmediumflow/mpnc/iofields.hh:28
static std::string primaryVariableName(int pvIdx, int state=0)
Definition: porousmediumflow/mpnc/iofields.hh:62
static void initOutputModule(OutputModule &out)
Definition: porousmediumflow/mpnc/iofields.hh:31
A collection of input/output field names for common physical quantities.
std::string porosity() noexcept
I/O name of porosity.
Definition: name.hh:127
Definition: adapt.hh:17
Enumeration of the formulations accepted by the MpNc model.