Commit be703624 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

[experimental] move code and tests to dedicated folder

parent efbcc68e
......@@ -14,7 +14,6 @@ add_subdirectory(nonlinear)
add_subdirectory(parallel)
add_subdirectory(porenetwork)
add_subdirectory(porousmediumflow)
add_subdirectory(timestepping)
# if Python bindings are enabled, include necessary sub directories.
if(DUMUX_ENABLE_PYTHONBINDINGS)
......
......@@ -169,208 +169,4 @@ private:
} // end namespace Dumux
//////////////////////////////////////////////////////////////
// Experimental implementation of new grid variables layout //
//////////////////////////////////////////////////////////////
#include <dumux/common/typetraits/problem.hh>
#include <dumux/discretization/localview.hh>
#include <dumux/discretization/gridvariables.hh>
namespace Dumux::Experimental {
/*!
* \ingroup Discretization
* \brief Finite volume-specific local view on grid variables.
* \tparam GV The grid variables class
*/
template<class GV>
class FVGridVariablesLocalView
{
using GridGeometry = typename GV::GridGeometry;
using FVElementGeometry = typename GridGeometry::LocalView;
using GridView = typename GridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
using ElementVolumeVariables = typename GV::GridVolumeVariables::LocalView;
using ElementFluxVariablesCache = typename GV::GridFluxVariablesCache::LocalView;
public:
//! export corresponding grid-wide class
using GridVariables = GV;
//! Constructor
FVGridVariablesLocalView(const GridVariables& gridVariables)
: gridVariables_(&gridVariables)
, elemVolVars_(gridVariables.gridVolVars())
, elemFluxVarsCache_(gridVariables.gridFluxVarsCache())
{}
/*!
* \brief Bind this local view to a grid element.
* \param element The grid element
* \param fvGeometry Local view on the grid geometry
*/
void bind(const Element& element,
const FVElementGeometry& fvGeometry)
{
const auto& x = gridVariables().dofs();
elemVolVars_.bind(element, fvGeometry, x);
elemFluxVarsCache_.bind(element, fvGeometry, elemVolVars_);
}
/*!
* \brief Bind only the volume variables local view to a grid element.
* \param element The grid element
* \param fvGeometry Local view on the grid geometry
*/
void bindElemVolVars(const Element& element,
const FVElementGeometry& fvGeometry)
{
elemVolVars_.bind(element, fvGeometry, gridVariables().dofs());
// unbind flux variables cache
elemFluxVarsCache_ = localView(gridVariables().gridFluxVarsCache());
}
//! return reference to the elem vol vars
const ElementVolumeVariables& elemVolVars() const { return elemVolVars_; }
ElementVolumeVariables& elemVolVars() { return elemVolVars_; }
//! return reference to the flux variables cache
const ElementFluxVariablesCache& elemFluxVarsCache() const { return elemFluxVarsCache_; }
ElementFluxVariablesCache& elemFluxVarsCache() { return elemFluxVarsCache_; }
//! Return reference to the grid variables
const GridVariables& gridVariables() const
{ return *gridVariables_; }
private:
const GridVariables* gridVariables_;
ElementVolumeVariables elemVolVars_;
ElementFluxVariablesCache elemFluxVarsCache_;
};
/*!
* \ingroup Discretization
* \brief The grid variable class for finite volume schemes, storing
* variables on scv and scvf (volume and flux variables).
* \tparam GVV the type of the grid volume variables
* \tparam GFVC the type of the grid flux variables cache
* \tparam X the type used for solution vectors
*/
template<class GVV, class GFVC, class X>
class FVGridVariables
: public GridVariables<typename ProblemTraits<typename GVV::Problem>::GridGeometry, X>
{
using Problem = typename GVV::Problem;
using GG = typename ProblemTraits<Problem>::GridGeometry;
using ParentType = GridVariables<GG, X>;
using ThisType = FVGridVariables<GVV, GFVC, X>;
public:
using typename ParentType::SolutionVector;
//! export type of the finite volume grid geometry
using GridGeometry = GG;
//! export type of the grid volume variables
using GridVolumeVariables = GVV;
//! export type of the volume variables
using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
//! export primary variable type
using PrimaryVariables = typename VolumeVariables::PrimaryVariables;
//! export cache type for flux variables
using GridFluxVariablesCache = GFVC;
//! export the local view on this class
using LocalView = FVGridVariablesLocalView<ThisType>;
/*!
* \brief Constructor
* \param problem The problem to be solved
* \param gridGeometry The geometry of the computational grid
* \note This constructor initializes the solution using the
* initializer function in the given problem, and thus,
* this only compiles if the problem implements it.
*/
FVGridVariables(std::shared_ptr<Problem> problem,
std::shared_ptr<const GridGeometry> gridGeometry)
: ParentType(gridGeometry, [problem] (auto& x) { problem->applyInitialSolution(x); })
, gridVolVars_(*problem)
, gridFluxVarsCache_(*problem)
{}
/*!
* \brief Constructor with custom initialization of the solution.
* \param problem The problem to be solved
* \param gridGeometry The geometry of the computational grid
* \param solOrInitializer This can be either a reference to a solution
* vector, or an initializer lambda.
* See Dumux::Experimental::Variables.
*/
template<class SolOrInitializer>
FVGridVariables(std::shared_ptr<Problem> problem,
std::shared_ptr<const GridGeometry> gridGeometry,
SolOrInitializer&& solOrInitializer)
: ParentType(gridGeometry, std::forward<SolOrInitializer>(solOrInitializer))
, gridVolVars_(*problem)
, gridFluxVarsCache_(*problem)
{
gridVolVars_.update(this->gridGeometry(), this->dofs());
gridFluxVarsCache_.update(this->gridGeometry(), gridVolVars_, this->dofs(), true);
}
//! Update all variables that may be affected by a change in solution
void update(const SolutionVector& curSol)
{
ParentType::update(curSol);
// resize and update the volVars with the initial solution
gridVolVars_.update(this->gridGeometry(), curSol);
// update the flux variables caches
gridFluxVarsCache_.update(this->gridGeometry(), gridVolVars_, curSol);
}
//! Force the update of all variables
void forceUpdateAll(const SolutionVector& curSol)
{
ParentType::update(curSol);
// resize and update the volVars with the initial solution
gridVolVars_.update(this->gridGeometry(), curSol);
// update the flux variables caches
gridFluxVarsCache_.update(this->gridGeometry(), gridVolVars_, curSol, true);
}
//! return the flux variables cache
const GridFluxVariablesCache& gridFluxVarsCache() const
{ return gridFluxVarsCache_; }
//! return the flux variables cache
GridFluxVariablesCache& gridFluxVarsCache()
{ return gridFluxVarsCache_; }
//! return the current volume variables
const GridVolumeVariables& gridVolVars() const
{ return gridVolVars_; }
//! return the current volume variables
GridVolumeVariables& gridVolVars()
{ return gridVolVars_; }
private:
GridVolumeVariables gridVolVars_; //!< the current volume variables (primary and secondary variables)
GridFluxVariablesCache gridFluxVarsCache_; //!< the flux variables cache
};
} // end namespace Dumux::Experimental
#endif
add_subdirectory(common)
add_subdirectory(discretization)
add_subdirectory(timestepping)
file(GLOB DUMUX_COMMON_HEADERS *.hh *.inc)
install(FILES ${DUMUX_COMMON_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/experimental/common)
......@@ -27,7 +27,7 @@
#include <type_traits>
#include <dune/common/typetraits.hh>
#include <dumux/timestepping/timelevel.hh>
#include <dumux/experimental/timestepping/timelevel.hh>
namespace Dumux::Experimental {
......
file(GLOB DUMUX_DISCRETIZATION_HEADERS *.hh *.inc)
install(FILES ${DUMUX_DISCRETIZATION_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/experimental/discretization)
// -*- 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 Discretization
* \brief The grid variable class for finite volume schemes,
* storing variables on scv and scvf (volume and flux variables)
*/
#ifndef DUMUX_EXPERIMENTAL_FV_GRID_VARIABLES_HH
#define DUMUX_EXPERIMENTAL_FV_GRID_VARIABLES_HH
#include <utility>
#include <memory>
#include <dumux/common/typetraits/problem.hh>
#include <dumux/discretization/localview.hh>
#include <dumux/experimental/discretization/gridvariables.hh>
namespace Dumux::Experimental {
/*!
* \ingroup Discretization
* \brief Finite volume-specific local view on grid variables.
* \tparam GV The grid variables class
*/
template<class GV>
class FVGridVariablesLocalView
{
using GridGeometry = typename GV::GridGeometry;
using FVElementGeometry = typename GridGeometry::LocalView;
using GridView = typename GridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
using ElementVolumeVariables = typename GV::GridVolumeVariables::LocalView;
using ElementFluxVariablesCache = typename GV::GridFluxVariablesCache::LocalView;
public:
//! export corresponding grid-wide class
using GridVariables = GV;
//! Constructor
FVGridVariablesLocalView(const GridVariables& gridVariables)
: gridVariables_(&gridVariables)
, elemVolVars_(gridVariables.gridVolVars())
, elemFluxVarsCache_(gridVariables.gridFluxVarsCache())
{}
/*!
* \brief Bind this local view to a grid element.
* \param element The grid element
* \param fvGeometry Local view on the grid geometry
*/
void bind(const Element& element,
const FVElementGeometry& fvGeometry)
{
const auto& x = gridVariables().dofs();
elemVolVars_.bind(element, fvGeometry, x);
elemFluxVarsCache_.bind(element, fvGeometry, elemVolVars_);
}
/*!
* \brief Bind only the volume variables local view to a grid element.
* \param element The grid element
* \param fvGeometry Local view on the grid geometry
*/
void bindElemVolVars(const Element& element,
const FVElementGeometry& fvGeometry)
{
elemVolVars_.bind(element, fvGeometry, gridVariables().dofs());
// unbind flux variables cache
elemFluxVarsCache_ = localView(gridVariables().gridFluxVarsCache());
}
//! return reference to the elem vol vars
const ElementVolumeVariables& elemVolVars() const { return elemVolVars_; }
ElementVolumeVariables& elemVolVars() { return elemVolVars_; }
//! return reference to the flux variables cache
const ElementFluxVariablesCache& elemFluxVarsCache() const { return elemFluxVarsCache_; }
ElementFluxVariablesCache& elemFluxVarsCache() { return elemFluxVarsCache_; }
//! Return reference to the grid variables
const GridVariables& gridVariables() const
{ return *gridVariables_; }
private:
const GridVariables* gridVariables_;
ElementVolumeVariables elemVolVars_;
ElementFluxVariablesCache elemFluxVarsCache_;
};
/*!
* \ingroup Discretization
* \brief The grid variable class for finite volume schemes, storing
* variables on scv and scvf (volume and flux variables).
* \tparam GVV the type of the grid volume variables
* \tparam GFVC the type of the grid flux variables cache
* \tparam X the type used for solution vectors
*/
template<class GVV, class GFVC, class X>
class FVGridVariables
: public GridVariables<typename ProblemTraits<typename GVV::Problem>::GridGeometry, X>
{
using Problem = typename GVV::Problem;
using GG = typename ProblemTraits<Problem>::GridGeometry;
using ParentType = GridVariables<GG, X>;
using ThisType = FVGridVariables<GVV, GFVC, X>;
public:
using typename ParentType::SolutionVector;
//! export type of the finite volume grid geometry
using GridGeometry = GG;
//! export type of the grid volume variables
using GridVolumeVariables = GVV;
//! export type of the volume variables
using VolumeVariables = typename GridVolumeVariables::VolumeVariables;
//! export primary variable type
using PrimaryVariables = typename VolumeVariables::PrimaryVariables;
//! export cache type for flux variables
using GridFluxVariablesCache = GFVC;
//! export the local view on this class
using LocalView = FVGridVariablesLocalView<ThisType>;
/*!
* \brief Constructor
* \param problem The problem to be solved
* \param gridGeometry The geometry of the computational grid
* \note This constructor initializes the solution using the
* initializer function in the given problem, and thus,
* this only compiles if the problem implements it.
*/
FVGridVariables(std::shared_ptr<Problem> problem,
std::shared_ptr<const GridGeometry> gridGeometry)
: ParentType(gridGeometry, [problem] (auto& x) { problem->applyInitialSolution(x); })
, gridVolVars_(*problem)
, gridFluxVarsCache_(*problem)
{}
/*!
* \brief Constructor with custom initialization of the solution.
* \param problem The problem to be solved
* \param gridGeometry The geometry of the computational grid
* \param solOrInitializer This can be either a reference to a solution
* vector, or an initializer lambda.
* See Dumux::Experimental::Variables.
*/
template<class SolOrInitializer>
FVGridVariables(std::shared_ptr<Problem> problem,
std::shared_ptr<const GridGeometry> gridGeometry,
SolOrInitializer&& solOrInitializer)
: ParentType(gridGeometry, std::forward<SolOrInitializer>(solOrInitializer))
, gridVolVars_(*problem)
, gridFluxVarsCache_(*problem)
{
gridVolVars_.update(this->gridGeometry(), this->dofs());
gridFluxVarsCache_.update(this->gridGeometry(), gridVolVars_, this->dofs(), true);
}
//! Update all variables that may be affected by a change in solution
void update(const SolutionVector& curSol)
{
ParentType::update(curSol);
// resize and update the volVars with the initial solution
gridVolVars_.update(this->gridGeometry(), curSol);
// update the flux variables caches
gridFluxVarsCache_.update(this->gridGeometry(), gridVolVars_, curSol);
}
//! Force the update of all variables
void forceUpdateAll(const SolutionVector& curSol)
{
ParentType::update(curSol);
// resize and update the volVars with the initial solution
gridVolVars_.update(this->gridGeometry(), curSol);
// update the flux variables caches
gridFluxVarsCache_.update(this->gridGeometry(), gridVolVars_, curSol, true);
}
//! return the flux variables cache
const GridFluxVariablesCache& gridFluxVarsCache() const
{ return gridFluxVarsCache_; }
//! return the flux variables cache
GridFluxVariablesCache& gridFluxVarsCache()
{ return gridFluxVarsCache_; }
//! return the current volume variables
const GridVolumeVariables& gridVolVars() const
{ return gridVolVars_; }
//! return the current volume variables
GridVolumeVariables& gridVolVars()
{ return gridVolVars_; }
private:
GridVolumeVariables gridVolVars_; //!< the current volume variables (primary and secondary variables)
GridFluxVariablesCache gridFluxVarsCache_; //!< the flux variables cache
};
} // end namespace Dumux::Experimental
#endif
......@@ -27,7 +27,7 @@
#include <utility>
#include <memory>
#include <dumux/common/variables.hh>
#include <dumux/experimental/common/variables.hh>
namespace Dumux::Experimental {
......
file(GLOB DUMUX_TIMESTEPPING_HEADERS *.hh *.inc)
install(FILES ${DUMUX_TIMESTEPPING_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/timestepping)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/experimental/timestepping)
add_subdirectory(common)
add_subdirectory(geomechanics)
add_subdirectory(geometry)
add_subdirectory(experimental)
add_subdirectory(flux)
add_subdirectory(freeflow)
add_subdirectory(io)
......@@ -12,7 +13,6 @@ add_subdirectory(parallel)
add_subdirectory(porenetwork)
add_subdirectory(porousmediumflow)
add_subdirectory(discretization)
add_subdirectory(timestepping)
# if Python bindings are enabled, include Python binding tests
......
......@@ -6,12 +6,6 @@ add_subdirectory(projection)
add_subdirectory(rotationsymmetry)
add_input_file_links()
dumux_add_test(NAME test_disc_fvgridvariables
LABELS unit experimental
SOURCES test_fvgridvariables.cc
COMMAND ./test_disc_fvgridvariables
CMD_ARGS -Problem.Name gridvarstest)
add_executable(test_walldistance EXCLUDE_FROM_ALL test_walldistance.cc)
dumux_add_test(NAME test_walldistance_2dcube
......
add_subdirectory(discretization)
add_subdirectory(timestepping)
dumux_add_test(NAME test_disc_fvgridvariables
LABELS unit experimental
SOURCES test_fvgridvariables.cc
COMMAND ./test_disc_fvgridvariables
CMD_ARGS -Problem.Name gridvarstest)
......@@ -36,7 +36,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/discretization/box.hh>
#include <dumux/discretization/fvgridvariables.hh>
#include <dumux/experimental/discretization/fvgridvariables.hh>
#include <dumux/porousmediumflow/1p/model.hh>
#include <dumux/porousmediumflow/fvspatialparams1pconstant.hh>
......
dumux_add_test(SOURCES test_timestepmethods.cc LABELS unit timestepping)
dumux_add_test(SOURCES test_timestepmethods.cc LABELS unit timestepping experimental)
......@@ -13,12 +13,12 @@
#include <dumux/io/format.hh>
#include <dumux/common/initialize.hh>
#include <dumux/common/variables.hh>
#include <dumux/experimental/common/variables.hh>
#include <dumux/nonlinear/newtonsolver.hh>
#include <dumux/timestepping/timelevel.hh>
#include <dumux/timestepping/multistagemethods.hh>
#include <dumux/timestepping/multistagetimestepper.hh>
#include <dumux/experimental/timestepping/timelevel.hh>
#include <dumux/experimental/timestepping/multistagemethods.hh>
#include <dumux/experimental/timestepping/multistagetimestepper.hh>
/*
This tests the time integration methods by solving the
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_COMPRESSIBLE_ONEP_TEST_GRID_VARIABLES_HH
#define DUMUX_COMPRESSIBLE_ONEP_TEST_GRID_VARIABLES_HH
#include <dumux/discretization/gridvariables.hh>
#include <dumux/experimental/discretization/gridvariables.hh>
namespace Dumux::OnePCompressibleTest {
......
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