Commit 55df5f9f authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[test]

added new tests for all diffusivity and thermalconductivity laws
use debug streams in gnuplotinterface

reviewed by martinb



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14549 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 9e9baa18
......@@ -120,6 +120,8 @@ AC_CONFIG_FILES([dumux.pc
test/geomechanics/el1p2c/Makefile
test/geomechanics/el2p/Makefile
test/material/Makefile
test/material/fluidmatrixinteractions/Makefile
test/material/fluidmatrixinteractions/2p/Makefile
test/material/fluidsystems/Makefile
test/material/immiscibleflash/Makefile
test/material/ncpflash/Makefile
......
......@@ -42,6 +42,8 @@
#include <string>
#include <vector>
#include <dune/common/stdstreams.hh>
namespace Dumux
{
/*!
......@@ -306,9 +308,9 @@ private:
void checkNumber(Scalar number, std::string text = "") const
{
if (std::isnan(number))
std::cout << "warning: " << text << " is not a number, adjust your data range" << std::endl;
Dune::dwarn << "warning: " << text << " is not a number, adjust your data range" << std::endl;
if (std::isinf(number))
std::cout << "warning: " << text << " is infinity, adjust your data range" << std::endl;
Dune::dwarn << "warning: " << text << " is infinity, adjust your data range" << std::endl;
}
// Convert number to string
......
add_subdirectory("fluidsystems")
add_subdirectory("fluidmatrixinteractions")
add_subdirectory("immiscibleflash")
add_subdirectory("ncpflash")
add_subdirectory("pengrobinson")
......
SUBDIRS = fluidsystems immiscibleflash ncpflash pengrobinson tabulation
SUBDIRS = fluidmatrixinteractions \
fluidsystems \
immiscibleflash \
ncpflash \
pengrobinson \
tabulation
EXTRA_DIST=CMakeLists.txt
include $(top_srcdir)/am/global-rules
......
add_dumux_test(test_thermalconductivityjohansen test_thermalconductivityjohansen test_thermalconductivityjohansen.cc
${CMAKE_SOURCE_DIR}/bin/runTest.sh
exact
${CMAKE_SOURCE_DIR}/test/references/thermalconductivityjohansen-reference.dat
${CMAKE_CURRENT_BINARY_DIR}/8_lambda_eff.dat
${CMAKE_CURRENT_BINARY_DIR}/test_thermalconductivityjohansen
-TimeManager.DtInitial 1 # [s]
-TimeManager.TEnd 2 # [s]
-Grid.File ${CMAKE_SOURCE_DIR}/test/implicit/2p/grids/test_2p.dgf
)
add_dumux_test(test_thermalconductivitysomerton test_thermalconductivitysomerton test_thermalconductivitysomerton.cc
${CMAKE_SOURCE_DIR}/bin/runTest.sh
exact
${CMAKE_SOURCE_DIR}/test/references/thermalconductivitysomerton-reference.dat
${CMAKE_CURRENT_BINARY_DIR}/8_lambda_eff.dat
${CMAKE_CURRENT_BINARY_DIR}/test_thermalconductivitysomerton
-TimeManager.DtInitial 1 # [s]
-TimeManager.TEnd 2 # [s]
-Grid.File ${CMAKE_SOURCE_DIR}/test/implicit/2p/grids/test_2p.dgf
)
check_PROGRAMS = test_thermalconductivityjohansen \
test_thermalconductivitysomerton
test_thermalconductivityjohansen_SOURCES = test_thermalconductivityjohansen.cc
test_thermalconductivitysomerton_SOURCES = test_thermalconductivitysomerton.cc
EXTRA_DIST=CMakeLists.txt
noinst_HEADERS:=$(wildcard *.hh)
include $(top_srcdir)/am/global-rules
// -*- 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 Test for the Johansen thermal conductivity law
*/
#include "config.h"
#include "thermalconductivityjohansenproblem.hh"
#include <dumux/common/start.hh>
/*!
* \brief Provides an interface for customizing error messages associated with
* reading in parameters.
*
* \param progName The name of the program, that was tried to be started.
* \param errorMsg The error message that was issued by the start function.
* Comprises the thing that went wrong and a general help message.
*/
void usage(const char *progName, const std::string &errorMsg)
{
if (errorMsg.size() > 0) {
std::string errorMessageOut = "\nUsage: ";
errorMessageOut += progName;
errorMessageOut += " [options]\n";
errorMessageOut += errorMsg;
errorMessageOut += "\n\nThe list of mandatory options for this program is:\n"
"\t-TimeManager.TEnd End of the simulation [s] \n"
"\t-TimeManager.DtInitial Initial timestep size [s] \n"
"\t-Grid.File Name of the file containing the grid \n"
"\t definition in DGF format\n";
std::cout << errorMessageOut
<< "\n";
}
}
int main(int argc, char** argv)
{
typedef TTAG(ThermalConductivityJohansenProblem) ProblemTypeTag;
return Dumux::start<ProblemTypeTag>(argc, argv, usage);
}
// -*- 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 Test for the Somerton thermal conductivity law
*/
#include "config.h"
#include "thermalconductivitysomertonproblem.hh"
#include <dumux/common/start.hh>
/*!
* \brief Provides an interface for customizing error messages associated with
* reading in parameters.
*
* \param progName The name of the program, that was tried to be started.
* \param errorMsg The error message that was issued by the start function.
* Comprises the thing that went wrong and a general help message.
*/
void usage(const char *progName, const std::string &errorMsg)
{
if (errorMsg.size() > 0) {
std::string errorMessageOut = "\nUsage: ";
errorMessageOut += progName;
errorMessageOut += " [options]\n";
errorMessageOut += errorMsg;
errorMessageOut += "\n\nThe list of mandatory options for this program is:\n"
"\t-TimeManager.TEnd End of the simulation [s] \n"
"\t-TimeManager.DtInitial Initial timestep size [s] \n"
"\t-Grid.File Name of the file containing the grid \n"
"\t definition in DGF format\n";
std::cout << errorMessageOut
<< "\n";
}
}
int main(int argc, char** argv)
{
typedef TTAG(ThermalConductivitySomertonProblem) ProblemTypeTag;
return Dumux::start<ProblemTypeTag>(argc, argv, usage);
}
// -*- 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 Simple test problem for the Johansen thermal conductivity law
*/
#ifndef DUMUX_THERMAL_CONDUCTIVITY_JOHANSEN_PROBLEM_HH
#define DUMUX_THERMAL_CONDUCTIVITY_JOHANSEN_PROBLEM_HH
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <dumux/material/fluidsystems/h2on2fluidsystem.hh>
#include <dumux/implicit/2p2c/2p2cmodel.hh>
#include <dumux/implicit/common/implicitporousmediaproblem.hh>
#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivityjohansen.hh>
#include "thermalconductivityspatialparams.hh"
#define ISOTHERMAL 0
namespace Dumux
{
template <class TypeTag>
class ThermalConductivityJohansenProblem;
namespace Properties
{
NEW_TYPE_TAG(ThermalConductivityJohansenProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, ThermalConductivitySpatialParams));
// Set the grid type
SET_TYPE_PROP(ThermalConductivityJohansenProblem, Grid, Dune::YaspGrid<2>);
// Set the problem property
SET_TYPE_PROP(ThermalConductivityJohansenProblem, Problem, Dumux::ThermalConductivityJohansenProblem<TypeTag>);
// Set the wetting phase
SET_TYPE_PROP(ThermalConductivityJohansenProblem, FluidSystem, Dumux::FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>);
// Set thermal conductivity law
SET_TYPE_PROP(ThermalConductivityJohansenProblem, ThermalConductivityModel,
ThermalConductivityJohansen<typename GET_PROP_TYPE(TypeTag, Scalar)>);
}
/*!
* \ingroup MaterialTestProblems
*
* \brief Simple test problem for the Johansen thermal conductivity law
*
* To run the test execute the following line in shell:
* <tt>./test_thermalconductivityjohansen</tt>
*
*/
template <class TypeTag >
class ThermalConductivityJohansenProblem : public ImplicitPorousMediaProblem<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GridView::Grid Grid;
typedef ImplicitPorousMediaProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
// copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum {
pressureIdx = Indices::pressureIdx,
switchIdx = Indices::switchIdx,
temperatureIdx = Indices::temperatureIdx,
// Phase State
wPhaseOnly = Indices::wPhaseOnly,
// Grid and world dimension
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GridView::template Codim<dim>::Entity Vertex;
typedef typename GridView::Intersection Intersection;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
//! property that defines whether mole or mass fractions are used
static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
public:
/*!
* \brief The constructor.
*
* \param timeManager The time manager
* \param gridView The grid view
*/
ThermalConductivityJohansenProblem(TimeManager &timeManager, const GridView &gridView)
: ParentType(timeManager, gridView)
{
FluidSystem::init();
this->spatialParams().plotMaterialLaw();
}
/*!
* \name Problem parameters
*/
// \{
/*!
* \brief The problem name.
*
* This is used as a prefix for files generated by the simulation.
*/
const std::string name() const
{ return "test_thermalconductivitysomerton"; }
//! \copydoc Dumux::ImplicitProblem::sourceAtPos()
void sourceAtPos(PrimaryVariables &values,
const GlobalPosition &globalPos) const
{
values = 0;
}
// \}
/*!
* \name Boundary conditions
*/
// \{
//! \copydoc Dumux::ImplicitProblem::boundaryTypesAtPos()
void boundaryTypesAtPos(BoundaryTypes &values,
const GlobalPosition &globalPos) const
{
values.setAllDirichlet();
}
//! \copydoc Dumux::ImplicitProblem::dirichletAtPos()
void dirichletAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
{
initial_(values, globalPos);
}
//! \copydoc Dumux::ImplicitProblem::neumann()
void neumann(PrimaryVariables &values,
const Element &element,
const FVElementGeometry &fvGeometry,
const Intersection &intersection,
const int scvIdx,
const int boundaryFaceIdx) const
{
values = 0;
}
// \}
/*!
* \name Volume terms
*/
// \{
//! \copydoc Dumux::ImplicitProblem::initialAtPos()
void initialAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const
{
initial_(values, globalPos);
}
//! \copydoc Dumux::ImplicitProblem::initialPhasePresence()
int initialPhasePresence(const Vertex &vertex,
int &vIdxGlobal,
const GlobalPosition &globalPos) const
{
return wPhaseOnly;
}
private:
// internal method for the initial condition (reused for the
// dirichlet conditions!)
void initial_(PrimaryVariables &values,
const GlobalPosition &globalPos) const
{
Scalar densityW = 1000.0;
values[pressureIdx] = 1e5 + globalPos[1]*densityW*9.81;
values[switchIdx] = 0.0;
values[temperatureIdx] = 283.0 + globalPos[1]*0.03;
}
};
} //end namespace
#endif
// -*- 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 Simple test problem for the Somerton thermal conductivity law
*/
#ifndef DUMUX_THERMAL_CONDUCTIVITY_SOMERTON_PROBLEM_HH
#define DUMUX_THERMAL_CONDUCTIVITY_SOMERTON_PROBLEM_HH
#include <dune/grid/io/file/dgfparser/dgfyasp.hh>
#include <dumux/material/fluidsystems/h2on2fluidsystem.hh>
#include <dumux/implicit/2p2c/2p2cmodel.hh>
#include <dumux/implicit/common/implicitporousmediaproblem.hh>
#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh>
#include "thermalconductivityspatialparams.hh"
#define ISOTHERMAL 0
namespace Dumux
{
template <class TypeTag>
class ThermalConductivitySomertonProblem;
namespace Properties
{
NEW_TYPE_TAG(ThermalConductivitySomertonProblem, INHERITS_FROM(BoxModel, TwoPTwoCNI, ThermalConductivitySpatialParams));
// Set the grid type
SET_TYPE_PROP(ThermalConductivitySomertonProblem, Grid, Dune::YaspGrid<2>);
// Set the problem property
SET_TYPE_PROP(ThermalConductivitySomertonProblem, Problem, Dumux::ThermalConductivitySomertonProblem<TypeTag>);
// Set the wetting phase
SET_TYPE_PROP(ThermalConductivitySomertonProblem, FluidSystem, Dumux::FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), false>);
// Set thermal conductivity law
SET_TYPE_PROP(ThermalConductivitySomertonProblem, ThermalConductivityModel,
ThermalConductivitySomerton<typename GET_PROP_TYPE(TypeTag, Scalar)>);
}
/*!
* \ingroup MaterialTestProblems
*
* \brief Simple test problem for the Somerton thermal conductivity law
*
* To run the test execute the following line in shell:
* <tt>./test_thermalconductivitysomerton</tt>
*
*/
template <class TypeTag >
class ThermalConductivitySomertonProblem : public ImplicitPorousMediaProblem<TypeTag>
{
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GridView::Grid Grid;
typedef ImplicitPorousMediaProblem<TypeTag> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
// copy some indices for convenience
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum {
pressureIdx = Indices::pressureIdx,
switchIdx = Indices::switchIdx,
temperatureIdx = Indices::temperatureIdx,
// Phase State
wPhaseOnly = Indices::wPhaseOnly,
// Grid and world dimension
dim = GridView::dimension,
dimWorld = GridView::dimensionworld
};
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes;
typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GridView::template Codim<dim>::Entity Vertex;
typedef typename GridView::Intersection Intersection;
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
//! property that defines whether mole or mass fractions are used
static const bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
public:
/*!
* \brief The constructor.
*
* \param timeManager The time manager
* \param gridView The grid view
*/
ThermalConductivitySomertonProblem(TimeManager &timeManager, const GridView &gridView)
: ParentType(timeManager, gridView)
{
FluidSystem::init();
this->spatialParams().plotMaterialLaw();
}
/*!
* \name Problem parameters
*/
// \{
/*!
* \brief The problem name.
*
* This is used as a prefix for files generated by the simulation.
*/
const std::string name() const
{ return "test_thermalconductivitysomerton"; }
//! \copydoc Dumux::ImplicitProblem::sourceAtPos()
void sourceAtPos(PrimaryVariables &values,
const GlobalPosition &globalPos) const
{
values = 0;
}
// \}
/*!
* \name Boundary conditions
*/
// \{
//! \copydoc Dumux::ImplicitProblem::boundaryTypesAtPos()
void boundaryTypesAtPos(BoundaryTypes &values,
const GlobalPosition &globalPos) const
{
values.setAllDirichlet();
}
//! \copydoc Dumux::ImplicitProblem::dirichletAtPos()