changed: move the GridGlobalRefinements parameter to Opm::Parameters

This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:16:28 +02:00
parent b38a991b05
commit 4cce7022bb
6 changed files with 65 additions and 22 deletions

View File

@ -253,7 +253,6 @@ struct ExtensiveStorageTerm { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct UseVolumetricResidual { using type = UndefinedProperty; };
//! Specify if experimental features should be enabled or not.
template<class TypeTag, class MyTypeTag>
struct EnableExperiments { using type = UndefinedProperty; };

View File

@ -28,6 +28,7 @@
#define EWOMS_CUBE_GRID_VANGUARD_HH
#include <opm/models/io/basevanguard.hh>
#include <opm/models/utils/basicparameters.hh>
#include <opm/models/utils/basicproperties.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/parametersystem.hh>
@ -66,7 +67,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Properties::GridGlobalRefinements>
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Properties::DomainSizeX>
@ -111,7 +112,7 @@ public:
cellRes[2] = Parameters::get<TypeTag, Properties::CellsZ>();
}
unsigned numRefinements = Parameters::get<TypeTag, Properties::GridGlobalRefinements>();
unsigned numRefinements = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
cubeGrid_ = Dune::StructuredGridFactory<Grid>::createCubeGrid(lowerLeft, upperRight, cellRes);
cubeGrid_->globalRefine(static_cast<int>(numRefinements));

View File

@ -64,7 +64,7 @@ public:
{
Parameters::registerParam<TypeTag,Properties::GridFile>
("The file name of the DGF file to load");
Parameters::registerParam<TypeTag,Properties::GridGlobalRefinements>
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
}
@ -76,7 +76,7 @@ public:
: ParentType(simulator)
{
const std::string dgfFileName = Parameters::get<TypeTag, Properties::GridFile>();
unsigned numRefinments = Parameters::get<TypeTag, Properties::GridGlobalRefinements>();
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
{
// create DGF GridPtr from a dgf file

View File

@ -28,8 +28,11 @@
#define EWOMS_STRUCTURED_GRID_VANGUARD_HH
#include <opm/models/io/basevanguard.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/basicparameters.hh>
#include <opm/models/utils/basicproperties.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/models/utils/propertysystem.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
@ -42,7 +45,6 @@
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <vector>
#include <memory>
namespace Opm {
@ -106,7 +108,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Properties::GridGlobalRefinements>
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Properties::DomainSizeX>
@ -165,7 +167,7 @@ public:
// use DGF parser to create a grid from interval block
gridPtr_.reset( Dune::GridPtr< Grid >( dgffile ).release() );
unsigned numRefinements = Parameters::get<TypeTag, Properties::GridGlobalRefinements>();
unsigned numRefinements = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
gridPtr_->globalRefine(static_cast<int>(numRefinements));
this->finalizeInit_();

View File

@ -0,0 +1,42 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
*
* \brief Defines some fundamental parameters for all models.
*/
#ifndef EWOMS_BASIC_PARAMETERS_HH
#define EWOMS_BASIC_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
//! Property which tells the Vanguard how often the grid should be refined
//! after creation.
template<class TypeTag, class MyTypeTag>
struct GridGlobalRefinements { using type = Properties::UndefinedProperty; };
} // namespace Opm:Parameters
#endif

View File

@ -30,15 +30,14 @@
#include <dune/common/parametertree.hh>
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/utils/basicparameters.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/models/utils/propertysystem.hh>
#if HAVE_DUNE_FEM
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
#endif
#include <string>
namespace Opm::Properties {
///////////////////////////////////
@ -100,11 +99,6 @@ template<class TypeTag, class MyTypeTag>
struct GridPart { using type = UndefinedProperty; };
#endif
//! Property which tells the Vanguard how often the grid should be refined
//! after creation.
template<class TypeTag, class MyTypeTag>
struct GridGlobalRefinements { using type = UndefinedProperty; };
//! Property provides the name of the file from which the additional runtime
//! parameters should to be loaded from
template<class TypeTag, class MyTypeTag>
@ -233,11 +227,6 @@ struct GridView<TypeTag, TTag::NumericModel> { using type = typename GetPropType
template<class TypeTag>
struct ParameterFile<TypeTag, TTag::NumericModel> { static constexpr auto value = ""; };
//! Set the number of refinement levels of the grid to 0. This does not belong
//! here, strictly speaking.
template<class TypeTag>
struct GridGlobalRefinements<TypeTag, TTag::NumericModel> { static constexpr unsigned value = 0; };
//! By default, print the properties on startup
template<class TypeTag>
struct PrintProperties<TypeTag, TTag::NumericModel> { static constexpr int value = 2; };
@ -277,4 +266,14 @@ struct PredeterminedTimeStepsFile<TypeTag, TTag::NumericModel> { static constexp
} // namespace Opm::Properties
namespace Opm::Parameters {
//! Set the number of refinement levels of the grid to 0. This does not belong
//! here, strictly speaking.
template<class TypeTag>
struct GridGlobalRefinements<TypeTag, Properties::TTag::NumericModel>
{ static constexpr unsigned value = 0; };
}
#endif