Skip to content

Reply To: AnalyticalLinear2D


Hey Frank,

you will find the code for the AnalyticalLinear2D functor in src/functors/analytical/analyticalF.hh. There you can check the implementation:

template <typename T, typename S>
AnalyticalLinear2D<T,S>::AnalyticalLinear2D(S x0, S y0, T v0, S x1, S y1,
T v1, S x2, S y2, T v2)
: AnalyticalF2D<T,S>(1)
this->getName() = “linear”;
T n2= (x1-x0)*(y2-y0) – (y1-y0)*(x2-x0);
if ( util::nearZero(n2) ) {
std::cout << “Error function” << std::endl;
} else {
T n0 = (y1-y0)*(v2-v0) – (v1-v0)*(y2-y0);
T n1 = (v1-v0)*(x2-x0) – (x1-x0)*(v2-v0);
_a = -n0 / n2;
_b = -n1 / n2;
_c = (x0*n0 + y0*n1 + v0*n2) / n2;

if you want to print the _a, _b, _c variables, you can use e.g. a std::cout statement. The error in your second case is that your are using lattice coordinates (converter.getLatticeLength(1.)) instead of physical coordinates (1.0). This seems to be the reason for your decreased velocity.

Best Marc