34 #ifndef __H__UG__PLUGINS__NAVIER_STOKES__INCOMPRESSIBLE__FV1__DIFFUSION_LENGTH__
35 #define __H__UG__PLUGINS__NAVIER_STOKES__INCOMPRESSIBLE__FV1__DIFFUSION_LENGTH__
48 template <
typename TFVGeometry>
55 UG_ASSERT(geo.scvf(0).num_ip() == 1,
"Only implemented for first order.");
57 for(
size_t i = 0; i < geo.num_scvf(); ++i)
60 const typename TFVGeometry::SCVF& scvf = geo.scvf(i);
63 const typename TFVGeometry::SCV& scvFrom = geo.scv(scvf.from());
64 const typename TFVGeometry::SCV& scvTo = geo.scv(scvf.to());
70 number areaSCVSq = 0.5 * (scvFrom.volume() + scvTo.volume());
71 areaSCVSq *= areaSCVSq;
75 DiffLengthSqInv[i] = 2.0 * normNormalSq/ areaSCVSq + 8.0 / normNormalSq;
82 scvf.global_corner(2));
84 DiffLengthSqInv[i] = 2.0 * normNormalSq/ areaSCVSq + 8.0 * distSq / normNormalSq;
87 UG_THROW(
"NSDiffLengthFivePoint not implemented for dimension "<<
dim);
91 template <
typename TFVGeometry>
98 UG_ASSERT(geo.scvf(0).num_ip() == 1,
"Only implemented for first order.");
101 for(
size_t i = 0; i < geo.num_scvf(); ++i)
104 const typename TFVGeometry::SCVF& scvf = geo.scvf(i);
107 const typename TFVGeometry::SCV& scvFrom = geo.scv(scvf.from());
108 const typename TFVGeometry::SCV& scvTo = geo.scv(scvf.to());
114 number areaSCVSq = 0.5 * (scvFrom.volume() + scvTo.volume());
115 areaSCVSq *= areaSCVSq;
119 DiffLengthSqInv[i] = 1. / (0.5*areaSCVSq/normNormalSq + 3.0*normNormalSq/8.);
126 scvf.global_corner(2));
128 DiffLengthSqInv[i] = 1. / (0.5*areaSCVSq/normNormalSq + 3.0*distSq/8.);
131 UG_THROW(
"NSDiffLengthRaw not implemented for dimension "<<
dim);
135 template <
typename TFVGeometry>
142 UG_ASSERT(geo.scvf(0).num_ip() == 1,
"Only implemented for first order.");
145 number minNormSq = std::numeric_limits<number>::max();
146 number minDistSq = std::numeric_limits<number>::max();
148 for(
size_t i = 0; i < geo.num_scvf(); ++i)
151 const typename TFVGeometry::SCVF& scvf = geo.scvf(i);
157 if(normNormalSq < minNormSq) minNormSq = normNormalSq;
160 avgNormSq += normNormalSq;
167 scvf.global_corner(2));
170 if(distSq < minDistSq) minDistSq = distSq;
175 avgNormSq /= geo.num_scvf();
177 for(
size_t i = 0; i < geo.num_scvf(); ++i)
180 const typename TFVGeometry::SCVF& scvf = geo.scvf(i);
181 const typename TFVGeometry::SCV& scvFrom = geo.scv(scvf.from());
182 const typename TFVGeometry::SCV& scvTo = geo.scv(scvf.to());
185 number areaSCVSq = 0.5 * (scvFrom.volume() + scvTo.volume());
186 areaSCVSq *= areaSCVSq;
190 DiffLengthSqInv[i] = 2.0 * minNormSq/ areaSCVSq + 8.0 / (3.0*avgNormSq);
194 DiffLengthSqInv[i] = 2.0 * minNormSq/ areaSCVSq + 8.0 * minDistSq / (3.0*avgNormSq);
197 UG_THROW(
"NSDiffLengthCor not implemented for dimension "<<
dim);
function NavierStokes(fcts, subsets, discType)
#define UG_ASSERT(expr, msg)
vector_t::value_type VecTwoNormSq(const vector_t &v)
void NSDiffLengthRaw(number DiffLengthSqInv[], const TFVGeometry &geo)
Definition: diffusion_length.h:92
void NSDiffLengthCor(number DiffLengthSqInv[], const TFVGeometry &geo)
Definition: diffusion_length.h:136
void NSDiffLengthFivePoint(number DiffLengthSqInv[], const TFVGeometry &geo)
Definition: diffusion_length.h:49
TVector::value_type VecDistanceSq(const TVector &v1, const TVector &v2, const TMatrix &M)