#ifndef DUNE_DORIE_RICHARDS_LOP_CFG_HH #define DUNE_DORIE_RICHARDS_LOP_CFG_HH #include #include #include #include #include namespace Dune { namespace Dorie { namespace Operator { /** * \addtogroup RichardsModel * \{ */ //! Interior penalty type enum class RichardsDGMethod { NIPG, //!< Non-symmetric interior penalty SIPG, //!< Symmetric interior penalty (default) OBB, //!< Oden, Babuska, Baumann (no penalty term) IIP //!< Incomplete interior penalty (no symmetry term) }; //! Gradient weighting enum class RichardsDGWeights { weightsOn, //!< harmonic weighting of flux contributions weightsOff //!< no weighting of flux contributions }; //! Upwinding type enum class RichardsUpwinding { fullUpwind, //!< Upwind conductivity semiUpwind, //!< Upwind conductivity factor none //!< No upwinding }; /// Read operator settings from a parameter file /* \return Tuple of RichardsUpwinding, RichardsDGMethod, and * RichardsDGWeights to be inserted into the local operator constructor. */ inline auto read_operator_settings( const Dune::ParameterTree& inifile) -> std::tuple { const auto log = Dorie::get_logger(log_richards); log->debug("Reading local operator settings:"); RichardsUpwinding upwinding; RichardsDGMethod method = RichardsDGMethod::SIPG; RichardsDGWeights weights = RichardsDGWeights::weightsOn; // Upwinding const auto upwinding_str = inifile.get("numerics.upwinding"); log->debug(" Upwinding scheme: {}", upwinding_str); if (upwinding_str == "none") upwinding = RichardsUpwinding::none; else if (upwinding_str == "semiUpwind") upwinding = RichardsUpwinding::semiUpwind; else if (upwinding_str == "fullUpwind") upwinding = RichardsUpwinding::fullUpwind; else { log->error("Unknown upwinding scheme: {}", upwinding_str); DUNE_THROW(Dune::IOError, "Unknown upwinding scheme"); } // Return here if the local operator is FV only if (inifile.get("numerics.FEorder") == 0) { log->debug(" Ignoring settings 'numerics.DGMethod' and " "'numerics.DGWeights' for finite volume solver."); return std::make_tuple(upwinding, method, weights); } // DG Method const auto method_str = inifile.get("numerics.DGMethod"); log->debug(" DG method: {}", method_str); if (method_str == "SIPG") method = RichardsDGMethod::SIPG; else if (method_str == "NIPG") method = RichardsDGMethod::NIPG; else if (method_str == "OBB") method = RichardsDGMethod::OBB; else if (method_str == "IIP") method = RichardsDGMethod::IIP; else { log->error("Unknown DG method: {}", method_str); DUNE_THROW(Dune::IOError, "Unknown DG method"); } // Harmonic weighting of fluxes const auto weights_str = inifile.get("numerics.DGWeights"); log->debug(" Harmonic weights for interface fluxes (DG): {}", weights_str); if (weights_str) weights = RichardsDGWeights::weightsOn; else weights = RichardsDGWeights::weightsOff; return std::make_tuple(upwinding, method, weights); } /** * \} * // group RichardsModel */ } // namespace Operator } // namespace Dorie } // namespace Dune #endif // DUNE_DORIE_RICHARDS_LOP_CFG_HH