[Transport] Set grid functions in local operator

parent 99a6d07a
......@@ -26,50 +26,48 @@ namespace Operator {
* \partial_t[\theta C_w] +
* \nabla\cdot [\textbf{j}_w C_w] -
* \nabla [\theta \mathsf{D}_{eff}\nabla C_w]=0 &\qquad \text{in }
* \Omega\\
* \Omega\\
* C_w = g &\qquad \text{on } \Gamma_D
* \subseteq\partial\Omega\\
* \nabla C_w \cdot \textbf{n} = \textbf{j}_{\scriptscriptstyle
* C_w}& \qquad \text{on } \Gamma_N =\partial\Omega \backslash
* \Gamma_D
* \Gamma_D}{
* @f}
* @author Santiago Ospina De Los Ríos
* @date 2018
* @ingroup LocalOperators
* @ingroup TransportModel
*
* @todo Use diffusion coefficient grid function.
* @todo Implement outflow boundary condition.
*
*
* @tparam Boundary Type of the class providing boundary
* conditions
* @tparam GridFunctionWaterFlux Type of a grid function which provides
* the water flux
* @tparam GridFunctionWaterContent Type of a grid function which provides
* the water content
* @todo Use diffusion coefficient grid function.
* @todo Implement outflow boundary condition.
*
* @tparam Boundary Type of the class providing boundary conditions
* @tparam GFWaterFlux Type of a grid function which provides the water
* flux
* @tparam GFWaterContent Type of a grid function which provides the water
* content
*/
template<class Boundary, class GridFunctionWaterFlux, class GridFunctionWaterContent>
template<class Boundary, class GFWaterFlux, class GFWaterContent>
class TransportFVSpatialOperator
: public Dune::PDELab::NumericalJacobianVolume<
TransportFVSpatialOperator<
Boundary,
GridFunctionWaterFlux,
GridFunctionWaterContent
GFWaterFlux,
GFWaterContent
>
>
, public Dune::PDELab::NumericalJacobianSkeleton<
TransportFVSpatialOperator<
Boundary,
GridFunctionWaterFlux,
GridFunctionWaterContent
GFWaterFlux,
GFWaterContent
>
>
, public Dune::PDELab::NumericalJacobianBoundary<
TransportFVSpatialOperator<
Boundary,
GridFunctionWaterFlux,
GridFunctionWaterContent
GFWaterFlux,
GFWaterContent
>
>
, public Dune::PDELab::FullSkeletonPattern
......@@ -90,13 +88,13 @@ public:
// enum { doLambdaBoundary = true };
private:
static_assert(std::is_same<
typename GridFunctionWaterFlux::Traits::GridViewType,
typename GridFunctionWaterContent::Traits::GridViewType>::value,
"TransportFVSpatialOperator: GridFunctionWaterFlux and"
"GridFunctionWaterContent has to use the same grid view.");
typename GFWaterFlux::Traits::GridViewType,
typename GFWaterContent::Traits::GridViewType>::value,
"TransportFVSpatialOperator: GFWaterFlux and"
"GFWaterContent has to use the same grid view.");
using WaterFlux =typename GridFunctionWaterFlux::Traits::RangeType;
using WaterContent =typename GridFunctionWaterContent::Traits::RangeType;
using WaterFlux =typename GFWaterFlux::Traits::RangeType;
using WaterContent =typename GFWaterContent::Traits::RangeType;
public:
......@@ -109,9 +107,9 @@ public:
* @param[in] diff_coeff The diffusion coefficient
*/
TransportFVSpatialOperator(
std::shared_ptr<const Boundary> boundary,
std::shared_ptr<GridFunctionWaterFlux> gf_water_flux,
std::shared_ptr<GridFunctionWaterContent> gf_water_content,
std::shared_ptr<Boundary> boundary,
std::shared_ptr<GFWaterFlux> gf_water_flux,
std::shared_ptr<GFWaterContent> gf_water_content,
double diff_coeff
) : _boundary(boundary)
, _gf_water_flux(gf_water_flux)
......@@ -348,7 +346,7 @@ public:
auto face_position_i = geo_in_i.center();
// Evaluate water content
typename GridFunctionWaterContent::Traits::RangeType water_content_i;
typename GFWaterContent::Traits::RangeType water_content_i;
_gf_water_content->evaluate(entity_i, face_position_i, water_content_i);
// Face volume for integration
......@@ -414,10 +412,30 @@ public:
_gf_water_flux->setTime(t);
}
/*---------------------------------------------------------------------*//**
* @brief Sets the the water content grid function.
*
* @param[in] gf_water_content The water content grid function
*/
void set_water_content(std::shared_ptr<GFWaterContent> gf_water_content)
{
_gf_water_content = gf_water_content;
}
/*---------------------------------------------------------------------*//**
* @brief Sets the the water flux grid function.
*
* @param[in] gf_water_content The water flux grid function
*/
void set_water_flux(std::shared_ptr<GFWaterFlux> gf_water_flux)
{
_gf_water_flux = gf_water_flux;
}
private:
const std::shared_ptr<const Boundary> _boundary;
const std::shared_ptr<GridFunctionWaterFlux> _gf_water_flux;
const std::shared_ptr<GridFunctionWaterContent> _gf_water_content;
std::shared_ptr<GFWaterFlux> _gf_water_flux;
std::shared_ptr<GFWaterContent> _gf_water_content;
double _time;
double _diff_coeff;
};
......@@ -430,30 +448,30 @@ private:
* \partial_t[\theta C_w] +
* \nabla\cdot [\textbf{j}_w C_w] -
* \nabla [\theta \mathsf{D}_{eff}\nabla C_w]=0 &\qquad \text{in }
* \Omega\\
* \Omega\\
* C_w = g &\qquad \text{on } \Gamma_D
* \subseteq\partial\Omega\\
* \nabla C_w \cdot \textbf{n} = \textbf{j}_{\scriptscriptstyle
* C_w}& \qquad \text{on } \Gamma_N =\partial\Omega \backslash
* \Gamma_D
* \Gamma_D}{
* @f}
* @author Santiago Ospina De Los Ríos
* @date 2018
* @ingroup LocalOperators
* @ingroup TransportModel
*
* @bug The water content is not being updated by the set time to the
*
* @bug The water content is not being updated by the set time to the
* right state of the grid function.
*
* @tparam GridFunctionWaterContent Type of a grid function which provides
* the water content
* @tparam GFWaterContent Type of a grid function which provides the water
* content
*/
template<class GridFunctionWaterContent>
template<class GFWaterContent>
class TransportFVTemporalOperator
: public Dune::PDELab::NumericalJacobianVolume<
TransportFVTemporalOperator<GridFunctionWaterContent>>
TransportFVTemporalOperator<GFWaterContent>>
, public Dune::PDELab::NumericalJacobianApplyVolume<
TransportFVTemporalOperator<GridFunctionWaterContent>>
TransportFVTemporalOperator<GFWaterContent>>
, public Dune::PDELab::FullSkeletonPattern
, public Dune::PDELab::FullVolumePattern
, public Dune::PDELab::LocalOperatorDefaultFlags
......@@ -470,7 +488,7 @@ public:
public:
TransportFVTemporalOperator(
std::shared_ptr<GridFunctionWaterContent> gf_water_content
std::shared_ptr<GFWaterContent> gf_water_content
) : _gf_water_content(gf_water_content)
, _time(0.)
{}
......@@ -509,7 +527,7 @@ public:
const auto& ref_el = referenceElement(geo);
const auto& center_position = ref_el.position(0,0);
typename GridFunctionWaterContent::Traits::RangeType water_content;
typename GFWaterContent::Traits::RangeType water_content;
_gf_water_content->evaluate(eg.entity(),center_position,water_content);
......@@ -531,8 +549,18 @@ public:
_gf_water_content->setTime(t);
}
/*---------------------------------------------------------------------*//**
* @brief Sets the the water content grid function.
*
* @param[in] gf_water_content The water content grid function
*/
void set_water_content(std::shared_ptr<GFWaterContent> gf_water_content)
{
_gf_water_content = gf_water_content;
}
private:
std::shared_ptr<GridFunctionWaterContent> _gf_water_content;
std::shared_ptr<GFWaterContent> _gf_water_content;
double _time;
};
......
......@@ -414,7 +414,7 @@ public:
DUNE_THROW(Dune::InvalidStateException,
"Pointer to water_flux_gf is invalid!");
do_operator_setup = true;
slop->set_water_flux(_water_flux_gf);
}
/*-----------------------------------------------------------------------*//**
......@@ -430,7 +430,8 @@ public:
DUNE_THROW(Dune::InvalidStateException,
"Pointer to water_content_gf is invalid!");
do_operator_setup = true;
slop->set_water_content(_water_content_gf);
tlop->set_water_content(_water_content_gf);
}
/*------------------------------------------------------------------------*//**
......
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