3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
test/porousmediumflow/solidenergy/problem.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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_TEST_SOLIDENERGY_PROBLEM_HH
25#define DUMUX_TEST_SOLIDENERGY_PROBLEM_HH
26
27#include <string>
28#include <cmath>
29
33
34namespace Dumux {
35
40template <class TypeTag>
42{
50 using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView;
51 using ElementFluxVariablesCache = typename GridVariables::GridFluxVariablesCache::LocalView;
52
53 using Element = typename GridView::template Codim<0>::Entity;
54 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
56 using FVElementGeometry = typename GridGeometry::LocalView;
57 using SubControlVolume = typename GridGeometry::SubControlVolume;
58 using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
60
61public:
62 SolidEnergyProblem(std::shared_ptr<const GridGeometry> gridGeometry, const std::string& paramGroup = "")
64 {
65 name_ = getParam<std::string>("Problem.Name");
66 temperatureHigh_ = getParam<Scalar>("Problem.TemperatureHigh");
67 temperatureInit_ = getParam<Scalar>("Problem.TemperatureInit");
68 lambdaSolid_ = getParam<Scalar>("Component.SolidThermalConductivity");
69 }
70
74 // \{
75
81 const std::string& name() const
82 {
83 return name_;
84 }
85 // \}
86
90 // \{
91
98 BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const
99 {
100 BoundaryTypes bcTypes;
101 bcTypes.setAllNeumann();
102 return bcTypes;
103 }
104
121 NeumannValues neumann(const Element& element,
122 const FVElementGeometry& fvGeometry,
123 const ElementVolumeVariables& elemVolVars,
124 const ElementFluxVariablesCache& elemFluxVarsCache,
125 const SubControlVolumeFace& scvf) const
126 {
127 const auto& volVars = elemVolVars[scvf.insideScvIdx()];
128 const Scalar value = 0.02*(volVars.temperatureSolid() - temperatureInit_)/0.002;
129 return NeumannValues(value);
130 }
131
132
133
134 // \}
135
139 // \{
140
149 PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
150 {
151 return PrimaryVariables(temperatureInit_);
152 }
153
167 void addPointSources(std::vector<PointSource>& pointSources) const
168 {
169 // add point sources along a sinus
170 const auto& gg = this->gridGeometry();
171 const auto ampl = (gg.bBoxMax()[1] - gg.bBoxMin()[1])/3.0;
172 const auto len = (gg.bBoxMax()[0] - gg.bBoxMin()[0]);
173 const auto freq = 1.0/len;
174
175 for (int i = 0; i < 100; ++i)
176 {
177 const auto posx = double(i)/99.0*len;
178 const auto posy = ampl*std::sin(2*M_PI*freq*posx) + ampl*3.0/2.0;
179 pointSources.emplace_back(GlobalPosition({posx, posy}), typename PointSource::Values({len/100.0}));
180 }
181 }
182
202 void pointSource(PointSource& source,
203 const Element &element,
204 const FVElementGeometry& fvGeometry,
205 const ElementVolumeVariables& elemVolVars,
206 const SubControlVolume &scv) const
207 {
208 const auto& volVars = elemVolVars[scv];
209 const Scalar charLen = 0.1;
210 static const Scalar nusselt = getParam<Scalar>("Problem.NusseltNumber");
211 const Scalar interfacialArea = 2*M_PI*0.001;
212 const Scalar lambdaSolidFluidTransfer = lambdaSolid_;
213 source *= -nusselt*interfacialArea*lambdaSolidFluidTransfer*(volVars.temperatureSolid() - temperatureHigh_)/charLen;
214 }
215
216 // \}
217
218private:
219 Scalar temperatureHigh_, temperatureInit_, lambdaSolid_;
220 static constexpr Scalar eps_ = 1e-6;
221 std::string name_;
222};
223
224} //end namespace Dumux
225
226#endif
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.
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 std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition: common/fvproblem.hh:592
NumEqVector source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: common/fvproblem.hh:327
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition: common/fvproblem.hh:588
ValueType Values
Export the value type.
Definition: pointsource.hh:56
Base class for all fully implicit porous media problems.
Definition: dumux/porousmediumflow/problem.hh:39
A piece of stone heated by a network of channels.
Definition: test/porousmediumflow/solidenergy/problem.hh:42
SolidEnergyProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
Definition: test/porousmediumflow/solidenergy/problem.hh:62
const std::string & name() const
The problem name.
Definition: test/porousmediumflow/solidenergy/problem.hh:81
NeumannValues neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluate the boundary conditions for a neumann boundary segment.
Definition: test/porousmediumflow/solidenergy/problem.hh:121
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
Evaluate the initial value for a control volume.
Definition: test/porousmediumflow/solidenergy/problem.hh:149
void pointSource(PointSource &source, const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the point sources (added by addPointSources) for all phases within a given sub-control-volum...
Definition: test/porousmediumflow/solidenergy/problem.hh:202
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/solidenergy/problem.hh:98
void addPointSources(std::vector< PointSource > &pointSources) const
Applies a vector of point sources. The point sources are possibly solution dependent.
Definition: test/porousmediumflow/solidenergy/problem.hh:167
Declares all properties used in Dumux.
Base class for all porous media problems.