diff --git a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index d35a62567f3f6f50f416d3c0a04d18f0cd3a5b10..9d8d4e3d309b746df6603025dda23b397931c4ac 100644 --- a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -23,67 +23,10 @@ #ifndef DUMUX_STOKES_SUBPROBLEM_HH #define DUMUX_STOKES_SUBPROBLEM_HH -#include <dune/grid/yaspgrid.hh> - -// TODO: dumux-course-task 1.C -//****** uncomment for the last exercise *****// -// #include <dumux/io/grid/gridmanager_sub.hh> - -#include <dumux/material/fluidsystems/1pliquid.hh> -#include <dumux/material/components/simpleh2o.hh> - #include <dumux/freeflow/navierstokes/problem.hh> -#include <dumux/discretization/staggered/freeflow/properties.hh> -#include <dumux/freeflow/navierstokes/model.hh> - -namespace Dumux -{ -template <class TypeTag> -class FreeFlowSubProblem; +#include <dumux/common/properties.hh> -namespace Properties -{ -// Create new type tags -namespace TTag { -struct StokesOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; }; -} // end namespace TTag - -// the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::StokesOneP> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; -}; - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::StokesOneP> -{ - static constexpr auto dim = 2; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; - -// TODO: dumux-course-task 1.C -//****** comment out for the last exercise *****// - using type = TensorGrid; - -//****** uncomment for the last exercise *****// - // using HostGrid = TensorGrid; - // using type = Dune::SubGrid<dim, HostGrid>; -}; - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::StokesOneP> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; - -template<class TypeTag> -struct EnableGridGeometryCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; -template<class TypeTag> -struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; -template<class TypeTag> -struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; -} +namespace Dumux { /*! * \brief The free flow sub problem @@ -339,6 +282,7 @@ private: mutable std::vector<Scalar> analyticalVelocityX_; }; -} //end namespace + +} //end namespace Dumux #endif // DUMUX_STOKES_SUBPROBLEM_HH diff --git a/exercises/exercise-coupling-ff-pm/interface/main.cc b/exercises/exercise-coupling-ff-pm/interface/main.cc index c675221c6d55706acd4157ed38c252d3b26ea046..070de66d9404a0df26c9ce58992c829dcb7680d2 100644 --- a/exercises/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/exercise-coupling-ff-pm/interface/main.cc @@ -46,28 +46,7 @@ #include <dumux/multidomain/boundary/stokesdarcy/couplingmanager.hh> -#include "porousmediumsubproblem.hh" -#include "freeflowsubproblem.hh" - -namespace Dumux { -namespace Properties { - -template<class TypeTag> -struct CouplingManager<TypeTag, TTag::StokesOneP> -{ - using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOneP>; - using type = Dumux::StokesDarcyCouplingManager<Traits>; -}; - -template<class TypeTag> -struct CouplingManager<TypeTag, TTag::DarcyOneP> -{ - using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesOneP, Properties::TTag::StokesOneP, TypeTag>; - using type = Dumux::StokesDarcyCouplingManager<Traits>; -}; - -} // end namespace Properties -} // end namespace Dumux +#include "properties.hh" int main(int argc, char** argv) try { @@ -87,7 +66,6 @@ int main(int argc, char** argv) try using StokesTypeTag = Properties::TTag::StokesOneP; using DarcyTypeTag = Properties::TTag::DarcyOneP; - //TODO: dumux-course-task 1.C // ******************** comment-out this section for the last exercise **************** // diff --git a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index 5ecb3fa716aae89e974bf5d7118c2c04ed1a4ce3..f7d7b2b13c5511bc3bbfa4d2218c1ebabbc78c78 100644 --- a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -24,68 +24,10 @@ #ifndef DUMUX_DARCY_SUBPROBLEM_HH #define DUMUX_DARCY_SUBPROBLEM_HH -#include <dune/grid/yaspgrid.hh> - -// TODO: dumux-course-task 1.C -//****** uncomment for the last exercise *****// -// #include <dumux/io/grid/gridmanager_sub.hh> - -#include <dumux/discretization/cctpfa.hh> - -#include <dumux/porousmediumflow/1p/model.hh> #include <dumux/porousmediumflow/problem.hh> +#include <dumux/common/properties.hh> -#include "../1pspatialparams.hh" - -#include <dumux/material/components/simpleh2o.hh> -#include <dumux/material/fluidsystems/1pliquid.hh> - -namespace Dumux -{ -template <class TypeTag> -class PorousMediumSubProblem; - -namespace Properties -{ -// Create new type tags -namespace TTag { -struct DarcyOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; -} // end namespace TTag - -// Set the problem property -template<class TypeTag> -struct Problem<TypeTag, TTag::DarcyOneP> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; - -// the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::DarcyOneP> -{ - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; -}; - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::DarcyOneP> -{ - static constexpr auto dim = 2; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; - -//****** comment out for the last exercise *****// - using type = TensorGrid; - -//****** uncomment for the last exercise *****// - // using HostGrid = TensorGrid; - // using type = Dune::SubGrid<dim, HostGrid>; -}; - -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOneP> { - using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; -}; - -} // end namespace Properties +namespace Dumux { /*! * \brief The porous medium flow sub problem @@ -270,6 +212,7 @@ private: Scalar eps_; std::shared_ptr<CouplingManager> couplingManager_; }; -} //end namespace + +} //end namespace Dumux #endif //DUMUX_DARCY_SUBPROBLEM_HH diff --git a/exercises/exercise-coupling-ff-pm/interface/properties.hh b/exercises/exercise-coupling-ff-pm/interface/properties.hh new file mode 100644 index 0000000000000000000000000000000000000000..67a3dc85ceef3585b703fab984b6d690898831ee --- /dev/null +++ b/exercises/exercise-coupling-ff-pm/interface/properties.hh @@ -0,0 +1,137 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program 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. * + * * + * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \brief The coupled exercise properties file or the interface case. + */ +#ifndef DUMUX_EXERCISE_COUPLED_INTERFACE_PROPERTIES_HH +#define DUMUX_EXERCISE_COUPLED_INTERFACE_PROPERTIES_HH + +// Both Domains +#include <dune/grid/yaspgrid.hh> + +// TODO: dumux-course-task 1.C +//****** uncomment for the last exercise *****// +// #include <dumux/io/grid/gridmanager_sub.hh> + +#include <dumux/material/fluidsystems/1pliquid.hh> +#include <dumux/material/components/simpleh2o.hh> + +// Free-flow domain +#include <dumux/discretization/staggered/freeflow/properties.hh> +#include <dumux/freeflow/navierstokes/model.hh> + +#include "freeflowsubproblem.hh" + +// Porous medium flow domain +#include <dumux/discretization/cctpfa.hh> +#include <dumux/porousmediumflow/1p/model.hh> + +#include "../1pspatialparams.hh" +#include "porousmediumsubproblem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +struct DarcyOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; +struct StokesOneP { using InheritsFrom = std::tuple<NavierStokes, StaggeredFreeFlowModel>; }; +} // end namespace TTag + +// Set the coupling manager +template<class TypeTag> +struct CouplingManager<TypeTag, TTag::StokesOneP> +{ + using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOneP>; + using type = Dumux::StokesDarcyCouplingManager<Traits>; +}; +template<class TypeTag> +struct CouplingManager<TypeTag, TTag::DarcyOneP> +{ + using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesOneP, Properties::TTag::StokesOneP, TypeTag>; + using type = Dumux::StokesDarcyCouplingManager<Traits>; +}; + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::DarcyOneP> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; +template<class TypeTag> +struct Problem<TypeTag, TTag::StokesOneP> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; + +// the fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::DarcyOneP> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; +}; +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::StokesOneP> +{ + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; +}; + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::DarcyOneP> +{ + static constexpr auto dim = 2; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; + +// TODO: dumux-course-task 1.C +//****** comment out for the last exercise *****// + using type = TensorGrid; + +//****** uncomment for the last exercise *****// + // using HostGrid = TensorGrid; + // using type = Dune::SubGrid<dim, HostGrid>; +}; +template<class TypeTag> +struct Grid<TypeTag, TTag::StokesOneP> +{ + static constexpr auto dim = 2; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; + +// TODO: dumux-course-task 1.C +//****** comment out for the last exercise *****// + using type = TensorGrid; + +//****** uncomment for the last exercise *****// + // using HostGrid = TensorGrid; + // using type = Dune::SubGrid<dim, HostGrid>; +}; + +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::DarcyOneP> { + using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesOneP> { static constexpr bool value = true; }; + +} //end namespace Dumux::Properties + +#endif // DUMUX_EXERCISE_COUPLED_INTERFACE_PROPERTIES_HH diff --git a/exercises/exercise-coupling-ff-pm/models/properties.hh b/exercises/exercise-coupling-ff-pm/models/properties.hh new file mode 100644 index 0000000000000000000000000000000000000000..f7f0e1a9a9dda8b5c1af926e076e68bdc320728b --- /dev/null +++ b/exercises/exercise-coupling-ff-pm/models/properties.hh @@ -0,0 +1,130 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program 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. * + * * + * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * + * \brief Properties file for coupled models example. + */ +#ifndef DUMUX_EXERCISE_COUPLED_MODELS_PROPERTIES_HH +#define DUMUX_EXERCISE_COUPLED_MODELS_PROPERTIES_HH + +// Both Domains +#include <dune/grid/yaspgrid.hh> + +#include <dumux/io/gnuplotinterface.hh> +#include <dumux/material/fluidsystems/1padapter.hh> +#include <dumux/material/fluidsystems/h2oair.hh> + +// Porous medium flow domain +// TODO: dumux-course-task 2.A +// Include 2pnc model here +#include <dumux/porousmediumflow/1pnc/model.hh> +#include <dumux/discretization/cctpfa.hh> +#include <dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh> + +// TODO: dumux-course-task 2.A +// Include spatial params for a 2-phase system +#include "../1pspatialparams.hh" +#include "porousmediumsubproblem.hh" + +// Free-flow +#include <dumux/discretization/staggered/freeflow/properties.hh> +#include <dumux/freeflow/compositional/navierstokesncmodel.hh> + +#include "freeflowsubproblem.hh" + +namespace Dumux::Properties { + +// Create new type tags +namespace TTag { +// TODO: dumux-course-task 2.A +// Change to property of the `FluidSystem` such that `H2OAir` is used directly. +struct DarcyOnePNC { using InheritsFrom = std::tuple<OnePNC, CCTpfaModel>; }; +struct StokesNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; }; +} // end namespace TTag + +// Set the problem property +template<class TypeTag> +struct Problem<TypeTag, TTag::DarcyOnePNC> { using type = Dumux::PorousMediumSubProblem<TypeTag>; }; + +template<class TypeTag> +struct Problem<TypeTag, TTag::StokesNC> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; }; + +// The fluid system +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::DarcyOnePNC> +{ + using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; + using type = FluidSystems::OnePAdapter<H2OAir, H2OAir::gasPhaseIdx>; +}; + +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::StokesNC> +{ + using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>; + using type = FluidSystems::OnePAdapter<H2OAir, H2OAir::gasPhaseIdx>; +}; + +// Use moles +template<class TypeTag> +struct UseMoles<TypeTag, TTag::DarcyOnePNC> { static constexpr bool value = true; }; + +template<class TypeTag> +struct UseMoles<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; + +// Do not replace one equation with a total mass balance +template<class TypeTag> +struct ReplaceCompEqIdx<TypeTag, TTag::DarcyOnePNC> { static constexpr int value = 3; }; + +template<class TypeTag> +struct ReplaceCompEqIdx<TypeTag, TTag::StokesNC> { static constexpr int value = 3; }; + +//! Use a model with constant tortuosity for the effective diffusivity +template<class TypeTag> +struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePNC> +{ using type = DiffusivityConstantTortuosity<GetPropType<TypeTag, Properties::Scalar>>; }; + +// Set the grid type +template<class TypeTag> +struct Grid<TypeTag, TTag::DarcyOnePNC> { using type = Dune::YaspGrid<2>; }; + +template<class TypeTag> +struct Grid<TypeTag, TTag::StokesNC> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; }; + +// TODO: dumux-course-task 2.A +// Define new formulation for primary variables here. + +// Set the spatial paramaters type +template<class TypeTag> +// TODO: dumux-course-task 2.A +// Adapt the spatial params here. +struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { + using type = OnePSpatialParams<GetPropType<TypeTag, GridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +template<class TypeTag> +struct EnableGridGeometryCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridFluxVariablesCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; +template<class TypeTag> +struct EnableGridVolumeVariablesCache<TypeTag, TTag::StokesNC> { static constexpr bool value = true; }; + +} // end namespace Dumux::Properties + +#endif //DUMUX_DARCY_PROPERTIES_HH