Commit 8e50a877 authored by Timo Koch's avatar Timo Koch
Browse files

[material] Remove deprecated header and classes

parent b13a2874
......@@ -27,7 +27,6 @@
#include <dumux/common/typetraits/isvalid.hh>
#include <dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh>
#include <dumux/material/fluidmatrixinteractions/mp/mpadapter.hh>
namespace Dumux {
......@@ -273,49 +272,6 @@ auto makePcKrSw(const Scalar& scalar,
// Deprecation warnings for the mp material law stuff //
///////////////////////////////////////////////////////////////
template<class ScalarT, class SpatialParams, class Element, class Scv, class ElemSol, class NumPhases>
class PcKrSwMPHelper : public FluidMatrix::Adapter<PcKrSwMPHelper<ScalarT, SpatialParams, Element, Scv, ElemSol, NumPhases>, FluidMatrix::MultiPhasePcKrSw>
{
using MaterialLaw = typename SpatialParams::MaterialLaw;
using MPAdapter = Dumux::MPAdapter<MaterialLaw, NumPhases{}()>;
public:
using Scalar = ScalarT;
// pass scalar so template arguments can all be deduced
PcKrSwMPHelper(const Scalar& scalar,
const SpatialParams& sp,
const Element& element,
const Scv& scv,
const ElemSol& elemSol,
const NumPhases& np)
: spatialParams_(sp), element_(element), scv_(scv), elemSol_(elemSol)
{}
template<class FluidState>
auto capillaryPressures(const FluidState& fs, int wPhaseIdx) const
{
const auto& params = spatialParams_.materialLawParamsDeprecated(element_, scv_, elemSol_);
Dune::FieldVector<Scalar, NumPhases{}()> pc;
MPAdapter::capillaryPressures(pc, params, fs, wPhaseIdx);
return pc;
}
template<class FluidState>
auto relativePermeabilities(const FluidState& fs, int wPhaseIdx) const
{
const auto& params = spatialParams_.materialLawParamsDeprecated(element_, scv_, elemSol_);
Dune::FieldVector<Scalar, NumPhases{}()> kr;
MPAdapter::capillaryPressures(kr, params, fs, wPhaseIdx);
return kr;
}
private:
const SpatialParams& spatialParams_;
const Element& element_;
const Scv& scv_;
const ElemSol& elemSol_;
};
template<class Scalar, class SpatialParams, class Element, class Scv, class ElemSol, class NumPhases>
auto makeMPPcKrSw(const Scalar& scalar,
const SpatialParams& sp,
......@@ -324,15 +280,11 @@ auto makeMPPcKrSw(const Scalar& scalar,
const ElemSol& elemSol,
const NumPhases& np)
{
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
constexpr bool hasNew = decltype(isValid(HasNewFIAIF<Element, Scv, ElemSol>()).template check<SpatialParams>())::value;
constexpr bool hasNewAtPos = decltype(isValid(HasNewFIAIFAtPos<GlobalPosition>()).template check<SpatialParams>())::value;
if constexpr (hasNew)
return sp.fluidMatrixInteraction(element, scv, elemSol);
else if constexpr (hasNewAtPos)
return sp.fluidMatrixInteractionAtPos(scv.center());
else
return makeFluidMatrixInteraction(PcKrSwMPHelper(scalar, sp, element, scv, elemSol, np));
return sp.fluidMatrixInteractionAtPos(scv.center());
}
///////////////////////////////////////////////////////////////
......
......@@ -12,7 +12,6 @@ gnuplotinterface.hh
loadsolution.hh
name.hh
ploteffectivediffusivitymodel.hh
plotmateriallaw.hh
plotmateriallaw3p.hh
plotpckrsw.hh
plotthermalconductivitymodel.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 3 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
* \ingroup InputOutput
* \brief Interface for plotting the two-phase fluid-matrix-interaction laws
*/
#ifndef DUMUX_PLOT_FLUID_MATRIX_LAW_HH
#define DUMUX_PLOT_FLUID_MATRIX_LAW_HH
#warning "This header is deprecated and will be removed after 3.3. Use new 2p material laws and plot tools from io/plotpckrsw.hh"
#include <cmath>
#include <vector>
#include <string>
namespace Dumux {
// forward declaration
template<class Scalar> class GnuplotInterface;
/*!
* \ingroup InputOutput
* \brief Interface for plotting the two-phase fluid-matrix-interaction laws
*/
template<class Scalar, class MaterialLaw>
class PlotMaterialLaw
{
using MaterialLawParams = typename MaterialLaw::Params;
public:
//! Constructor
PlotMaterialLaw()
: numIntervals_(1000)
{ }
/*!
* \brief Add a capillary pressure-saturation data set to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerSat Minimum x-value for data set
* \param upperSat Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void addpcswcurve(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerSat = 0.0,
Scalar upperSat = 1.0,
std::string curveName = "pc-Sw",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw(numIntervals_+1);
std::vector<Scalar> pc(numIntervals_+1);
Scalar satInterval = upperSat - lowerSat;
for (int i = 0; i <= numIntervals_; i++)
{
sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
pc[i] = MaterialLaw::pc(params, sw[i]);
}
gnuplot.setXlabel("wetting phase saturation [-]");
gnuplot.setYlabel("capillary pressure [Pa]");
gnuplot.addDataSetToPlot(sw, pc, curveName, curveOptions);
}
/*!
* \brief Add a capillary pressure-saturation data set to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerSat Minimum x-value for data set
* \param upperSat Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void addLog10PcSwCurve(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerSat = 0.0,
Scalar upperSat = 1.0,
std::string curveName = "log10_pc-Sw.dat",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw(numIntervals_+1);
std::vector<Scalar> log10pc(numIntervals_+1);
Scalar satInterval = upperSat - lowerSat;
for (int i = 0; i <= numIntervals_; i++)
{
sw[i] = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
const Scalar pc = std::log10(MaterialLaw::pc(params, sw[i]));
log10pc[i] = std::isnan(pc) ? 0.0 : pc;
}
gnuplot.setXlabel("wetting phase saturation [-]");
gnuplot.setYlabel("log10 of capillary pressure [Pa]");
gnuplot.addDataSetToPlot(sw, log10pc, curveName, curveOptions);
}
/*!
* \brief Add a saturation-capillary pressure data set to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerpc Minimum x-value for data set
* \param upperpc Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void addswpccurve(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerpc = 0.0,
Scalar upperpc = 5000.0,
std::string curveName = "Sw-pc",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw;
std::vector<Scalar> pc;
Scalar pcInterval = upperpc - lowerpc;
Scalar pcTemp, swTemp = 0.0;
for (int i = 0; i <= numIntervals_; i++)
{
pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_);
swTemp = MaterialLaw::sw(params, pcTemp);
if (checkValues_(pcTemp, swTemp))
{
pc.push_back(pcTemp);
sw.push_back(swTemp);
}
}
gnuplot.setXlabel("capillary pressure [Pa]");
gnuplot.setYlabel("wetting phase saturation [-]");
gnuplot.addDataSetToPlot(pc, sw, curveName, curveOptions);
}
/*!
* \brief Add a saturation-capillary pressure data set to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerpc Minimum x-value for data set
* \param upperpc Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void addSwLog10PcCurve(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerpc = 1,
Scalar upperpc = 1e9,
std::string curveName = "Sw-pc",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw;
std::vector<Scalar> pc;
Scalar pcInterval = std::log10(upperpc) - std::log10(lowerpc);
Scalar pcTemp, swTemp = 0.0;
for (int i = 0; i <= numIntervals_; i++)
{
pcTemp = std::log10(lowerpc) + pcInterval * Scalar(i) / Scalar(numIntervals_);
swTemp = MaterialLaw::sw(params, std::pow(10, pcTemp));
pc.push_back(pcTemp);
sw.push_back(swTemp);
}
gnuplot.setXlabel("log10 capillary pressure [Pa]");
gnuplot.setYlabel("wetting phase saturation [-]");
gnuplot.addDataSetToPlot(pc, sw, curveName, curveOptions);
}
/*!
* \brief Add a capillary pressure-saturation gradient data set to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerSat Minimum x-value for data set
* \param upperSat Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void adddpcdswcurve(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerSat = 0.0,
Scalar upperSat = 1.0,
std::string curveName = "dpcdsw",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw;
std::vector<Scalar> dpcdsw;
Scalar satInterval = upperSat - lowerSat;
Scalar swTemp, dpcdswTemp = 0.0;
for (int i = 0; i <= numIntervals_; i++)
{
swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
dpcdswTemp = MaterialLaw::dpc_dsw(params, swTemp);
if (checkValues_(swTemp, dpcdsw))
{
sw.push_back(swTemp);
dpcdsw.push_back(dpcdswTemp);
}
}
gnuplot.setXlabel("wetting phase saturation [-]");
gnuplot.setYlabel("gradient of the pc-Sw curve [Pa]");
gnuplot.addDataSetToPlot(sw, dpcdsw, curveName, curveOptions);
}
/*!
* \brief Add a saturation-capillary pressure gradient data set to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerpc Minimum x-value for data set
* \param upperpc Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void adddswdpccurve(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerpc = 0.0,
Scalar upperpc = 5000.0,
std::string curveName = "dswdpc",
std::string curveOptions = "w l")
{
std::vector<Scalar> pc;
std::vector<Scalar> dswdpc;
Scalar pcInterval = upperpc - lowerpc;
Scalar dswdpcTemp, pcTemp = 0.0;
for (int i = 0; i <= numIntervals_; i++)
{
pcTemp = lowerpc + pcInterval * Scalar(i) / Scalar(numIntervals_);
dswdpcTemp = MaterialLaw::dsw_dpc(params, pcTemp);
if (checkValues_(pcTemp, dswdpcTemp))
{
pc.push_back(pcTemp);
dswdpc.push_back(dswdpcTemp);
}
}
gnuplot.setXlabel("capillary pressure [Pa]");
gnuplot.setYlabel("gradient of the Sw-pc curve [1/Pa]");
gnuplot.addDataSetToPlot(pc, dswdpc, curveName, curveOptions);
}
/*!
* \brief Add relative permeabilities data sets to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerSat Minimum x-value for data set
* \param upperSat Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void addkrcurves(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerSat = 0.0,
Scalar upperSat = 1.0,
std::string curveName = "kr",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw;
std::vector<Scalar> krw;
std::vector<Scalar> krn;
Scalar satInterval = upperSat - lowerSat;
Scalar swTemp, krwTemp, krnTemp = 0.0;
for (int i = 0; i <= numIntervals_; i++)
{
swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
krwTemp = MaterialLaw::krw(params, swTemp);
krnTemp = MaterialLaw::krn(params, swTemp);
if (checkValues_(swTemp, krwTemp) && checkValues_(swTemp, krnTemp))
{
sw.push_back(swTemp);
krw.push_back(krwTemp);
krn.push_back(krnTemp);
}
}
gnuplot.setXlabel("wetting phase saturation [-]");
gnuplot.setYlabel("relative permeability [-]");
gnuplot.addDataSetToPlot(sw, krw, curveName + "_krw", curveOptions);
gnuplot.addDataSetToPlot(sw, krn, curveName + "_krn", curveOptions);
}
/*!
* \brief Add relative permeabilities gradients data sets to the plot
*
* \param gnuplot The gnuplot interface
* \param params The material law parameters
* \param lowerSat Minimum x-value for data set
* \param upperSat Maximum x-value for data set
* \param curveName Name of the data set
* \param curveOptions Plotting options associated with that data set
*/
void adddkrdswcurves(GnuplotInterface<Scalar> &gnuplot,
const MaterialLawParams &params,
Scalar lowerSat = 0.0,
Scalar upperSat = 1.0,
std::string curveName = "dkrndsw",
std::string curveOptions = "w l")
{
std::vector<Scalar> sw;
std::vector<Scalar> dkrw_dsw;
std::vector<Scalar> dkrn_dsw;
Scalar satInterval = upperSat - lowerSat;
Scalar swTemp, dkrwdswTemp, dkrndswTemp = 0.0;
for (int i = 0; i <= numIntervals_; i++)
{
swTemp = lowerSat + satInterval * Scalar(i) / Scalar(numIntervals_);
dkrwdswTemp = MaterialLaw::dkrw_dsw(params, swTemp);
dkrndswTemp = MaterialLaw::dkrn_dsw(params, swTemp);
if (checkValues_(swTemp, dkrwdswTemp) && checkValues_(swTemp, dkrndswTemp))
{
sw.push_back(swTemp);
dkrw_dsw.push_back(dkrwdswTemp);
dkrn_dsw.push_back(dkrndswTemp);
}
}
gnuplot.setXlabel("wetting phase saturation [-]");
gnuplot.setYlabel("gradient of the kr-Sw function [-]");
gnuplot.addDataSetToPlot(sw, dkrw_dsw, curveName + "_dkrw_dsw", curveOptions);
gnuplot.addDataSetToPlot(sw, dkrn_dsw, curveName + "_dkrn_dsw", curveOptions);
}
private:
/*!
* \brief Check the values for occurrences of nan and inf
*
* \param value1 A data point value
* \param value2 An other data point value
*/
bool checkValues_(Scalar value1, Scalar value2)
{
using std::isnan;
using std::isinf;
return !isnan(value1) && !isinf(value1)
&& !isnan(value2) && !isinf(value2);
}
int numIntervals_;
};
} // end namespace Dumux
#endif
......@@ -3,29 +3,17 @@ add_subdirectory(thermalconductivity)
install(FILES
brookscorey.hh
brookscoreyparams.hh
datasplinemateriallaw.hh
efftoabsdefaultpolicy.hh
efftoabslaw.hh
efftoabslawparams.hh
heatpipelaw.hh
heatpipelawparams.hh
linearmaterial.hh
linearmaterialparams.hh
materiallaw.hh
noregularization.hh
regularizedbrookscorey.hh
regularizedbrookscoreyparams.hh
regularizedlinearmaterial.hh
regularizedlinearmaterialparams.hh
regularizedvangenuchten.hh
regularizedvangenuchtenparams.hh
smoothedlinearlaw.hh
splinemateriallaw.hh
thermalconductivityjohansen.hh
thermalconductivitysimplefluidlumping.hh
thermalconductivitysomerton.hh
vangenuchten.hh
vangenuchtenoftemperature.hh
vangenuchtenparams.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/material/fluidmatrixinteractions/2p)
......@@ -25,256 +25,6 @@
#ifndef DUMUX_MATERIAL_FLUIDMATRIX_BROOKS_COREY_HH
#define DUMUX_MATERIAL_FLUIDMATRIX_BROOKS_COREY_HH
// remove from here after release 3.3 /////////////
#include "brookscoreyparams.hh"
#include <algorithm>
#include <cmath>
namespace Dumux {
/*!
* \ingroup Fluidmatrixinteractions
*
* \brief Implementation of the Brooks-Corey capillary pressure <->
* saturation relation. This class bundles the "raw" curves
* as static members and doesn't concern itself converting
* absolute to effective saturations and vice versa.
*
* For general info: EffToAbsLaw
*
*\see BrooksCoreyParams
*/
template <class ScalarT, class ParamsT = BrooksCoreyParams<ScalarT> >
class [[deprecated("Use new material laws and FluidMatrix::BrooksCorey instead!")]] BrooksCorey
{
public:
using Params = ParamsT;
using Scalar = typename Params::Scalar;
/*!
* \brief The capillary pressure-saturation curve according to Brooks & Corey.
*
* The Brooks-Corey empirical capillary pressure <-> saturation
* function is given by
*
* \f$\mathrm{ p_C = p_e\overline{S}_w^{-1/\lambda}
* }\f$
*
* \param swe Effective saturation of the wetting phase \f$\mathrm{[\overline{S}_w]}\f$
* \param params A container object that is populated with the appropriate coefficients for the respective law.
* Therefore, in the (problem specific) spatialParameters first, the material law is chosen,
and then the params container is constructed accordingly. Afterwards the values are set there, too.
* \return Capillary pressure calculated by Brooks & Corey constitutive relation.
*
* \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number,
* by clamping the input.
*/
static Scalar pc(const Params &params, Scalar swe)
{
using std::pow;
using std::clamp;
swe = clamp(swe, 0.0, 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0
return params.pe()*pow(swe, -1.0/params.lambda());
}
/*!
* \brief The saturation-capillary pressure curve according to Brooks & Corey.
*
* This is the inverse of the capillary pressure-saturation curve:
* \f$\mathrm{ \overline{S}_w = (\frac{p_C}{p_e})^{-\lambda}}\f$
*
* \param pc Capillary pressure \f$\mathrm{[p_C]}\f$ in \f$\mathrm{[Pa]}\f$.
* \param params A container object that is populated with the appropriate coefficients for the respective law.
* Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container
* is constructed accordingly. Afterwards the values are set there, too.
* \return Effective wetting phase saturation calculated as inverse of BrooksCorey constitutive relation.
*
* \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number,
* by clamping the input.
*/
static Scalar sw(const Params &params, Scalar pc)
{
using std::pow;
using std::max;
pc = max(pc, 0.0); // the equation below is undefined for negative pcs
return pow(pc/params.pe(), -params.lambda());
}
/*!
* \brief The capillary pressure at Swe = 1.0 also called end point capillary pressure
*
* \param params A container object that is populated with the appropriate coefficients for the respective law.
* Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container
* is constructed accordingly. Afterwards the values are set there, too.
*/
static Scalar endPointPc(const Params &params)
{ return params.pe(); }
/*!
* \brief The partial derivative of the capillary
* pressure w.r.t. the effective saturation according to Brooks & Corey.
*
* This is equivalent to
* \f$\mathrm{\frac{\partial p_C}{\partial \overline{S}_w} =
* -\frac{p_e}{\lambda} \overline{S}_w^{-1/\lambda - 1}
* }\f$
*
* \param swe Effective saturation of the wetting phase \f$\mathrm{[\overline{S}_w]}\f$
* \param params A container object that is populated with the appropriate coefficients for the respective law.
* Therefore, in the (problem specific) spatialParameters first, the material law is chosen, and then the params container
* is constructed accordingly. Afterwards the values are set there, too.
* \return Partial derivative of \f$\mathrm{[p_c]}\f$ w.r.t. effective saturation according to Brooks & Corey.
*
* \note Instead of undefined behaviour if pc is not in the valid range, we return a valid number,
* by clamping the input.
*/
static Scalar dpc_dswe(const Params &params, Scalar swe)
{
using std::pow;
using std::clamp;
swe = clamp(swe, 0.0, 1.0); // the equation below is only defined for 0.0 <= sw <= 1.0