Skip to content

AnalyticalLinear2D

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5096
    František Prinz
    Participant

    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

    #5099
    Marc
    Participant

    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

    #5105
    František Prinz
    Participant

    Hey 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

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.