opm-simulators
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
38
39#include <array>
40#include <memory>
41
42namespace Opm {
43
51template <class TypeTag>
52class CubeGridVanguard : public BaseVanguard<TypeTag>
53{
54 using ParentType = BaseVanguard<TypeTag>;
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
67public:
71 static void registerParameters()
72 {
74 ("The number of global refinements of the grid "
75 "executed after it was loaded");
77 ("The size of the domain in x direction");
79 ("The number of intervalls in x direction");
80
81 if constexpr (dim > 1) {
83 ("The size of the domain in y direction");
85 ("The number of intervalls in y direction");
86 }
87 if constexpr (dim > 2) {
89 ("The size of the domain in z direction");
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
107
108 if constexpr (dim > 1) {
111 }
112 if constexpr (dim > 2) {
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
136protected:
137 GridPointer cubeGrid_;
138};
139
140} // namespace Opm
141
142#endif
Provides the base class for most (all?) simulator vanguards.
Defines some fundamental parameters for all models.
Defines a type tags and some fundamental properties all models.
const Grid & grid() const
Returns a reference to the grid.
Definition cubegridvanguard.hh:133
Grid & grid()
Returns a reference to the grid.
Definition cubegridvanguard.hh:127
CubeGridVanguard(Simulator &simulator)
Create the grid.
Definition cubegridvanguard.hh:98
static void registerParameters()
Register all run-time parameters for the simulator vanguad.
Definition cubegridvanguard.hh:71
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:45
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
This file provides the infrastructure to retrieve run-time parameters.
void Register(const char *usageString)
Register a run-time parameter.
Definition parametersystem.hpp:292
auto Get(bool errorIfNotRegistered=true)
Retrieve a runtime parameter.
Definition parametersystem.hpp:187
The Opm property system, traits with inheritance.