Commit 1b19e3ba authored by Ned Coltman's avatar Ned Coltman
Browse files

Merge branch 'feature/propertiesheader_ex-coupling' into 'master'

Coupling FF-PM Exercise with separate properties header

See merge request !97
parents 36aa1820 b54b0c59
Pipeline #1827 passed with stage
in 32 seconds
......@@ -18,10 +18,10 @@ The problem-related files for this exercise are:
* Three __main files__ for the three sub-tasks :`interface/main.cc`, `models/main.cc`, `turbulence/main.cc`,
* Three __free flow problem files__: `interface/freeflowsubproblem.hh`, `models/freeflowsubproblem.hh`, `turbulence/freeflowsubproblem.hh`
* Three __porous medium flow problem files__: `interface/porousmediumsubproblem.hh`, `models/porousmediumsubproblem.hh`, `turbulence/porousmediumsubproblem.hh`
* Three __properties files__: `interface/properties.hh`, `models/properties.hh`, `turbulence/properties.hh`
* The __input files__: `interface/params.input`, `models/parmas.input`, `turbulence/params.input`,
* The __spatial parameters files__: `1pspatialparams.hh`, `2pspatialparams.hh`
In the main file, `TypeTags` for both submodels are defined.
The same applies for types such as `GridManager`, `FVGridGeometry`, `Problem`, etc...
Since we use a monolithic coupling scheme, there is only one `Assembler` and one `NewtonSolver`.
......@@ -163,7 +163,7 @@ auto elementSelectorDarcy = [&](const auto& element)
};
```
Make sure, that you have uncommented the lines including the grid managers in both problem files
Make sure, that you have uncommented the lines including the grid managers in both properties files
```cpp
#include <dumux/io/grid/gridmanager_sub.hh>
```
......@@ -216,7 +216,7 @@ __Task A: Change the model__:
In the first task, the porous-medium model will be changed from a 1p2c system to a 2p2c system.
Although a 2p2c system is plugged in, we still want to simulate the same situation as before, i.e., air with water vapor in both domains.
The following changes have to be made in the porous-medium model (`models/porousmediumsubproblem.hh`):
The following changes have to be made in the porous-medium model (`models/properties.hh`):
* Include the 2pnc model: include the respective headers and inherit from the new model `TwoPNC`
* Exchange the spatial parameters for the 1-phase system by those for a 2-phase system (hint: two occurrences).
* Since two phases are involved now, we do not need to use the `OnePAdapter` anymore. Change to property of the `FluidSystem` such that `H2OAir` is used directly.
......@@ -233,7 +233,7 @@ template<class TypeTag>
struct Formulation<TypeTag, TTag::DarcyOnePNC>
{ static constexpr auto value = TwoPFormulation::p1s0; };
```
in the Properties section in the problem file.
in the properties file.
In contrast to the formulation, which stays the same during one simulation, the meaning of
the primary variables may vary during one simulation.
......@@ -312,18 +312,23 @@ All the prepared files can be found in the subfolder `exercise-coupling-ff-pm/tu
__Task A__:
The file `freeflowsubproblem.hh` is your free flow problem file within this exercise.
The file `freeflowsubproblem.hh` is your free flow problem file and `properties.hh` is the properties file within this exercise.
For using the compositional zero equation turbulence model, the following header files need to be included:
For using the compositional zero equation turbulence model, the following header files need to be included
in properties file:
```
#include <dumux/freeflow/compositional/zeroeqncmodel.hh>
```
and in problem file:
```
#include <dumux/freeflow/rans/problem.hh>
```
The includes for the NavierStokesNC model and the NavierStokesProblem are no longer needed and can be removed.
Make sure your free flow problem inherits from the correct parent type:
* Change the entry in the `StokesZeroEq` definition accordingly (non-isothermal zero equation model, ZeroEqNCNI)
* Adapt the inheritance of the problem class (hint: two occurrences)
* Change the entry in the `StokesZeroEq` definition accordingly (non-isothermal zero equation model, ZeroEqNCNI) in the properties file,
* Adapt the inheritance of the problem class in problem file.
Take a look into the two headers included above to see how the correct TypeTag and the Problem class the inherit from are called.
......
......@@ -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
......@@ -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 **************** //
......
......@@ -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
// -*- 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
......@@ -24,58 +24,10 @@
#ifndef DUMUX_STOKES1P2C_SUBPROBLEM_HH
#define DUMUX_STOKES1P2C_SUBPROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/material/fluidsystems/1padapter.hh>
#include <dumux/material/fluidsystems/h2oair.hh>
#include <dumux/freeflow/navierstokes/problem.hh>
#include <dumux/discretization/staggered/freeflow/properties.hh>
#include <dumux/freeflow/compositional/navierstokesncmodel.hh>
#include <dumux/common/properties.hh>
namespace Dumux
{
template <class TypeTag>
class FreeFlowSubProblem;
namespace Properties
{
// Create new type tags
namespace TTag {
struct StokesNC { using InheritsFrom = std::tuple<NavierStokesNC, StaggeredFreeFlowModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::StokesNC> { using type = Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<GetPropType<TypeTag, Properties::Scalar>, 2> >; };
// The fluid system
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::StokesNC>
{
using H2OAir = FluidSystems::H2OAir<GetPropType<TypeTag, Properties::Scalar>>;
using type = FluidSystems::OnePAdapter<H2OAir, H2OAir::gasPhaseIdx>;
};
// Do not replace one equation with a total mass balance
template<class TypeTag>
struct ReplaceCompEqIdx<TypeTag, TTag::StokesNC> { static constexpr int value = 3; };
// Use formulation based on mass fractions
template<class TypeTag>
struct UseMoles<TypeTag, TTag::StokesNC> { static constexpr bool value = true; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::StokesNC> { using type = Dumux::FreeFlowSubProblem<TypeTag> ; };
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; };
}
namespace Dumux {
/*!
* \ingroup NavierStokesTests
......@@ -349,6 +301,7 @@ private:
std::shared_ptr<CouplingManager> couplingManager_;
};
} //end namespace
} //end namespace Dumux
#endif // DUMUX_STOKES1P2C_SUBPROBLEM_HH
......@@ -49,28 +49,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::StokesNC>
{
using Traits = StaggeredMultiDomainTraits<TypeTag, TypeTag, Properties::TTag::DarcyOnePNC>;
using type = Dumux::StokesDarcyCouplingManager<Traits>;
};
template<class TypeTag>
struct CouplingManager<TypeTag, TTag::DarcyOnePNC>
{
using Traits = StaggeredMultiDomainTraits<Properties::TTag::StokesNC, Properties::TTag::StokesNC, TypeTag>;
using type = Dumux::StokesDarcyCouplingManager<Traits>;
};
} // end namespace Properties
} // end namespace Dumux
#include "properties.hh"
int main(int argc, char** argv) try
{
......
......@@ -24,78 +24,14 @@
#ifndef DUMUX_DARCY_SUBPROBLEM_HH
#define DUMUX_DARCY_SUBPROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/io/gnuplotinterface.hh>
#include <dumux/material/fluidsystems/1padapter.hh>
#include <dumux/material/fluidsystems/h2oair.hh>
#include <dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh>
#include <dumux/porousmediumflow/problem.hh>
// TODO: dumux-course-task 2.A
// Include 2pnc model here
#include <dumux/porousmediumflow/1pnc/model.hh>
// TODO: dumux-course-task 2.A
// Include spatial params for a 2-phase system
#include "../1pspatialparams.hh"
namespace Dumux
{
template <class TypeTag>
class PorousMediumSubProblem;
namespace 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>; };
} // end namespace TTag
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::DarcyOnePNC> { using type = Dumux::PorousMediumSubProblem<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>;
};
// Use moles
template<class TypeTag>
struct UseMoles<TypeTag, TTag::DarcyOnePNC> { static constexpr bool value = true; };
#include <dumux/common/properties.hh>
// Do not replace one equation with a total mass balance
template<class TypeTag>
struct ReplaceCompEqIdx<TypeTag, TTag::DarcyOnePNC> { 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>; };
// 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>>;
};
} // end namespace Properties
namespace Dumux {
/*!
* \brief The porous medium flow sub problem
*/
template <class TypeTag>
class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag>
{
......@@ -427,6 +363,7 @@ private:
Dumux::GnuplotInterface<Scalar> gnuplotInterfaceFluxes_;
Dumux::GnuplotInterface<Scalar> gnuplotStorage_;
};