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

[mpfa] introduce assertion for Tensor > 0

We have to make sure that the provided diffusion coefficients are
greater than zero. Zero coefficients will end up degenerating the
local systems.
parent cb76d550
......@@ -315,11 +315,16 @@ private:
return (tmp*normal)/detX;
}
// calculates the omega factors entering the local matrix
Scalar calculateOmega_(const GlobalPosition& normal,
const GlobalPosition& nu,
const Scalar detX,
const Scalar t) const
{ return (normal*nu)*t/detX; }
{
// make sure we have positive diffusion coefficients
assert(t > 0.0 && "non-positive diffusion coefficients cannot be handled by mpfa methods");
return (normal*nu)*t/detX;
}
//! Specialization for dim = 2
template<int d = dim>
......
......@@ -588,6 +588,7 @@ private:
}
}
// TODO: how to do the assertion of positive coefficients for tensors?
DimVector calculateOmegas_(const LocalScvType& localScv,
const GlobalPosition normal,
const Scalar area,
......@@ -607,11 +608,15 @@ private:
return wijk;
}
// calculates n_i^T*K_j*nu_k
DimVector calculateOmegas_(const LocalScvType& localScv,
const GlobalPosition normal,
const Scalar area,
const Scalar t) const
{
// make sure we have positive diffusion coefficients
assert(t > 0.0 && "non-positive diffusion coefficients cannot be handled by mpfa methods");
DimVector wijk;
GlobalPosition tmp(normal);
tmp *= t;
......
......@@ -381,13 +381,18 @@ private:
mc.AL[divEqIdx_][divEqIdx_] += factor*(localD[normalDir]*shapeJacobian[3][0]);
}
// TODO: how to do the assertion of positive coefficients for tensors?
Tensor makeTensor_(Tensor&& tensor) const
{ return std::move(tensor); }
// turns a scalar into a tensor
Tensor makeTensor_(Scalar&& t) const
{
// make sure we have positive diffusion coefficients
assert(t > 0.0 && "non-positive diffusion coefficients cannot be handled by mpfa methods");
Tensor T(0.0);
for (int i = 0; i < dim; ++i)
for (int i = 0; i < dimWorld; ++i)
T[i][i] = t;
return T;
......
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