26#ifndef DUMUX_MAXWELL_STEFAN_TEST_PROBLEM_HH
27#define DUMUX_MAXWELL_STEFAN_TEST_PROBLEM_HH
29#include <dune/grid/yaspgrid.hh>
45template <
class TypeTag>
46class MaxwellStefanTestProblem;
57template<
class TypeTag>
58struct Grid<TypeTag, TTag::MaxwellStefanTest> {
using type = Dune::YaspGrid<2>; };
61template<
class TypeTag>
65template<
class TypeTag>
74template<
class TypeTag>
75struct UseMoles<TypeTag, TTag::MaxwellStefanTest> {
static constexpr bool value =
true; };
78template<
class TypeTag>
82template<
class TypeTag>
84:
public FluidSystems::Base<GetPropType<TypeTag, Properties::Scalar>, MaxwellStefanTracerFluidSystem<TypeTag>>
90 using Element =
typename GridView::template Codim<0>::Entity;
92 using SubControlVolume =
typename FVElementGeometry::SubControlVolume;
113 DUNE_THROW(Dune::InvalidStateException,
"Invalid component index " << compIdx);
127 const Problem& problem,
128 const Element& element,
129 const SubControlVolume& scv)
137 DUNE_THROW(Dune::InvalidStateException,
138 "Binary diffusion coefficient of component "
139 << compIdx <<
" is undefined!\n");
145 unsigned int compJIdx,
146 const Problem& problem,
147 const Element& element,
148 const SubControlVolume& scv)
150 if (compIIdx > compJIdx)
153 swap(compIIdx, compJIdx);
162 DUNE_THROW(Dune::InvalidStateException,
163 "Binary diffusion coefficient of components "
164 << compIIdx <<
" and " << compJIdx <<
" is undefined!\n");
176 template <
class Flu
idState>
183template<
class TypeTag>
198template <
class TypeTag>
216 static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
218 using Element =
typename GridGeometry::GridView::template Codim<0>::Entity;
219 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
225 name_ = getParam<std::string>(
"Problem.Name");
229 std::cout<<
"problem uses mole fractions" <<
'\n';
231 std::cout<<
"problem uses mass fractions" <<
'\n';
245 const std::string&
name()
const
253 Scalar x_CompThree_left = 0.0;
254 Scalar x_CompTwo_left = 0.0;
255 Scalar x_CompThree_right = 0.0;
256 Scalar x_CompTwo_right = 0.0;
257 Scalar x_CompOne_left = 0.0;
258 Scalar x_CompOne_right = 0.0;
263 for (
const auto& element : elements(this->
gridGeometry().gridView()))
266 fvGeometry.bindElement(element);
269 for (
auto&& scv : scvs(fvGeometry))
271 const auto& globalPos = scv.dofPosition();
272 VolumeVariables volVars;
273 volVars.update(elemSol, *
this, element, scv);
275 if (globalPos[0] < 0.5)
277 x_CompThree_left += volVars.moleFraction(0,2);
279 x_CompTwo_left += volVars.moleFraction(0,1);
280 x_CompOne_left += volVars.moleFraction(0,0);
285 x_CompThree_right += volVars.moleFraction(0,2);
286 x_CompTwo_right += volVars.moleFraction(0,1);
287 x_CompOne_right += volVars.moleFraction(0,0);
293 x_CompThree_left /= i;
296 x_CompThree_right /= j;
297 x_CompTwo_right /= j;
298 x_CompOne_right /= j;
302 y_.push_back(x_CompTwo_left);
303 y2_.push_back(x_CompTwo_right);
304 y3_.push_back(x_CompThree_left);
305 y4_.push_back(x_CompThree_right);
306 y5_.push_back(x_CompOne_left);
307 y6_.push_back(x_CompOne_right);
310 gnuplot_.
setXRange(0, std::min(time, 72000.0));
313 gnuplot_.
setYlabel(
"mole fraction mol/mol");
314 gnuplot_.
addDataSetToPlot(x_, y_,
"CompTwo_left.dat",
"w l t 'CompTwo left'");
315 gnuplot_.
addDataSetToPlot(x_, y2_,
"CompTwo_right.dat",
"w l t 'CompTwo right'");
316 gnuplot_.
plot(
"mole_fraction_CompTwo");
319 gnuplot2_.
setXRange(0, std::min(time, 72000.0));
322 gnuplot2_.
setYlabel(
"mole fraction mol/mol");
323 gnuplot2_.
addDataSetToPlot(x_, y3_,
"CompThree_left.dat",
"w l t 'CompThree left'");
324 gnuplot2_.
addDataSetToPlot(x_, y4_,
"CompThree_right.dat",
"w l t 'CompThree right");
325 gnuplot2_.
plot(
"mole_fraction_CompThree");
328 gnuplot3_.
setXRange(0, std::min(time, 72000.0));
331 gnuplot3_.
setYlabel(
"mole fraction mol/mol");
332 gnuplot3_.
addDataSetToPlot(x_, y5_,
"CompOne_left.dat",
"w l t 'CompOne left'");
333 gnuplot3_.
addDataSetToPlot(x_, y6_,
"CompOne_right.dat",
"w l t 'CompOne right'");
334 gnuplot3_.
plot(
"mole_fraction_CompOne");
354 BoundaryTypes values;
355 values.setAllNeumann();
366 {
return NumEqVector(0.0); }
385 PrimaryVariables initialValues(0.0);
386 if (globalPos[0] < 0.5)
388 initialValues[FluidSystem::compOneIdx] = 0.0;
389 initialValues[FluidSystem::compTwoIdx] = 0.50086;
390 initialValues[FluidSystem::compThreeIdx] = 0.49914;
394 initialValues[FluidSystem::compOneIdx] = 0.50121;
395 initialValues[FluidSystem::compTwoIdx] = 0.49879;
396 initialValues[FluidSystem::compThreeIdx] = 0.0;
398 return initialValues;
404 static constexpr Scalar eps_ = 1e-6;
411 std::vector<double> x_;
412 std::vector<double> y_;
413 std::vector<double> y2_;
414 std::vector<double> y3_;
415 std::vector<double> y4_;
416 std::vector<double> y5_;
417 std::vector<double> y6_;
Element solution classes and factory functions.
Defines a type tag and some properties for models using the box scheme.
Properties for all models using cell-centered finite volume scheme with TPFA.
This file contains the data which is required to calculate diffusive mass fluxes due to molecular dif...
Interface for passing data sets to a file and plotting them, if gnuplot is installed.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
auto elementSolution(const Element &element, const SolutionVector &sol, const GridGeometry &gg) -> std::enable_if_t< GridGeometry::discMethod==DiscretizationMethod::box, BoxElementSolution< typename GridGeometry::LocalView, std::decay_t< decltype(std::declval< SolutionVector >()[0])> > >
Make an element solution for box schemes.
Definition: box/elementsolution.hh:115
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:50
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
The DUNE grid type.
Definition: common/properties.hh:57
Property to specify the type of a problem which has to be solved.
Definition: common/properties.hh:69
Property whether to use moles or kg as amount unit for balance equations.
Definition: common/properties.hh:102
The type for the calculation of the molecular diffusion fluxes.
Definition: common/properties.hh:212
The type of the spatial parameters object.
Definition: common/properties.hh:221
The type of the fluid system to use.
Definition: common/properties.hh:223
The type of the fluid state to use.
Definition: common/properties.hh:225
Definition: maxwellstefanslaw.hh:37
void setXlabel(const std::string &label)
Sets the label for the x-axis.
Definition: gnuplotinterface.hh:279
void resetPlot()
Deletes all plots from a plotting window and resets user-defined options.
Definition: gnuplotinterface.hh:174
void addDataSetToPlot(const std::vector< Scalar > &x, const std::vector< Scalar > &y, const std::string &fileName, const std::string &options="with lines")
Adds a data set and writes a data file.
Definition: gnuplotinterface.hh:242
void plot(const std::string &filename="")
Plots the files for a specific window number, writes a gnuplot and png file.
Definition: gnuplotinterface.hh:89
void setXRange(Scalar min, Scalar max)
Sets the range for the x-axis.
Definition: gnuplotinterface.hh:300
void setYRange(Scalar min, Scalar max)
Sets the range for the y-axis.
Definition: gnuplotinterface.hh:313
void setYlabel(const std::string &label)
Sets the label for the y-axis.
Definition: gnuplotinterface.hh:289
Fluid system base class.
Definition: fluidsystems/base.hh:45
static Scalar density(const FluidState &fluidState, int phaseIdx)
Calculate the density of a fluid phase.
Definition: fluidsystems/base.hh:134
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
GetPropType< TypeTag, Properties::SpatialParams > SpatialParams
Export spatial parameter type.
Definition: dumux/porousmediumflow/problem.hh:58
Definition of a problem for the MaxwellStefan problem.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:200
NumEqVector neumannAtPos(const GlobalPosition &globalPos) const
Evaluates the boundary conditions for a Neumann boundary segment.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:365
const std::string & name() const
The problem name. This is used as a prefix for files generated by the simulation.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:245
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluates the initial value for a control volume.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:383
MaxwellStefanTestProblem(std::shared_ptr< const GridGeometry > gridGeometry)
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:222
BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:352
void plotComponentsOverTime(const SolutionVector &curSol, Scalar time)
Called after every time step.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:249
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:51
std::tuple< Tracer > InheritsFrom
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:51
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:52
std::tuple< MaxwellStefanTest, CCTpfaModel > InheritsFrom
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:52
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:53
std::tuple< MaxwellStefanTest, BoxModel > InheritsFrom
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:53
Dune::YaspGrid< 2 > type
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:58
GetPropType< TypeTag, Properties::GridGeometry > GridGeometry
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:68
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:69
A simple fluid system with one MaxwellStefan component.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:86
static Scalar binaryDiffusionCoefficient(unsigned int compIIdx, unsigned int compJIdx, const Problem &problem, const Element &element, const SubControlVolume &scv)
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:144
static Scalar molarMass(unsigned int compIdx)
Molar mass in kg/mol of the component with index compIdx.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:121
static constexpr int compThreeIdx
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:102
static constexpr int compTwoIdx
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:101
static std::string phaseName(int phaseIdx=0)
Human readable phase name (index phaseIdx) (for velocity vtk output)
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:117
static constexpr bool isTracerFluidSystem()
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:95
static std::string componentName(int compIdx)
Human readable component name (index compIdx) (for vtk output)
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:105
static constexpr int numComponents
The number of components.
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:98
static constexpr int compOneIdx
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:100
static Scalar molarDensity(const FluidState &fluidState, int phaseIdx)
The molar density of a fluid phase in .
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:177
static Scalar binaryDiffusionCoefficient(unsigned int compIdx, const Problem &problem, const Element &element, const SubControlVolume &scv)
Definition: test/porousmediumflow/tracer/multicomp/problem.hh:126
Definition of the spatial parameters for the MaxwellStefan problem.
Definition: porousmediumflow/tracer/multicomp/spatialparams.hh:41
Adaption of the fully implicit scheme to the tracer transport model.
Base class for all porous media problems.
Definition of the spatial parameters for the MaxwellStefan problem.