Using addWallFunctionBoundary
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Using addWallFunctionBoundary
- This topic has 6 replies, 2 voices, and was last updated 4 years, 3 months ago by vinhvu1995.
-
AuthorPosts
-
October 1, 2020 at 2:08 pm #5199vinhvu1995Participant
Hi,
I’ve been trying to implement a wall function bc for an empty channel and I think I’ve done it incorrectly so I’m hoping someone will help me. So far, I’ve tried to initialise the wallFunctionParam, then plug it into the addWallFunctionBoundary like so
struct wallFunctionParam<T> wallFunctionParam = {};
bc.addWallFunctionBoundary( superGeometry, 5, converter, wallFunctionParam);This doesn’t work however and crashes when it tries to prepare the lattice. Is there anything else I need to do to get this working?
Cheers,
VinhOctober 12, 2020 at 9:20 am #5223MarcParticipantDear Vinh,
at the moment we don’t have a suitable example to show the working principle of the wall function. We will include a helpful example in the next release. Here is a step by step summary how to use the wall function:
1. you need a suitable Descriptor e.g.#define DESCRIPTOR WallFunctionForcedD3Q19Descriptor
2. Then you should define your wallfunction parameter:
/* Used method for density reconstruction
* 0: Zou-He
* 1: extrapolation
* 2: constant
*/
int rhoMethod = 0;/* Used method for non-equilibrium particle distribution reconstruction
* 0: regularized NEBB (Latt)
* 1: extrapolation NEQ (Guo Zhaoli)
* 2: regularized second order finite Differnce
* 3: equilibrium scheme
*/
int fneqMethod = 3;/* Used wall profile
* 0: Musker profile
* 1: power law profile
*/
int wallProfile = 0;/// special formulation for straight boundaries
bool curved = false;/// use van Driest damping function in boundary cell
bool useVanDriest = true;/// von Karman constant for van Driest model
T vonKarman = 0.375;wallFunctionParam<T> wallFunctionParam;
wallFunctionParam.curved = curved;
wallFunctionParam.bodyForce = true;
wallFunctionParam.wallProfile = wallProfile;
wallFunctionParam.rhoMethod = rhoMethod;
wallFunctionParam.fneqMethod = fneqMethod;
wallFunctionParam.latticeWalldistance = latticeWalldistance;
wallFunctionParam.vonKarman = vonKarman;3. define a suitable Dynamics on your wall function boundary
ExternalTauEffLESForcedBGKdynamics<T, DESCRIPTOR> boundaryDynamics (converter.getLatticeRelaxationFrequency(), instances::getBulkMomenta<T,DESCRIPTOR>());
In Prepare Lattice
sLattice.defineDynamics(superGeometry, 2, &boundaryDynamics);
sBC.addWallFunctionBoundary(superGeometry, 2, converter, wallFunctionParam);I hope this helps you!
Best,
MarcOctober 14, 2020 at 2:18 pm #5232vinhvu1995ParticipantHi Marc,
Thanks for the summary, it did help me a lot. I think I nearly got it all working now, but I’m having an issue with the WallFunctionForcedD3Q19Descriptor. For some reason I can’t compile my code with that specific descriptor. I get the following error
error: ‘opposite’ is not a member of ‘olb::descriptors::D3Q19<olb::descriptors::AV_SHEAR, olb::descriptors::TAU_W, olb::descriptors::TAU_EFF, olb::descriptors::FORCE, olb::descriptors::V12>’
If I chose a different descriptor (say D3Q19), then it compiles fine, but it will produce a segmentation error, presumably because the wall function boundary is not working properly without the proper descriptor. Is there something I’m missing with the wall function descriptor?
Cheers,
Vinh- This reply was modified 4 years, 4 months ago by vinhvu1995.
October 19, 2020 at 10:13 am #5235MarcParticipantHey Vinh,
it seems that there is an old function call in the src/boundary/wallFunctionBoundaryPostProcessors3D.hh file. Please replace the erroneus line 710 with
fneq_bc[normalInwardsIndices[fIndex]] = fneq_bc[util::opposite<DESCRIPTOR>(normalInwardsIndices[fIndex])];
This should compile.Best Marc
October 26, 2020 at 5:10 pm #5251vinhvu1995ParticipantHi Marc,
Thanks for the reply, I’ve replaced the erroneous line and I still cannot compile my code. This is the error I get
src/boundary/wallFunctionBoundaryPostProcessors3D.hh: In member function ‘void olb::WallFunctionBoundaryProcessor3D<T, DESCRIPTOR>::computeFneqRNEBB(olb::Cell<T, DESCRIPTOR>&, T*, T, T*)’: /src/boundary/wallFunctionBoundaryPostProcessors3D.hh:711:96: error: no matching function for call to ‘opposite(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)’ 711 | fneq_bc[normalInwardsIndices[fIndex]] = fneq_bc[util::opposite(normalInwardsIndices[fIndex])]; | ^ In file included src/dynamics/dynamics.h:32, /src/boundary/boundaryCondition3D.h:31, src/boundary/boundary3D.h:28, src/olb3D.h:1, from array.cpp:7: src/core/util.h:193:47: note: candidate: ‘template<class DESCRIPTORBASE> int olb::util::opposite(int)’ 193 | template <typename DESCRIPTORBASE> inline int opposite(int iPop) | ^~~~~~~~ src/core/util.h:193:47: note: template argument deduction/substitution failed: In file included from src/boundary/boundary3D.hh:42, from src/olb3D.hh:1, from array.cpp:9: src/boundary/wallFunctionBoundaryPostProcessors3D.hh:711:96: note: couldn’t deduce template parameter ‘DESCRIPTORBASE’ 711 | fneq_bc[normalInwardsIndices[fIndex]] = fneq_bc[util::opposite(normalInwardsIndices[fIndex])]; |
I guess the next release has the updated code which should fix the problems. Do you think it be better if I waited for the next release?
Cheers,
Vinh- This reply was modified 4 years, 3 months ago by vinhvu1995. Reason: Pasting code doesn't work well
- This reply was modified 4 years, 3 months ago by vinhvu1995. Reason: cannot post code with ../.../
October 30, 2020 at 12:39 pm #5258MarcParticipantHey Vinh,
please look carefully at the error message again:
You get the error for the following code line:
fneq_bc[normalInwardsIndices[fIndex]] = fneq_bc[util::opposite(normalInwardsIndices[fIndex])];I told you to replace it by
fneq_bc[normalInwardsIndices[fIndex]] = fneq_bc[util::opposite<DESCRIPTOR>(normalInwardsIndices[fIndex])];Could it be that you leave the template argument <DESCRIPTOR>, which causes the error? In some weeks we will have a new release with a working example of the turbulent channel flow.
Best Marc
November 6, 2020 at 1:13 pm #5272vinhvu1995ParticipantHey Marc,
Sorry for that mistake! I have no idea how I managed to do that. Everything is working fine now! I’m currently running a few test cases with the wall function boundary on and everything seems to work fine. For some reason, the simulation diverges whenever I use a MPI but I think I can work out what’s causing the problem.
Cheers,
Vinh -
AuthorPosts
- You must be logged in to reply to this topic.