AnalyticalLinear2D
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › AnalyticalLinear2D
 This topic has 2 replies, 2 voices, and was last updated 4 years, 2 months ago by František Prinz.

AuthorPosts

August 17, 2020 at 12:38 pm #5096František PrinzParticipant
Hi,
I am trying to initialize a linear inflow in a rectangle channel with dimensions 4×1 meter. On the right wall is the linear inflow with velocities from zero to one m/s at the upper wall. I tried both possibilities how to initialize the AnayliticalLinear2D functor:
int iTmaxStart = converter.getLatticeTime( maxPhysT*0.2 );
int iTupdate = 5;
if ( iT%iTupdate==0 && iT<= iTmaxStart ) {
PolynomialStartScale<T,T> StartScale( iTmaxStart, T( 1 ) );T iTvec[1] = {T( iT )};
T frac[1] = {};
StartScale( frac,iTvec );
T maximVelocity = converter.getLatticeVelocity(1.)*frac[0];
// AnalyticalConst2D<T,T> ux2( maximVelocity );
//case 1
AnalyticalLinear2D<T,T> ux2lin (0., maximVelocity, 0.);
//case 2
//AnalyticalLinear2D<T,T> ux2lin (0., 0. , 0.,converter.getLatticeLength(2.), 0., 0., 0., converter.getLatticeLength(1.), maximVelocity);
AnalyticalConst2D<T,T> uy2( 0. );
AnalyticalComposed2D<T,T> u22( ux2lin,uy2 );Case 1 is working fine but case 2 with the determination by 3 points is the inflow linear profile growth stopping with maximal velocity at 0,0001 , thousand times less then in the case 1. Does anybody know, where could be the misstake?
Is there a possibility in the code how to show the parameters _a, _b or _c in the console? (function AnayliticalLinear2D._a is not working)Thanks
Frank
August 18, 2020 at 10:04 am #5099MarcParticipantHey 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= (x1x0)*(y2y0) – (y1y0)*(x2x0);
if ( util::nearZero(n2) ) {
std::cout << “Error function” << std::endl;
} else {
T n0 = (y1y0)*(v2v0) – (v1v0)*(y2y0);
T n1 = (v1v0)*(x2x0) – (x1x0)*(v2v0);
_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
August 21, 2020 at 11:34 am #5105František PrinzParticipantHey Marc,
thank you for the reply. The error was really in the lattice coordinates instead of physical coordinates, it is a little bit unintuitive to set lattice velocity and physical coordinates if one doesn’t know it.
Best
Frank 
AuthorPosts
 You must be logged in to reply to this topic.