Commit 1fce6130 authored by Simon Scholz's avatar Simon Scholz

Merge branch 'cleanup/efm' into 'master'

Cleanup/efm

See merge request !64
parents 131c2cf9 df5b51aa
......@@ -5,7 +5,6 @@ DtInitial = 1e0 # initial time step for the simulati
EpisodeLength = 5.0e6
[Grid]
LowerLeft = 0 0 # lower left corner coordinates (x,y) [m]
UpperRight = 4 2 # upper right corner coordinates (x,y) [m]
Cells = 40 20 # grid resolution in (x,y) direction [-]
......
......@@ -46,7 +46,7 @@ namespace Properties {
// Create new type tags
namespace TTag {
struct LensOnePTwoCProblem { using InheritsFrom = std::tuple<Lens1p2cSpatialParams, BoxModel, OnePNC>; };
struct LensOnePTwoCProblem { using InheritsFrom = std::tuple<OnePNC, BoxModel>; };
} // end namespace TTag
// Set the grid type
......@@ -70,6 +70,17 @@ struct FluidSystem<TypeTag, TTag::LensOnePTwoCProblem>
template<class TypeTag>
struct UseMoles<TypeTag, TTag::LensOnePTwoCProblem> { static constexpr bool value = true; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::LensOnePTwoCProblem>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = Lens1p2cSpatialParams<FVGridGeometry, Scalar>;
};
} // end namespace Properties
/*!
......
......@@ -22,11 +22,6 @@
* \brief DOC ME!
*/
// kaiw: This is the file to be changed!
// #include <dumux/common/start.hh>
#include <config.h>
#include <ctime>
#include <iostream>
......@@ -161,7 +156,7 @@ int main(int argc, char** argv) try
// check if we are about to restart a previously interrupted simulation
Scalar restartTime = 0;
if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart")) // Fehlt ebenso
if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart"))
restartTime = getParam<Scalar>("TimeLoop.Restart");
// intialize the vtk output module
......
......@@ -22,8 +22,6 @@
* \brief DOC ME!
*/
// kaiw: This file is to be changed!
#ifndef DUMUX_LENS_2P2C_PROBLEM_HH
#define DUMUX_LENS_2P2C_PROBLEM_HH
......@@ -51,7 +49,7 @@ namespace Properties {
// Create new type tags
namespace TTag {
struct LensTwoPTwoCProblem { using InheritsFrom = std::tuple<Lens2pSpatialParams, TwoPTwoC, BoxModel>; };
struct LensTwoPTwoCProblem { using InheritsFrom = std::tuple<TwoPTwoC, BoxModel>; };
} // end namespace TTag
// Set the grid type
......@@ -69,6 +67,18 @@ struct FluidSystem<TypeTag, TTag::LensTwoPTwoCProblem>
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = FluidSystems::H2ON2<Scalar, FluidSystems::H2ON2DefaultPolicy</*simplified=*/true>>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::LensTwoPTwoCProblem>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = Lens2pSpatialParams<FVGridGeometry, Scalar>;
};
} // end namespace Properties
/*!
......@@ -116,7 +126,6 @@ public:
: ParentType(fvGridGeometry)
{
temperature_ = 273.15 + 40; // [K]
depthBOR_ = 2700.0; // [m]
eps_ = 1e-6;
// initialize the tables of the fluid system
......@@ -284,7 +293,6 @@ private:
Scalar eps_;
Scalar episodeLength_; // [s]
Scalar temperature_; // [K]
Scalar depthBOR_; // [m]
Scalar upperPressure_; // [Pa]
Scalar lowerPressure_; // [Pa]
......
......@@ -34,6 +34,8 @@
#include <dumux/material/fluidsystems/1pgas.hh>
#include <dumux/material/fluidsystems/2pimmiscible.hh>
#include <dumux/material/components/tabulatedcomponent.hh>
#include "lens2pspatialparams.hh"
namespace Dumux {
......@@ -48,7 +50,7 @@ namespace Properties {
// Create new type tags
namespace TTag {
struct LensTwoPProblem { using InheritsFrom = std::tuple<Lens2pSpatialParams, TwoP, BoxModel>; };
struct LensTwoPProblem { using InheritsFrom = std::tuple<TwoP, BoxModel>; };
} // end namespace TTag
// Set the grid type
......@@ -64,11 +66,23 @@ template<class TypeTag>
struct FluidSystem<TypeTag, TTag::LensTwoPProblem>
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::H2O<Scalar> >;
using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::TabulatedComponent<Components::H2O<Scalar>> >;
using NonwettingPhase = FluidSystems::OnePGas<Scalar, Components::N2<Scalar> >;
using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::LensTwoPProblem>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = Lens2pSpatialParams<FVGridGeometry, Scalar>;
};
} // end namespace Properties
/*!
......@@ -127,6 +141,7 @@ public:
LensTwoPProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry)
: ParentType(fvGridGeometry)
{
FluidSystem::init();
// the boundary condition data
lowerPressure_ = getParam<Scalar>("Boundary.LowerPressure");
upperPressure_ = getParam<Scalar>("Boundary.UpperPressure");
......@@ -252,10 +267,6 @@ public:
PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const
{
PrimaryVariables values;
FluidState fluidState;
fluidState.setTemperature(this->temperature());
fluidState.setPressure(FluidSystem::phase0Idx, /*pressure=*/1.0e5);
fluidState.setPressure(FluidSystem::phase1Idx, /*pressure=*/1.0e5);
// no DNAPL, hydrostatic pressure
const Scalar depth = this->fvGridGeometry().bBoxMax()[1] - globalPos[1];
......@@ -269,9 +280,7 @@ public:
// \}
private:
static constexpr Scalar eps_ = 3e-6;
Scalar episodeLength_;
Scalar eps_ = 3e-6;
Scalar upperPressure_;
Scalar lowerPressure_;
......
......@@ -26,35 +26,12 @@
#ifndef DUMUX_LENS2P_SPATIALPARAMS_HH
#define DUMUX_LENS2P_SPATIALPARAMS_HH
#include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh>
#include <dumux/material/fluidmatrixinteractions/2p/regularizedbrookscorey.hh>
#include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh>
#include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh>
#include <dumux/material/spatialparams/fv.hh>
namespace Dumux {
//forward declaration
template<class FVGridGeometry, class Scalar>
class Lens2pSpatialParams;
namespace Properties {
// The spatial parameters TypeTag
NEW_TYPE_TAG(Lens2pSpatialParams);
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Lens2pSpatialParams>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = Lens2pSpatialParams<FVGridGeometry, Scalar>;
};
} // end namespace Properties
/** \todo Please doc me! */
......@@ -107,9 +84,6 @@ public:
outerMaterialParams_.setLambda( getParam<Scalar>("SpatialParams.CoarseBrooksCoreyLambda") );
}
~Lens2pSpatialParams()
{}
/*!
* \brief Apply the intrinsic permeability tensor to a pressure
* potential gradient.
......@@ -120,15 +94,13 @@ public:
* intrinsic velocity ought to be calculated.
*/
template<class ElementSolution>
Scalar permeability(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
PermeabilityType permeability(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
{
if (isInLens_(scv.dofPosition()))
return lensK_;
else
return outerK_;
return outerK_;
}
/*!
......@@ -148,9 +120,7 @@ public:
{
if (isInLens_(scv.dofPosition()))
return lensPorosity_;
else
return outerPorosity_;
return outerPorosity_;
}
/*!
......@@ -169,9 +139,7 @@ public:
{
if (isInLens_(scv.dofPosition()))
return lensMaterialParams_;
else
return outerMaterialParams_;
return outerMaterialParams_;
}
/*!
......@@ -205,7 +173,6 @@ private:
for (int i = 0; i < dimWorld; ++i)
if (globalPos[i] < lensLowerLeft_[i] - eps_ || globalPos[i] > lensUpperRight_[i] + eps_)
return false;
return true;
}
......
......@@ -22,8 +22,8 @@
* \brief DOC ME!
*/
#ifndef DUMUX_LENS2P_PROBLEM_HH
#define DUMUX_LENS2P_PROBLEM_HH
#ifndef DUMUX_LENS2P_EXERCISE1_PROBLEM_HH
#define DUMUX_LENS2P_EXERCISE1_PROBLEM_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/porousmediumflow/2p/model.hh>
......@@ -48,7 +48,7 @@ class LensTwoPProblem;
namespace Properties {
// Create new type tags
namespace TTag {
struct LensTwoPProblem { using InheritsFrom = std::tuple<Lens2pSpatialParams, TwoP, BoxModel>; };
struct LensTwoPProblem { using InheritsFrom = std::tuple<TwoP, BoxModel>; };
} // end namespace TTag
// Set the grid type
......@@ -69,6 +69,17 @@ struct FluidSystem<TypeTag, TTag::LensTwoPProblem>
using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::LensTwoPProblem>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = Lens2pSpatialParams<FVGridGeometry, Scalar>;
};
} // end namespace Properties
/*!
......@@ -129,8 +140,6 @@ class LensTwoPProblem : public PorousMediumFlowProblem<TypeTag>
// equation indices
static constexpr int contiNEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx;
// phase indices
static constexpr int wPhaseIdx = Indices::phase0Idx;
static constexpr int nPhaseIdx = Indices::phase1Idx;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
......@@ -154,7 +163,6 @@ public:
upperPressure_ = getParam<Scalar>("Boundary.UpperPressure");
infiltrationRate_ = getParam<Scalar>("Boundary.InfiltrationRate");
infiltrationStartTime_= 1.0e-9; //The infiltrations starts always after the first time step!
infiltrationEndTime_= getParam<Scalar>("Boundary.InfiltrationEndTime");
}
......@@ -287,12 +295,6 @@ public:
{
PrimaryVariables values(0.0);
using FluidState = GetPropType<TypeTag, Properties::FluidState>;
FluidState fluidState;
fluidState.setTemperature(this->temperature());
fluidState.setPressure(FluidSystem::phase0Idx, /*pressure=*/1e5);
fluidState.setPressure(FluidSystem::phase1Idx, /*pressure=*/1e5);
// no DNAPL, hydrostatic pressure
const Scalar depth = this->fvGridGeometry().bBoxMax()[1] - globalPos[1];
const Scalar height = this->fvGridGeometry().bBoxMax()[1] - this->fvGridGeometry().bBoxMin()[1];
......@@ -351,7 +353,6 @@ private:
Scalar upperPressure_;
Scalar lowerPressure_;
Scalar infiltrationRate_;
Scalar infiltrationStartTime_;
Scalar infiltrationEndTime_;
TimeLoopPtr timeLoop_;
};
......
......@@ -7,8 +7,7 @@ dune_add_test(NAME lens2pexercise2
--script fuzzy
--files ${CMAKE_SOURCE_DIR}/lecture/references/lens-2p-exercise2-reference.vtu
${CMAKE_CURRENT_BINARY_DIR}/lens-2p-00051.vtu
--command "${CMAKE_CURRENT_BINARY_DIR}/lens2pexercise2"
--zeroThreshold {"Sn":0.001})
--command "${CMAKE_CURRENT_BINARY_DIR}/lens2pexercise2")
# headers for installation and headercheck
install(FILES
......
......@@ -171,8 +171,9 @@ int main(int argc, char** argv) try
vtkWriter.write(0.0);
// instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd);
auto timeLoop = std::make_shared<CheckPointTimeLoop<Scalar>>(restartTime, dt, tEnd);
timeLoop->setMaxTimeStepSize(maxDt);
timeLoop->setPeriodicCheckPoint(getParam<Scalar>("TimeLoop.EpisodeLength", std::numeric_limits<Scalar>::max()));
problem->setTimeLoop(timeLoop);
// the assembler with time loop for instationary problem
......
[TimeLoop]
MaxTimeStepSize = 1.0e5 # maximal time step size [s]
TEnd = 5.0e6 # end time of the simulation [s]
MaxTimeStepSize = 200 # maximal time step size [s]
TEnd = 1e4 # end time of the simulation [s]
DtInitial = 1e2 # initial time step for the simulation [s]
EpisodeLength = 1.0e5
......
......@@ -22,8 +22,8 @@
* \brief DOC ME!
*/
#ifndef DUMUX_LENS2P_PROBLEM_HH
#define DUMUX_LENS2P_PROBLEM_HH
#ifndef DUMUX_LENS2P_EXERCISE2_PROBLEM_HH
#define DUMUX_LENS2P_EXERCISE2_PROBLEM_HH
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
......@@ -50,7 +50,7 @@ namespace Properties {
// Create new type tags
namespace TTag {
struct LensTwoPProblem { using InheritsFrom = std::tuple<Lens2pSpatialParams, TwoP, BoxModel>; };
struct LensTwoPProblem { using InheritsFrom = std::tuple<TwoP, BoxModel>; };
} // end namespace TTag
// Set the grid type
......@@ -70,6 +70,17 @@ struct FluidSystem<TypeTag, TTag::LensTwoPProblem>
using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
};
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::LensTwoPProblem>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = Lens2pSpatialParams<FVGridGeometry, Scalar>;
};
} // end namespace Properties
/*!
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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