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?

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 = {X,Y};
int latticeR = {0.};
cuboidG.getLatticeR(latticeR,physR);
auto cell = sLattice.getBlock(latticeR).get(latticeR,latticeR);
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 = {X,Y};
int latticeR = {0.};
cuboidG.getLatticeR(latticeR,physR);
auto cell = sLattice.getBlock(latticeR).get(latticeR,latticeR);
T latticePressure = ( cell.computeRho() - 1.0 ) / descriptors::invCs2<T,DESCRIPTOR>();
T physPressure =  converter.getPhysPressure(latticePressure);
std::cout << "Cylinder coordinate: " cylCoord << " Pressure: " << physPressure << std::endl;
}``````