opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
cubegridvanguard.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
This file is part of the Open Porous Media project (OPM).
5
6
OPM 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
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
18
19
Consult the COPYING file in the top-level source directory of this
20
module for the precise wording of the license and the list of
21
copyright holders.
22
*/
27
#ifndef EWOMS_CUBE_GRID_VANGUARD_HH
28
#define EWOMS_CUBE_GRID_VANGUARD_HH
29
30
#include <dune/common/fvector.hh>
31
#include <dune/grid/utility/structuredgridfactory.hh>
32
33
#include <
opm/models/io/basevanguard.hh
>
34
#include <
opm/models/utils/basicparameters.hh
>
35
#include <
opm/models/utils/basicproperties.hh
>
36
#include <
opm/models/utils/propertysystem.hh
>
37
#include <
opm/models/utils/parametersystem.hpp
>
38
39
#include <array>
40
#include <memory>
41
42
namespace
Opm
{
43
51
template
<
class
TypeTag>
52
class
CubeGridVanguard
:
public
BaseVanguard<TypeTag>
53
{
54
using
ParentType = BaseVanguard<TypeTag>;
55
using
Scalar =
GetPropType<TypeTag, Properties::Scalar>
;
56
using
Simulator =
GetPropType<TypeTag, Properties::Simulator>
;
57
using
Grid =
GetPropType<TypeTag, Properties::Grid>
;
58
59
using
GridPointer = std::unique_ptr<Grid>;
60
using
CoordScalar =
typename
Grid::ctype;
61
enum
{
62
dim = Grid::dimension,
63
dimWorld = Grid::dimensionworld,
64
};
65
using
GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
66
67
public
:
71
static
void
registerParameters
()
72
{
73
Parameters::Register<Parameters::GridGlobalRefinements>
74
(
"The number of global refinements of the grid "
75
"executed after it was loaded"
);
76
Parameters::Register<Parameters::DomainSizeX<Scalar>
>
77
(
"The size of the domain in x direction"
);
78
Parameters::Register<Parameters::CellsX>
79
(
"The number of intervalls in x direction"
);
80
81
if
constexpr
(dim > 1) {
82
Parameters::Register<Parameters::DomainSizeY<Scalar>
>
83
(
"The size of the domain in y direction"
);
84
Parameters::Register<Parameters::CellsY>
85
(
"The number of intervalls in y direction"
);
86
}
87
if
constexpr
(dim > 2) {
88
Parameters::Register<Parameters::DomainSizeZ<Scalar>
>
89
(
"The size of the domain in z direction"
);
90
Parameters::Register<Parameters::CellsZ>
91
(
"The number of intervalls in z direction"
);
92
}
93
}
94
98
explicit
CubeGridVanguard
(Simulator& simulator)
99
: ParentType(simulator)
100
{
101
std::array<unsigned int, dim> cellRes{};
102
GlobalPosition upperRight(0.0);
103
GlobalPosition lowerLeft(0.0);
104
105
upperRight[0] =
Parameters::Get<Parameters::DomainSizeX<Scalar>
>();
106
cellRes[0] =
Parameters::Get<Parameters::CellsX>
();
107
108
if
constexpr
(dim > 1) {
109
upperRight[1] =
Parameters::Get<Parameters::DomainSizeY<Scalar>
>();
110
cellRes[1] =
Parameters::Get<Parameters::CellsY>
();
111
}
112
if
constexpr
(dim > 2) {
113
upperRight[2] =
Parameters::Get<Parameters::DomainSizeZ<Scalar>
>();
114
cellRes[2] =
Parameters::Get<Parameters::CellsZ>
();
115
}
116
117
const
unsigned
numRefinements =
Parameters::Get<Parameters::GridGlobalRefinements>
();
118
cubeGrid_ = Dune::StructuredGridFactory<Grid>::createCubeGrid(lowerLeft, upperRight, cellRes);
119
cubeGrid_->globalRefine(
static_cast<
int
>
(numRefinements));
120
121
this->finalizeInit_();
122
}
123
127
Grid&
grid
()
128
{
return
*cubeGrid_; }
129
133
const
Grid&
grid
()
const
134
{
return
*cubeGrid_; }
135
136
protected
:
137
GridPointer cubeGrid_;
138
};
139
140
}
// namespace Opm
141
142
#endif
basevanguard.hh
Provides the base class for most (all?) simulator vanguards.
basicparameters.hh
Defines some fundamental parameters for all models.
basicproperties.hh
Defines a type tags and some fundamental properties all models.
Opm::CubeGridVanguard::grid
const Grid & grid() const
Returns a reference to the grid.
Definition
cubegridvanguard.hh:133
Opm::CubeGridVanguard::grid
Grid & grid()
Returns a reference to the grid.
Definition
cubegridvanguard.hh:127
Opm::CubeGridVanguard::CubeGridVanguard
CubeGridVanguard(Simulator &simulator)
Create the grid.
Definition
cubegridvanguard.hh:98
Opm::CubeGridVanguard::registerParameters
static void registerParameters()
Register all run-time parameters for the simulator vanguad.
Definition
cubegridvanguard.hh:71
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
Opm::GetPropType
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:233
parametersystem.hpp
This file provides the infrastructure to retrieve run-time parameters.
Opm::Parameters::Register
void Register(const char *usageString)
Register a run-time parameter.
Definition
parametersystem.hpp:292
Opm::Parameters::Get
auto Get(bool errorIfNotRegistered=true)
Retrieve a runtime parameter.
Definition
parametersystem.hpp:187
propertysystem.hh
The Opm property system, traits with inheritance.
opm
models
io
cubegridvanguard.hh
Generated by
1.17.0