Skip to content

Reply To: Help with the velocity shift in ShanChen


Dear Lucas,

thanks for posting.
Please note that in general, forces are realized in OpenLB as fields, which probably is the reason for you ending up in the generic FIELD_BASE.
The fields act as cell storage and can be accessed via e.g. getFieldPointer in the code snippet you pasted.

Long story short, to implement different forces you could hardcode them in your example/application .cpp file.
By that, I mean specify the force as a function and then pass it to the field storage.
This is done e.g. in examples/multiComponent/rayleighTaylor3d/rayleighTaylor3d.cpp, where an external force is added via an additional field


which is in turn explicitly specified later via

sLatticeOne.defineField<descriptors::EXTERNAL_FORCE>( superGeometry, 1, f );

and hence can be used in the forcing scheme through accessing the EXTERNAL_FORCE field.