Wall Function Issue
› Forums › OpenLB › General Topics › Wall Function Issue
- This topic has 5 replies, 2 voices, and was last updated 7 months, 1 week ago by FBukreev.
-
AuthorPosts
-
April 30, 2025 at 12:32 pm #10141kingdomkarlParticipant
Hey guys,
congratulations on the great new release! I’ve encountered an issue when using the new wall functions in an internal flow geometry. My prepareLattice function looks like:
void prepareLattice( SuperLattice<T, DESCRIPTOR>& sLattice,
UnitConverter<T,DESCRIPTOR> const& converter,
STLreader<T>& stlReader,
SuperGeometry<T,3>& superGeometry)
{
WallModelParameters<T> wallModelParameters;
wallModelParameters.bodyForce = false;
wallModelParameters.rhoMethod = 0;
wallModelParameters.fNeqMethod = 0;
wallModelParameters.samplingCellDistance = 3.5;
wallModelParameters.interpolateSampleVelocity = true;
wallModelParameters.useVanDriest = false;
wallModelParameters.wallFunctionProfile = 1;
wallModelParameters.movingWall = false;
wallModelParameters.averageVelocity = false;OstreamManager clout( std::cout,”prepareLattice” );
clout << “Prepare Lattice …” << std::endl;
const T omega = converter.getLatticeRelaxationFrequency();// material = 1: bulk dynamics
if ( useWallFunctions ) {
setTurbulentWallModelDynamics(sLattice, superGeometry.getMaterialIndicator({1}), wallModelParameters);
} else {
sLattice.defineDynamics<BulkDynamics>(superGeometry, 1);
}// material = 2: walls
setBouzidiBoundary(sLattice, superGeometry, 2, stlReader);
if ( useWallFunctions ) {
setTurbulentWallModel(sLattice, superGeometry, 2, wallModelParameters);
}// material = 3: inlet
if ( useWallFunctions ) {
boundary::set<boundary::InterpolatedVelocity>(sLattice, superGeometry, 3);
} else {
setBouzidiBoundary<T,DESCRIPTOR,BouzidiVelocityPostProcessor>(sLattice, superGeometry, 3, stlReader);
}// material = 4: outlet
boundary::set<boundary::InterpolatedPressure>(sLattice, superGeometry, 4);
if ( !useWallFunctions ) {
sLattice.defineDynamics<BulkDynamics>(superGeometry.getMaterialIndicator(4));
}// Initial conditions
AnalyticalConst3D<T,T> rhoF( 1 );
std::vector<T> velocity( 3, T(0) );
AnalyticalConst3D<T,T> uF( velocity );// Initialize all values of distribution functions to their local equilibrium
sLattice.defineRhoU( superGeometry.getMaterialIndicator({1, 2, 3, 4}), rhoF, uF );
sLattice.iniEquilibrium( superGeometry.getMaterialIndicator({1, 2, 3, 4}), rhoF, uF );AnalyticalConst3D<T, T> u0(0.,0.,0.);
sLattice.defineField<descriptors::VELOCITY>(superGeometry.getMaterialIndicator({0,1,2,3,4}), u0);sLattice.setParameter<descriptors::OMEGA>(omega);
sLattice.setParameter<collision::LES::SMAGORINSKY>(T(0.15));// Lattice initialize
sLattice.initialize();
clout << “Prepare Lattice … OK” << std::endl;
}The behavior is the following:
– Without WF everything works as intended
– When I switch on the WF and use only one cuboid everything works as intended
– As soon as I increase the number of cuboids I get the following error:terminate called after throwing an instance of ‘std::runtime_error’
what(): an illegal memory access was encountered
Aborted (core dumped)I traced it back to the sLattice.initialize function but am very much lost now as I am not super experienced in openLB. Any help here would be greatly appreciated.
I run the case on a single GPU using the gpu_only.mk and tried CUDA 12.4 and 12.6.
Thanks a lot for any help on this.
April 30, 2025 at 1:17 pm #10142FBukreevKeymasterHi,
you can check whether your overlap is bigger then the sample distance in WM and you can give stlReader into setTurbulentWallModel. Also please add POROSITY field into descriptor and define it to 1 in the bulk and 0 at the boundaries.
May 13, 2025 at 4:01 pm #10201kingdomkarlParticipantHey,
thank you very much for the quick answer. With your suggestion I managed to get my case running. What helped:
– The WFs work fine with multiple cuboids as long as they cut the walls perpendicularly
– The WFs do not seem to work when they cut a wall at a non-perpendicular angle. This can be remedied by setting the samplingCellDistance to a small value or disabling it. Then no sampling outside a particular cuboid is done. I am not sure which impact this has on the performance of the WFs.Feel free to let me know if I got something wrong.
May 13, 2025 at 4:07 pm #10202FBukreevKeymasterHi,
I am happy that it runs!
I think if you make the size of overlap larger then probably WF will also work on non-perpendicular angle cuts. In the not very far future we plan to improve normal and distance calculation at the wall, so that hopefully the WF at all complex geometries will be more stable.June 4, 2025 at 8:25 am #10336kingdomkarlParticipantHey!
sorry to reopen this, but at larger Re (=20000), I am having trouble getting a stable setup of my internal pipe-like flow. I let the inlet velocity slowly go up, which works fine. Then I let it run for another flow-through time. Just after that my simulation tends to display unphysical flow patterns at the outlet.
I switched to a convection outlet.:
boundary::set<boundary::InterpolatedConvection>(sLattice, superGeometry, 4);And use the following WF setting:
const int rhoMethod = 0;
const int fNeqMethod = 1;
const int wallFunctionProfile = 1;
const bool bodyForce = false;
const bool interpolateSampleVelocity = true;
const bool useVanDriest = true;
const T latticeWallDistance = 0.5;
const T samplingCellDistance = 2.5;
const bool movingWall = false;
const bool averageVelocity = false;My CFL number is 0.005 and tau is 0.500054. The flow at the outlet looks like this: https://postimg.cc/BXRPpRb5
Again, any help is greatly appreciated 🙂
June 5, 2025 at 10:13 am #10342FBukreevKeymasterHi, if you mean the flow on the right side, then you need a higher Smagorinsky constant or a fringe zone in front of the outlet.
-
AuthorPosts
- You must be logged in to reply to this topic.
