Skip to content

Reply To: wetting with free surface or large density ratio

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics wetting with free surface or large density ratio Reply To: wetting with free surface or large density ratio

#7308
savis
Participant

Hi Matt,

Yes, that just about sums up the free energy boundary condition. Crucially, the thermodynamic force is already calculated on the bulk fluid nodes from gradients of the order parameter. So, all that is needed to implement the force at the solid surface is to modify the order parameter slightly on the boundary nodes. I am not that familiar with the free surface model, so I am not sure if the same approach would work or if you would need to assign a force itself.

To give you an idea how to implement a boundary condition I will summarise how setFreeEnergyWallBoundary works, as that’s what I’m most familiar with.

Firstly, there are a variety of different ‘setFreeEnergyWallBoundary’ functions that can be called depending on different parameters, but ultimately they call this function (for 2D): https://www.openlb.net/DoxyGen/html/db/d1b/namespaceolb.html#a385301cd3914ac9a54cf782e9299046f

This calls a different ‘setFreeEnergyWallBoundary’ function on each processor / block:
https://www.openlb.net/DoxyGen/html/db/d1b/namespaceolb.html#a1441af06e059821ec0dee3a9639a249b
In here, for each solid boundary node, the normal vector to the boundary is found (discreteNormal), the dynamics are set (bounce-back, etc), and then the post-processor generators are assigned. For the free-energy boundary there are two post-processors, but you would probably just need one. Also, the ‘addend’ and ‘latticeNumber’ parameters are specific to this boundary condition, so you would not need them.

The post-processor generator is largely a wrapper for the post-processor. It has been a while since I have looked at it, so I can’t quite remember its purpose: https://www.openlb.net/DoxyGen/html/d3/d21/classolb_1_1FreeEnergyWallProcessorGenerator2D.html

Finally, the post processor class contains the main functionality inside the ‘subprocess’ function: https://www.openlb.net/DoxyGen/html/d3/dee/classolb_1_1FreeEnergyWallProcessor2D.html
To clarify what is going on in this example, it takes the density / order parameter (somewhat confusingly called rho) on the adjacent node and adds the modification to get the desired value. The 0th distribution function is then modified on the boundary node so that the sum of the distribution functions gives this value.

Much of this code is boilerplate so to make a new boundary condition not much would need to be changed. The main things to modify are the second function which you would need the correct dynamics and postprocessor. As for the postprocessor, you would need to modify the subprocess function.

Let me know if any of this is unclear or if you need any further help.

Best,
Sam