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
- This topic has 2 replies, 2 voices, and was last updated 1 year, 6 months ago by FBukreev.
-
AuthorPosts
-
March 6, 2023 at 10:34 am #7263navidkyoParticipant
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,
NavidMarch 6, 2023 at 12:01 pm #7264FBukreevKeymasterHello 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 FedorMarch 6, 2023 at 12:01 pm #7265FBukreevKeymasterHello 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, 6 months ago by FBukreev.
-
AuthorPosts
- You must be logged in to reply to this topic.