Commit bcc28660 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[mortar-stokes-darcy] implement dummy classes for staggered

parent 08dac426
......@@ -43,6 +43,32 @@ namespace Dumux {
template< class Traits, DiscretizationMethod subDomainDM = Traits::SubDomainGridGeometry::discMethod>
class MortarFluxProjector;
/*!
* \ingroup TODO doc me.
* \brief TODO doc me.
*/
template< class Traits >
class MortarFluxProjector< Traits, DiscretizationMethod::staggered >
: public MortarProjectorBase< Traits >
{
using ParentType = MortarProjectorBase< Traits >;
public:
//! The constructor
MortarFluxProjector(std::shared_ptr<const typename Traits::MortarFEBasis> mortarFEBasis,
std::shared_ptr<const typename Traits::SubDomainGridGeometry> subDomainGridGeometry,
std::shared_ptr<const typename Traits::SubDomainGridVariables> subDomainGridVariables,
const std::string& paramGroup = "")
: ParentType(mortarFEBasis, subDomainGridGeometry, paramGroup)
{}
//! projects the sub-domain interface pressures to mortar space
typename Traits::MortarSolutionVector projectInterfacePressures() const
{
DUNE_THROW(Dune::NotImplemented, "Staggered Projecter class");
}
};
/*!
* \ingroup TODO doc me.
* \brief TODO doc me.
......
......@@ -277,6 +277,29 @@ int main(int argc, char** argv) try
Properties::TTag::DarcyOnePBoxFlux, DarcySolverType<Properties::TTag::DarcyOnePBoxFlux>, fmv >();
}
}
else if (solver1Type == "Darcy" && solver2Type == "Stokes")
{
if (discScheme1 == "Tpfa")
{
if (mortarVariableType == "Pressure")
solveMortar< Properties::TTag::DarcyOnePTpfaPressure, DarcySolverType<Properties::TTag::DarcyOnePTpfaPressure>,
Properties::TTag::StokesOnePPressure, StokesSolverType<Properties::TTag::StokesOnePPressure>, pmv >();
else
solveMortar< Properties::TTag::DarcyOnePTpfaFlux, DarcySolverType<Properties::TTag::DarcyOnePTpfaFlux>,
Properties::TTag::StokesOnePFlux, StokesSolverType<Properties::TTag::StokesOnePFlux>, fmv >();
}
else if (discScheme1 == "Box")
{
if (mortarVariableType == "Pressure")
solveMortar< Properties::TTag::DarcyOnePBoxPressure, DarcySolverType<Properties::TTag::DarcyOnePBoxPressure>,
Properties::TTag::StokesOnePPressure, StokesSolverType<Properties::TTag::StokesOnePPressure>, pmv >();
else
solveMortar< Properties::TTag::DarcyOnePBoxFlux, DarcySolverType<Properties::TTag::DarcyOnePBoxFlux>,
Properties::TTag::StokesOnePFlux, StokesSolverType<Properties::TTag::StokesOnePFlux>, fmv >();
}
}
else
DUNE_THROW(Dune::InvalidStateException, "Solver combination not implemented!");
......
......@@ -25,6 +25,7 @@ Grid.UpperRight = 1 2
Grid.Cells = 20 20
Problem.Name = darcy2
Problem.IsOnNegativeMortarSide = true
Problem.PressureDifference = 1e5
SpatialParams.Permeability = 1.0 # m^2
SpatialParams.AlphaBeaversJoseph = 1.0
......
......@@ -41,6 +41,35 @@ namespace Dumux {
template< class Traits, DiscretizationMethod subDomainDM = Traits::SubDomainGridGeometry::discMethod>
class MortarPressureProjector;
/*!
* \ingroup TODO doc me.
* \brief TODO doc me.
*/
template< class Traits >
class MortarPressureProjector< Traits, DiscretizationMethod::staggered>
: public MortarProjectorBase< Traits >
{
using ParentType = MortarProjectorBase< Traits >;
public:
//! export type used for scalar values
using typename ParentType::Scalar;
//! The constructor
MortarPressureProjector(std::shared_ptr<const typename Traits::MortarFEBasis> mortarFEBasis,
std::shared_ptr<const typename Traits::SubDomainGridGeometry> subDomainGridGeometry,
std::shared_ptr<const typename Traits::SubDomainGridVariables> subDomainGridVariables,
const std::string& paramGroup = "")
: ParentType(mortarFEBasis, subDomainGridGeometry, paramGroup)
{}
//! projects the sub-domain interface fluxes to mortar space
typename Traits::MortarSolutionVector projectInterfaceFluxes() const
{
DUNE_THROW(Dune::NotImplemented, "Staggered Projecter class");
}
};
/*!
* \ingroup TODO doc me.
* \brief TODO doc me.
......
......@@ -91,6 +91,7 @@ class StokesSubProblem : public NavierStokesProblem<TypeTag>
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using Element = typename GridView::template Codim<0>::Entity;
using Projector = GetPropType<TypeTag, Properties::MortarProjector>;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
......@@ -101,7 +102,14 @@ public:
StokesSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup)
: ParentType(fvGridGeometry, paramGroup)
, eps_(1e-6)
, isOnNegativeMortarSide_(getParamFromGroup<bool>(paramGroup, "Problem.IsOnNegativeMortarSide"))
{
const auto mortarVariable = getParamFromGroup<std::string>("Mortar", "VariableType");
if (mortarVariable == "Pressure")
useDirichletAtInterface_ = true;
else if (mortarVariable == "Flux")
useDirichletAtInterface_ = false;
problemName_ = getParamFromGroup<std::string>(paramGroup, "Vtk.OutputName") + "_" + getParamFromGroup<std::string>(this->paramGroup(), "Problem.Name");
}
......@@ -228,6 +236,25 @@ public:
return values;
}
//! set the pointer to the projector class
void setMortarProjector(std::shared_ptr<const Projector> p)
{
projector_ = p;
}
//! Set whether or not the homogeneous system is solved
void setUseHomogeneousSetup(bool value)
{
useHomogeneousSetup_ = value;
}
//! Returns true if a position if on the mortar interface
bool isOnMortarInterface(const GlobalPosition& globalPos) const
{
return (isOnNegativeMortarSide_ && onLowerBoundary_(globalPos))
|| (!isOnNegativeMortarSide_ && onUpperBoundary_(globalPos));
}
private:
bool onLeftBoundary_(const GlobalPosition &globalPos) const
{ return globalPos[0] < this->fvGridGeometry().bBoxMin()[0] + eps_; }
......@@ -243,6 +270,11 @@ private:
Scalar eps_;
std::string problemName_;
std::shared_ptr<const Projector> projector_;
bool isOnNegativeMortarSide_;
bool useHomogeneousSetup_;
bool useDirichletAtInterface_;
};
} // end namespace Dumux
......
......@@ -68,17 +68,18 @@ public:
problem_ = std::make_shared<Problem>(fvGridGeometry_, paramGroup);
// resize and initialize the given solution vector
x_[FVGridGeometry::cellCenterIdx()].resize(fvGridGeometry_->numCellCenterDofs());
x_[FVGridGeometry::faceIdx()].resize(fvGridGeometry_->numFaceDofs());
problem_->applyInitialSolution(x_);
x_ = std::make_shared<SolutionVector>();
(*x_)[FVGridGeometry::cellCenterIdx()].resize(fvGridGeometry_->numCellCenterDofs());
(*x_)[FVGridGeometry::faceIdx()].resize(fvGridGeometry_->numFaceDofs());
problem_->applyInitialSolution(*x_);
// the grid variables
gridVariables_ = std::make_shared<GridVariables>(problem_, fvGridGeometry_);
gridVariables_->init(x_);
gridVariables_->init(*x_);
// initialize the vtk output module
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
vtkWriter_ = std::make_unique<OutputModule>(*gridVariables_, x_, problem_->name());
vtkWriter_ = std::make_unique<OutputModule>(*gridVariables_, *x_, problem_->name());
IOFields::initOutputModule(*vtkWriter_);
// the assembler without time loop for stationary problem
......@@ -89,20 +90,32 @@ public:
newtonSolver_ = std::make_unique<NewtonSolver>(assembler_, linearSolver);
}
//! Solve the system
void solve()
{
newtonSolver_->solve(x_);
newtonSolver_->solve(*x_);
}
//! Write current state to disk
void write(Scalar t)
{
vtkWriter_->write(t);
}
//! Return a pointer to the grid geometry
std::shared_ptr<FVGridGeometry> gridGeometryPointer()
{ return fvGridGeometry_; }
const SolutionVector& solution()
//! Return a pointer to the grid variables
std::shared_ptr<GridVariables> gridVariablesPointer()
{ return gridVariables_; }
//! Return a pointer to the problem
std::shared_ptr<Problem> problemPointer()
{ return problem_; }
//! Return a pointer to the solution
std::shared_ptr<SolutionVector> solutionPointer()
{ return x_; }
private:
......@@ -115,7 +128,7 @@ private:
std::unique_ptr<NewtonSolver> newtonSolver_;
std::unique_ptr<OutputModule> vtkWriter_;
SolutionVector x_;
std::shared_ptr<SolutionVector> x_;
};
......
......@@ -102,5 +102,10 @@ struct MortarProjector<TypeTag, TTag::DarcyOnePMpfaFlux> { using type = typename
template<class TypeTag>
struct MortarProjector<TypeTag, TTag::DarcyOnePBoxFlux> { using type = typename FluxProjectorTraits<TypeTag>::type; };
template<class TypeTag>
struct MortarProjector<TypeTag, TTag::StokesOnePPressure> { using type = typename PressureProjectorTraits<TypeTag>::type; };
template<class TypeTag>
struct MortarProjector<TypeTag, TTag::StokesOnePFlux> { using type = typename FluxProjectorTraits<TypeTag>::type; };
} // end namespace Properties
} // end namespace Dumux
Supports Markdown
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