Commit 9128001f authored by Lukas Riedel's avatar Lukas Riedel

Add CMake option to control DG method with the config file

- add CMake option 'EXPERIMENTAL_DG_FEATURES'
- add cpp definition EXPERIMENTAL_DG_FEATURES
- add optional config keys 'dg.method' and 'dg.upwinding'
parent 7d47d613
......@@ -12,6 +12,14 @@ if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Werror")
# option to change DG scheme via config file
option(EXPERIMENTAL_DG_FEATURES
"Set DG method and upwinding scheme in config file"
OFF)
if(EXPERIMENTAL_DG_FEATURES)
add_definitions(-DEXPERIMENTAL_DG_FEATURES)
endif()
#
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
......
......@@ -31,7 +31,14 @@ Simulation<Traits>::Simulation (Dune::MPIHelper& _helper, std::shared_ptr<Grid>
finitial = std::make_unique<FlowInitial>(inifile,*param,gv);
// --- Local Operators ---
#ifdef EXPERIMENTAL_DG_FEATURES
const auto settings = read_experimental_operator_settings(inifile);
slop = std::make_unique<SLOP>(inifile, *param, gv, *fboundary, *fsource,
settings.first, settings.second);
#else
slop = std::make_unique<SLOP>(inifile,*param,gv,*fboundary,*fsource);
#endif // EXPERIMENTAL_DG_FEATURES
tlop = std::make_unique<TLOP>(inifile,*param,gv);
controller = std::make_unique<CalculationController>(inifile,*fboundary,helper);
......
......@@ -127,6 +127,46 @@ protected:
const int verbose;
private:
/// Read experimental operator settings from a parameter file
/* \return Pair of RichardsDGMethod and RichardsDGUpwinding
* to be inserted into the local operator constructor.
*/
auto read_experimental_operator_settings (const Dune::ParameterTree& inifile)
-> std::pair<Operator::RichardsDGMethod::Type,
Operator::RichardsDGUpwinding::Type>
{
using namespace Operator;
RichardsDGMethod::Type method;
RichardsDGUpwinding::Type upwinding;
const auto method_str = inifile.get<std::string>("dg.method");
if (method_str == "SIPG")
method = RichardsDGMethod::SIPG;
else if (method_str == "NIPG")
method = RichardsDGMethod::NIPG;
else if (method_str == "OOB")
method = RichardsDGMethod::OOB;
else if (method_str == "IIP")
method = RichardsDGMethod::IIP;
else
DUNE_THROW(Dune::IOError, "Unknown DG method '" + method_str + "'!");
const auto upwinding_str = inifile.get<std::string>("dg.upwinding");
if (upwinding_str == "none")
upwinding = RichardsDGUpwinding::none;
else if (upwinding_str == "semiUpwind")
upwinding = RichardsDGUpwinding::semiUpwind;
else if (upwinding_str == "fullUpwind")
upwinding = RichardsDGUpwinding::fullUpwind;
else
DUNE_THROW(Dune::IOError, "Unknown upwdinding '" + upwinding_str + "'!");
return std::make_pair(method, upwinding);
}
public:
/// Execute the simulation until tEnd is reached.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment