Newer
Older
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* \copyright
* Copyright (c) 2012-2014, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include <boost/property_tree/ptree.hpp>
#include "logog/include/logog.hpp"
#include "GeoLib/GEOObjects.h"
#include "MeshLib/Mesh.h"
#include "BoundaryCondition.h"
#include "InitialCondition.h"
#include "ProcessVariable.h"
namespace ProcessLib
{
ProcessVariable::ProcessVariable(
ConfigTree const& config,
MeshLib::Mesh const& mesh,
GeoLib::GEOObjects const& geometries)
: _name(config.get<std::string>("name")),
_mesh(mesh)
{
DBUG("Constructing process variable %s", this->_name.c_str());
// Initial condition
{
auto const& ic_config = config.find("initial_condition");
if (ic_config == config.not_found())
INFO("No initial condition found.");
std::string const type =
config.get<std::string>("initial_condition.type");
if (type == "Uniform")
{
_initial_condition =
new UniformInitialCondition(ic_config->second);
}
else
{
ERR("Unknown type of the initial condition.");
}
}
// Boundary conditions
{
auto const& bcs_config = config.find("boundary_conditions");
if (bcs_config == config.not_found())
INFO("No boundary conditions found.");
for (auto const& bc_iterator : bcs_config->second)
{
ConfigTree const& bc_config = bc_iterator.second;
// Find corresponding GeoObject
std::string const geometrical_set_name =
bc_config.get<std::string>("geometrical_set");
std::string const geometry_name =
bc_config.get<std::string>("geometry");
GeoLib::GeoObject const* const geometry = geometries.getGeoObject(
geometrical_set_name, geometry_name);
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
DBUG("Found geometry type \"%s\"",
GeoLib::convertGeoTypeToString(geometry->getGeoType()).c_str());
// Construct type dependent boundary condition
std::string const type = bc_config.get<std::string>("type");
if (type == "UniformDirichlet")
{
_boundary_conditions.emplace_back(
new UniformDirichletBoundaryCondition(
geometry, bc_config));
}
else
{
ERR("Unknown type \'%s\' of the boundary condition.",
type.c_str());
}
}
}
}
ProcessVariable::~ProcessVariable()
{
delete _initial_condition;
for(auto p : _boundary_conditions)
delete p;
}
std::string const& ProcessVariable::getName() const
{
return _name;
}
} // namespace ProcessLib