Skip to content

Extract Pressure On the Surface of Cylinder on Cylinder2D

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Extract Pressure On the Surface of Cylinder on Cylinder2D

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7263
    navidkyo
    Participant

    Hello,

    I am trying to extract pressure(Physical or lattice) on the surface of the cylinder in the cylinder2d example. My main goal is to plot the pressure against the cylinder coordinates; so, I need to know which pressure output corresponds to which cylinder node coordinates.

    I could not do it using “SuperLatticePhysPressure3D<T, NSDESCRIPTOR> presure(NSlattice, converter)” command. Is there any straight way to perform this task because I am not an advanced C++ programmer?

    I appreciate your help in advance.

    Bests,
    Navid

    #7264
    FBukreev
    Keymaster

    Hello Navid,

    you could write your own pressure functor that will print out the values in the needed cells. You need to take the cells laying on the cylinder radius and take their pressure values. The easiest way is to print them in the terminal output.
    ´template
    void compute(SuperLattice& sLattice,
    CuboidGeometry<...>& cuboidG,
    UnitConverter<...>& converter){
    //compute physical X and Y coordinste depending on cylinder coordinate
    T cylCoord = ….;
    T X = f(cylCoord);
    T Y = f(cylCoord);
    T physR[2] = {X,Y};
    int latticeR[3] = {0.};
    cuboidG.getLatticeR(latticeR,physR);
    auto cell = sLattice.getBlock(latticeR[0]).get(latticeR[1],latticeR[2]);
    T latticePressure = ( cell.computeRho() – 1.0 ) / descriptors::invCs2();
    T physPressure = converter.getPhysPressure(latticePressure);
    std::cout << "Cylinder coordinate: " cylCoord << " Pressure: " << physPressure << std::endl; }´ Adapt this code to your case. Greeting Fedor

    #7265
    FBukreev
    Keymaster

    Hello Navid,

    you could write your own pressure functor that will print out the values in the needed cells. You need to take the cells laying on the cylinder radius and take their pressure values. The easiest way is to print them in the terminal output.

    template<typename T>
    void compute(SuperLattice<T, NSDESCRIPTOR>& sLattice,
                 CuboidGeometry<...>& cuboidG,
                 UnitConverter<...>& converter){
        //compute physical X and Y coordinste depending on cylinder coordinate
        T cylCoord = ....;
        T X = f(cylCoord);
        T Y = f(cylCoord);
        T physR[2] = {X,Y};
        int latticeR[3] = {0.};
        cuboidG.getLatticeR(latticeR,physR);
        auto cell = sLattice.getBlock(latticeR[0]).get(latticeR[1],latticeR[2]);
        T latticePressure = ( cell.computeRho() - 1.0 ) / descriptors::invCs2<T,DESCRIPTOR>();
        T physPressure =  converter.getPhysPressure(latticePressure);
        std::cout << "Cylinder coordinate: " cylCoord << " Pressure: " << physPressure << std::endl;
    }

    Adapt this code to your case.

    Greeting
    Fedor

    • This reply was modified 1 year, 1 month ago by FBukreev.
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.