Added documentation and support for more raviart thomas elements...

Added documentation and support for more raviart thomas elements (unfortunately the basis functions of dune-localfunctions fail at construction when using 3d RT0).
Signed-off-by: Santiago Ospina De Los Ríos's avatarSantiago Ospina <santiago.ospina@iup.uni-heidelberg.de>
parent 23bf3163
......@@ -8,13 +8,13 @@
@defgroup Common Common
@{
@todo document models
@todo document common
@}
@defgroup FluxReconstruction Flux reconstruction
@{
@ingroup Common
@todo document the flux reconstruction
@todo document flux reconstruction
@}
**/
......@@ -9,7 +9,7 @@ namespace Dune{
namespace Dorie{
/*-------------------------------------------------------------------------*//**
* @brief Class for minimal local function space.
* @brief Class for minimal local function spaces.
* @details This is a special local function space for the raviart thomas
* engine. In particular, it is thought to work with one grid
* function space, that is, without composite or vector spaces so
......@@ -18,8 +18,8 @@ namespace Dorie{
* indices since the engine does a local solution and there is no
* need to map to entities. In any case, the reason of this object
* is because the user is expecting a local function space as an
* argument of the local operator (even though no many really know
* how a local function space looks like ¬_¬).
* argument of the local operator (even though not too many really
* know how a local function space looks like ¬_¬).
* @author Santiago Ospina De Los Ríos
* @date 2018
* @copyright MIT License.
......@@ -152,8 +152,11 @@ public:
}
private:
//! Pointer to the grid function space.
std::shared_ptr<const GFS> pgfs;
//! Total size of the local function space.
typename Traits::IndexContainer::size_type n;
//! Pointer to the binded finite element.
typename FESwitch::Store pfe;
};
......
#ifndef DUNE_DORIE_RAVIART_THOMAS_PROJECTION_HH
#define DUNE_DORIE_RAVIART_THOMAS_PROJECTION_HH
#include <dune/pdelab/finiteelementmap/raviartthomasfem.hh>
#include <vector>
#include <dune/dorie/common/flux_reconstruction/raviart_thomas/skeleton_fem.hh>
#include <dune/dorie/common/flux_reconstruction/raviart_thomas/volume_fem.hh>
#include <dune/dorie/common/flux_reconstruction/raviart_thomas/fem.hh>
#include <dune/dorie/common/flux_reconstruction/assembler.hh>
#include <dune/dorie/common/flux_reconstruction/local_engeine.hh>
......@@ -47,7 +46,7 @@ class RaviartThomasFluxReconstruction
enum { dim = GV::dimension };
using FEMU = Dune::PDELab::RaviartThomasLocalFiniteElementMap<GV,DF,RF,order,gt>;
using FEMU = Dune::Dorie::RaviartThomasLocalFiniteElementMap<GV,DF,RF,order,gt>;
using ES = typename GFSW::Traits::EntitySet;
using GFSU = Dune::PDELab::GridFunctionSpace<ES,FEMU>;
using LOP = typename GO::Traits::LocalAssembler::LocalOperator;
......@@ -58,7 +57,7 @@ class RaviartThomasFluxReconstruction
using VolumeFEM = Dune::Dorie::VolumeRaviartThomasLocalFiniteElementMap<DF,RF,order,dim,gt>;
using GFSVVolume = Dune::PDELab::GridFunctionSpace<ES,VolumeFEM>;
using SkeletonFEM = typename Dune::Dorie::SkeletonFEM<DF,RF,dim,order,gt>::type;
using SkeletonFEM = typename Dune::Dorie::SkeletonFiniteElementMap<DF,RF,dim,order,gt>;
using GFSVSkeleton = Dune::PDELab::GridFunctionSpace<ES,SkeletonFEM>;
using LocalRaviartThomasEngine = Dune::Dorie::LocalRaviartThomasAssemblerEngine<LA,GFSVVolume,GFSVSkeleton>;
// using Assember = typename GOP::Assembler;
......
#ifndef DUNE_DORIE_RAVIART_THOMAS_FEM_HH
#define DUNE_DORIE_RAVIART_THOMAS_FEM_HH
#include <dune/pdelab/finiteelementmap/raviartthomasfem.hh>
#include <dune/localfunctions/raviartthomas/raviartthomassimplex.hh>
#include <dune/dorie/common/flux_reconstruction/raviart_thomas/raviart_thomas.hh>
namespace Dune{
namespace Dorie{
template<class GV, class DF, class RF, std::size_t k>
class RaviartThomasSimplexLocalFiniteElementMap
: public Dune::PDELab::SimpleLocalFiniteElementMap<
Dune::Dorie::RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>,
GV::dimension>
{
static constexpr unsigned int dim = GV::dimension;
static constexpr unsigned int size_face = Dune::PB::PkSize<k,dim-1>::value;
static constexpr unsigned int faces = dim+1;
static constexpr unsigned int size_skeleton = faces*size_face;
static constexpr unsigned int size_volume = (dim == 2)
? dim*k*(k+1)/2 // for 2D
: dim*k*(k+1)*(k+2)/6;// for 3D
static constexpr unsigned int size_rt = (dim == 2)
? (k+1)*(k+3) // for 2D
: (k+1)*(k+2)*(k+4)/2;// for 3D
// Just in case
static_assert((size_skeleton + size_volume) == size_rt,
"(size_skeleton + size_volume) != size_rt");
static_assert(dim == 2 || dim == 3,
"Raviart Thomas for simplices are only implemented for dimension 2 and 3!");
using FE = Dune::Dorie::RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>;
using Base = Dune::PDELab::SimpleLocalFiniteElementMap<FE,GV::dimension>;
public:
RaviartThomasSimplexLocalFiniteElementMap(const GV& gv) : Base(_fe) {}
static constexpr bool fixedSize()
{
return true;
}
static constexpr bool hasDOFs(int codim)
{
return (codim == 0);
}
std::size_t size(GeometryType geometry_type) const
{
switch (geometry_type.dim())
{
case dim:
return size_rt;
default:
return 0;
}
}
std::size_t maxLocalSize() const
{
return _fe.size();
}
private:
static const FE _fe;
};
// initialization of the static finite element.
template<class GV, class DF, class RF, std::size_t k>
const Dune::Dorie::RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>
RaviartThomasSimplexLocalFiniteElementMap<GV,DF,RF,k>::_fe
= Dune::Dorie::RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>
(Dune::GeometryTypes::simplex(GV::dimension),k);
template<typename GV, int dim, typename DF, typename RF, std::size_t k, GeometryType::BasicType gt>
struct RaviartThomasLocalFiniteElementMapBaseSelector
{
using type = Dune::PDELab::RaviartThomasLocalFiniteElementMap<GV,DF,RF,k,gt>;
};
template<typename GV, typename DF, typename RF>
struct RaviartThomasLocalFiniteElementMapBaseSelector<GV,3,DF,RF,0,GeometryType::simplex>
{
using type = RaviartThomasSimplexLocalFiniteElementMap<GV,DF,RF,0>;
};
/*-------------------------------------------------------------------------*//**
* @brief Finite element map for raviart thomas elements
* @f$\mathcal{RT}_k\f$.
* @details This class is equivalent to
* Dune::PDELab::RaviartThomasLocalFiniteElementMap with elements
* for simplices in 3D. A big difference with the dune-pdelab map is
* that these extra elements are not oriented, which make them to be
* not conforming in normal direction. In other words, they cannot
* be used for usual finite element approximations. Nevertheless
* they are still useful for flux reconstruction since we prescribe
* the continuity by using the numerical fluxes solved by the dG/FV
* methods
*
* Available elements:
*
*
* @warning This map should not be used to solve finite element problems. For
* that purpose use the
* Dune::PDELab::RaviartThomasLocalFiniteElementMap class directly.
* @author Santiago Ospina De Los Ríos
* @date 2018
* @copyright MIT License.
* @ingroup FluxReconstruction
*
* @tparam GV The Gird view.
* @tparam DF The domain field.
* @tparam RF The range field.
* @tparam k The order.
* @tparam gt The geometry type.
* @tparam d The dimension.
*/
template<class GV, class DF, class RF, int k, Dune::GeometryType::BasicType gt>
class RaviartThomasLocalFiniteElementMap
: public Dune::PDELab::RaviartThomasLocalFiniteElementMap<GV,DF,RF,k,gt>
{
using Base = Dune::PDELab::RaviartThomasLocalFiniteElementMap<GV,DF,RF,k,gt>;
public:
RaviartThomasLocalFiniteElementMap(const GV& gv) : Base(gv) {}
};
template<class GV, class DF, class RF, int k>
class RaviartThomasLocalFiniteElementMap<GV,DF,RF,k,Dune::GeometryType::simplex>
: public Dune::Dorie::RaviartThomasLocalFiniteElementMapBaseSelector<GV,GV::dimension,DF,RF,k,Dune::GeometryType::simplex>::type
{
using Base = typename Dune::Dorie::RaviartThomasLocalFiniteElementMapBaseSelector<GV,GV::dimension,DF,RF,k,Dune::GeometryType::simplex>::type;
public:
RaviartThomasLocalFiniteElementMap(const GV& gv) : Base(gv) {}
};
} // namespace Dorie
} // namespace Dune
#endif // DUNE_DORIE_RAVIART_THOMAS_FEM_HH
#ifndef DUNE_DORIE_RAVIART_THOMAS_FINITE_ELEMENT_HH
#define DUNE_DORIE_RAVIART_THOMAS_FINITE_ELEMENT_HH
#include <dune/localfunctions/utility/localfiniteelement.hh>
#include <dune/localfunctions/raviartthomas/raviartthomassimplex.hh>
namespace Dune{
namespace Dorie{
class DGLocalCoefficients
{
public:
/*-----------------------------------------------------------------------*//**
* @brief Constructs the coeffcients.
* @details All locall keys are associated to codimension 0.
*/
DGLocalCoefficients(unsigned int s)
: _s(s), li(_s)
{
for (unsigned int i = 0; i < size(); ++i)
li[i] = Dune::LocalKey(0,0,i);
}
/*-----------------------------------------------------------------------*//**
* @brief Number of local coefficients
*
* @return The size of the local coefficients
*/
std::size_t size() const
{
return _s;
}
/**
* @brief Local key for a given index.
*
* @param[in] i The index that identifies a shape function (see
* Dune::Dorie::VolumeRaviartThomasLocalBasis).
*
* @return The local key associated to the index i. (see Dune:.LocalKey in
* dune-localfunctions)
*/
const LocalKey& localKey (std::size_t i) const
{
return li[i];
}
private:
//! The vector of local keys.
std::size_t _s;
std::vector<Dune::LocalKey> li;
};
/**
* \brief Raviart-Thomas local finite elements of arbitrary order
* for simplices of arbitrary dimension.
*
* These generic local finite elements are only available for
* simplex geometry types. The extension to cube and prism
* elements could be added.
*
* \ingroup RaviartThomas
*
* \tparam dimDomain dimension of reference elements
* \tparam D domain for basis functions
* \tparam R range for basis functions
* \tparam SF storage field for basis matrix
* \tparam CF compute field for basis matrix
*/
template<unsigned int dim, class D, class R,
class SF=R, class CF=SF>
class RaviartThomasSimplexLocalFiniteElement
: public Dune::GenericLocalFiniteElement<Dune::RaviartThomasBasisFactory<dim, SF, CF>,
Dune::RaviartThomasCoefficientsFactory<dim>,
Dune::RaviartThomasL2InterpolationFactory<dim, SF> >
{
using LocalCoefficients = DGLocalCoefficients;
typedef Dune::GenericLocalFiniteElement<
Dune::RaviartThomasBasisFactory<dim, SF, CF>,
Dune::RaviartThomasCoefficientsFactory<dim>,
Dune::RaviartThomasL2InterpolationFactory<dim, SF> > Base;
public:
using Traits = Dune::LocalFiniteElementTraits<
typename Base::Traits::LocalBasisType,
LocalCoefficients,
typename Base::Traits::LocalInterpolationType>;
/** \todo Please doc me */
RaviartThomasSimplexLocalFiniteElement(const Dune::GeometryType &gt, unsigned int k)
: Base(gt, k), local_coefficients((dim == 2) ? (k+1)*(k+3) : (k+1)*(k+2)*(k+4)/2)
{
// TODO assert dim 2 and 3 and gt ==simplex
}
const typename Traits::LocalCoefficientsType& localCoefficients () const
{
return local_coefficients;
}
private:
LocalCoefficients local_coefficients;
};
} // namespace Dorie
} // namespace Dune
#endif // DUNE_DORIE_RAVIART_THOMAS_FINITE_ELEMENT_HH
......@@ -17,13 +17,13 @@ namespace Dune{
namespace Dorie{
/*-------------------------------------------------------------------------*//**
* @brief Class for local basis of the volume raviart thomas finite
* element.
* @brief Class for local basis of the volume raviart thomas finite element
* @f$\mathcal{RT}_k^{vol}\f$.
* @details This class is used to reconstruct fluxes from local operators
* that solve fluxes in the residual vector. In particular, this
* volume raviart thomas is equivalent to the usual raviart thomas
* element but excluding the degrees of freedom located on the faces
* (codim = 1).
* volume raviart thomas \f$\mathcal{RT}_k^{vol}\f$ is equivalent to the
* usual raviart thomas element but excluding the degrees of freedom
* located on the faces (codim = 1).
*
* @author Santiago Ospina De Los Ríos implemented it in DORiE out of source
* files sent by Marian Piatkowski.
......
......@@ -15,10 +15,10 @@ namespace Dorie{
/*-------------------------------------------------------------------------*//**
* @brief Class for local coefficients of the volume raviart thomas finite
* element.
* element |f$\mathcal{RT}_v\f$.
* @details This class is used to reconstruct fluxes from local operators
* that solve fluxes in the residual vector. In particular, since
* the volume part is always associated to the codimension 0, all
* that solve fluxes in the residual vector. In particular, since
* the volume part is always associated to the codimension 0, all
* the local keys are the same.
*
* @author Santiago Ospina De Los Ríos
......
......@@ -10,7 +10,7 @@ namespace Dorie{
/*-------------------------------------------------------------------------*//**
* @brief Class for local interpolation of the volume raviart thomas finite
* element.
* element @f$\mathcal{RT}_k^{vol}\f$.
* @details This class is used to reconstruct fluxes from local operators
* that solve fluxes in the residual vector. In particular, the
* content of the class is never needed for the reconstruction, and
......
#ifndef DUNE_DORIE_FLUX_RECONSTRUCTION_VOLUME_FEM_HH
#define DUNE_DORIE_FLUX_RECONSTRUCTION_VOLUME_FEM_HH
#ifndef DUNE_DORIE_RAVIART_THOMAS_VOLUME_FEM_HH
#define DUNE_DORIE_RAVIART_THOMAS_VOLUME_FEM_HH
#include <dune/geometry/type.hh>
......@@ -9,12 +9,23 @@ namespace Dune{
namespace Dorie{
/*-------------------------------------------------------------------------*//**
* @brief Finite element map for volume part of the raviart thomas.
* @brief Finite element map for volume part of the raviart thomas
* @f$\mathcal{RT}_k^{vol}\f$.
* @details This class basically provides a volume raviart thomas finite
* element for any entity following the finite element map defined
* by dune-pdelab (see
* element
* @f$\mathcal{RT}_k^{vol}\f$ for any entity following the finite
* element map defined by dune-pdelab (see
* Dune::PDELab::LocalFiniteElementMapInterface).
*
* Available elements: <table> <tr> <th colspan="2">Order</th>
* <th>0</th> <th>1</th> <th>2</th> <th>3</th> </tr> <tr> <td
* rowspan="2"><br>2D</td> <td>Simplex</td> <td>✓</td> <td>✓</td>
* <td>✓</td> <td>✗</td> </tr> <tr> <td>Cube</td> <td>✓</td>
* <td>✓</td> <td>✓</td> <td>✗</td> </tr> <tr> <td
* rowspan="2"><br>3D</td> <td>Simplex</td> <td>✓</td> <td>✓</td>
* <td>✓</td> <td>✗</td> </tr> <tr> <td>Cube</td> <td>✓</td>
* <td>✓</td> <td>✓</td> <td>✗</td> </tr> </table>
*
* @author Santiago Ospina De Los Ríos
* @date 2018
* @copyright MIT License.
......@@ -116,4 +127,4 @@ private:
} // namespace Dorie
} // namespace Dune
#endif // DUNE_DORIE_FLUX_RECONSTRUCTION_VOLUME_FEM_HH
\ No newline at end of file
#endif // DUNE_DORIE_RAVIART_THOMAS_VOLUME_FEM_HH
\ No newline at end of file
#ifndef DUNE_DORIE_VOLUME_RAVIART_THOMAS_HH
#define DUNE_DORIE_VOLUME_RAVIART_THOMAS_HH
#ifndef DUNE_DORIE_RAVIART_THOMAS_VOLUME_HH
#define DUNE_DORIE_RAVIART_THOMAS_VOLUME_HH
#include <dune/geometry/type.hh>
......@@ -11,13 +11,25 @@ namespace Dune{
namespace Dorie{
/*-------------------------------------------------------------------------*//**
* @brief Class for volume part of the raviart thomas finite element.
* @brief Class for volume part of the raviart thomas finite element
* @f$\mathcal{RT}_k^{vol}\f$.
* @details This class is used to reconstruct fluxes from local operators
* that solve fluxes in the residual vector. In particular, this
* volume raviart thomas is equivalent to the usual raviart thomas
* element but excluding the degrees of freedom located on the faces
* (i.e. codim = 1).
*
* Available elements:
*
* <table> <tr> <th colspan="2">Order</th> <th>0</th> <th>1</th>
* <th>2</th> <th>3</th> </tr> <tr> <td rowspan="2"><br>2D</td>
* <td>Simplex</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✗</td>
* </tr> <tr> <td>Cube</td> <td>✓</td> <td>✓</td> <td>✓</td>
* <td>✗</td> </tr> <tr> <td rowspan="2"><br>3D</td>
* <td>Simplex</td> <td>✓</td> <td>✓</td> <td>✓</td> <td>✗</td>
* </tr> <tr> <td>Cube</td> <td>✓</td> <td>✓</td> <td>✓</td>
* <td>✗</td> </tr> </table>
*
* @author Santiago Ospina De Los Ríos
* @date 2018
* @copyright MIT License.
......@@ -37,7 +49,6 @@ class VolumeRaviartThomasLocalFiniteElement
{
public:
//! Traits of local basis. It follows the traits structure for finite
//! elements defined by dune-localfunctions (Dune::LocalFiniteElementTraits).
using Traits = Dune::LocalFiniteElementTraits<
......@@ -116,4 +127,4 @@ private:
} // namespace Dorie
} // namespace Dune
#endif // DUNE_DORIE_VOLUME_RAVIART_THOMAS_HH
#endif // DUNE_DORIE_RAVIART_THOMAS_VOLUME_HH
\ No newline at end of file
......@@ -8,7 +8,7 @@ namespace Dune{
namespace Dorie{
template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::cube>,1>>;
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::simplex>,1>>; *
// template class RichardsSimulation<RichardsSimulationTraits<BaseTraits<UGGrid<3>,Geo::simplex>,1>>; *
} // namespace Dorie
} // namespace Dune
\ No newline at end of file
......@@ -9,7 +9,7 @@ except NameError:
pass
# paths set by cmake
DORIEDIR = "/home/saospina/Codes/DUNE_INSTALL/Release/dorie"
DORIEDIR = "/home/saospina/Codes/DUNE_INSTALL/Debug/dorie"
MPIEXEC = "/usr/bin/mpiexec"
MPIEXEC_NUMPROC_FLAG = "-n"
MPIEXEC_PREFLAG = ""
......
......@@ -17,8 +17,8 @@ add_custom_target(test_run_ref
COMMAND ctest --output-on-failure --tests-regex ^.+_ref_.+$
)
# dorie_add_metaini_test(TARGET dorie METAINI reference_2d.mini.in)
# dorie_add_metaini_test(TARGET dorie METAINI reference_3d.mini.in)
dorie_add_metaini_test(TARGET dorie METAINI reference_2d.mini.in)
dorie_add_metaini_test(TARGET dorie METAINI reference_3d.mini.in)
# dorie_add_metaini_test(TARGET dorie METAINI reference_evaporation.mini.in)
# dorie_add_metaini_test(TARGET dorie METAINI reference_interpolators.mini.in)
......
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