Commit 2bf8045c authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos

Merge branch '160-transport-fv-local-operator-assertions-fail' into 'master'

Resolve "Transport FV local operator assertions fail"

Closes #160

See merge request !164
parents ac9e6b07 0a23834c
...@@ -124,8 +124,8 @@ public: ...@@ -124,8 +124,8 @@ public:
, _boundary(boundary) , _boundary(boundary)
, _dirichlet_mode(dirichlet_mode) , _dirichlet_mode(dirichlet_mode)
{ {
assert(_gf_water_flux); assert(_param);
assert(_gf_water_content); assert(_boundary);
} }
/*---------------------------------------------------------------------*//** /*---------------------------------------------------------------------*//**
...@@ -155,6 +155,8 @@ public: ...@@ -155,6 +155,8 @@ public:
const LFSU& lfsu_o, const X& x_o, const LFSV& lfsv_o, const LFSU& lfsu_o, const X& x_o, const LFSV& lfsv_o,
R& r_i, R& r_o) const R& r_i, R& r_o) const
{ {
assert_pointers();
// Get entity dim // Get entity dim
const int dim = IG::Entity::dimension; const int dim = IG::Entity::dimension;
...@@ -280,6 +282,8 @@ public: ...@@ -280,6 +282,8 @@ public:
void alpha_boundary (const IG& ig, const LFSU& lfsu_i, const X& x_i, void alpha_boundary (const IG& ig, const LFSU& lfsu_i, const X& x_i,
const LFSV& lfsv_i, R& r_i) const const LFSV& lfsv_i, R& r_i) const
{ {
assert_pointers();
// Get entity dim // Get entity dim
const int dim = IG::Entity::dimension; const int dim = IG::Entity::dimension;
...@@ -388,13 +392,16 @@ public: ...@@ -388,13 +392,16 @@ public:
// Calculate diffusion coefficient from inside // Calculate diffusion coefficient from inside
GradientU diff_coeff_i; GradientU diff_coeff_i;
hydr_disp_i.mv(normal_f,diff_coeff_i); hydr_disp_i.mv(normal_f,diff_coeff_i);
diff_coeff_i *= water_content_i;
// Use inside diffusion as face diffusion
const auto diff_coeff_f = diff_coeff_i*normal_f;
// Inside unknown value // Inside unknown value
RangeU u = x_i(lfsu_i,0); RangeU u = x_i(lfsu_i,0);
// Solute flux in normal direction w.r.t the intersection // Solute flux in normal direction w.r.t the intersection
auto soulte_flux_n = (g*water_flux_n) auto soulte_flux_n = (g*water_flux_n)-(diff_coeff_f*(g-u)/distance);
-(diff_coeff_i*water_content_i*(g-u)/distance);
// Contribution to residual from Dirichlet boundary // Contribution to residual from Dirichlet boundary
r_i.accumulate(lfsv_i, 0, soulte_flux_n*volume_f); r_i.accumulate(lfsv_i, 0, soulte_flux_n*volume_f);
...@@ -436,6 +443,7 @@ public: ...@@ -436,6 +443,7 @@ public:
*/ */
void set_water_content(std::shared_ptr<GFWaterContent> gf_water_content) void set_water_content(std::shared_ptr<GFWaterContent> gf_water_content)
{ {
assert(gf_water_content);
_gf_water_content = gf_water_content; _gf_water_content = gf_water_content;
} }
...@@ -446,11 +454,24 @@ public: ...@@ -446,11 +454,24 @@ public:
*/ */
void set_water_flux(std::shared_ptr<GFWaterFlux> gf_water_flux) void set_water_flux(std::shared_ptr<GFWaterFlux> gf_water_flux)
{ {
assert(gf_water_flux);
_gf_water_flux = gf_water_flux; _gf_water_flux = gf_water_flux;
} }
private: private:
/// Assert that all shared pointers are assigned
/** \warning This uses the C `assert` macro and does nothing if compiled with
* the `NDEBUG` definition (Release build).
*/
void assert_pointers () const
{
assert(_param);
assert(_boundary);
assert(_gf_water_flux);
assert(_gf_water_content);
}
const std::shared_ptr<const Parameter> _param; const std::shared_ptr<const Parameter> _param;
const std::shared_ptr<const Boundary> _boundary; const std::shared_ptr<const Boundary> _boundary;
std::shared_ptr<GFWaterFlux> _gf_water_flux; std::shared_ptr<GFWaterFlux> _gf_water_flux;
...@@ -528,6 +549,8 @@ public: ...@@ -528,6 +549,8 @@ public:
void alpha_volume (const EG& eg, const LFSU& lfsu, const X& x, void alpha_volume (const EG& eg, const LFSU& lfsu, const X& x,
const LFSV& lfsv, R& r) const const LFSV& lfsv, R& r) const
{ {
assert(_gf_water_content);
// Get local basis traits from local function space // Get local basis traits from local function space
using LocalBasisTraitsU = typename LFSU::Traits::FiniteElementType:: using LocalBasisTraitsU = typename LFSU::Traits::FiniteElementType::
Traits::LocalBasisType::Traits; Traits::LocalBasisType::Traits;
...@@ -572,6 +595,7 @@ public: ...@@ -572,6 +595,7 @@ public:
*/ */
void set_water_content(std::shared_ptr<GFWaterContent> gf_water_content) void set_water_content(std::shared_ptr<GFWaterContent> gf_water_content)
{ {
assert(gf_water_content);
_gf_water_content = gf_water_content; _gf_water_content = gf_water_content;
} }
......
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