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
- This topic has 4 replies, 2 voices, and was last updated 1 week, 2 days ago by grasingerm.
March 1, 2023 at 10:30 pm #7251
I’ve been working with the free energy model as I’m very interested in studying the influence of surface energies and wetting on the filling of molds, cavities, etc. I feel comfortable with using setFreeEnergyWallBoundary for this and have been able to reproduce some standard contact angle results, as well as simulate some other interesting problems. However, the model assumes equal densities of all fluids–which, for my case, means equal densities between the fluid filling the mold and the fluid being displaced. Unfortunately, this isn’t realistic for my interests as the fluid being displaced is ‘air’.
I’ve also had some success modelling mold/cavity filling with the free surface model; however, I wasn’t sure how to include wetting effects in those models.
How would you recommend I model wetting at solid boundaries with a free surface flow model (or, alternatively, a multi-component model at large density ratio)? Can setFreeEnergyWallBoundary be made to work with the free surface model? Can setFreeEnergyWallBoundary be used with a large density ratio Shan and Chen model? Or would it be best to try something else entirely?
– MattMarch 11, 2023 at 2:19 pm #7300savisParticipant
Unfortunately, the current implementation of the free energy model only considers equal densities. A non-equal model is something that we are interested in implementing in the future, but is not currently included.
It is worth considering if the problem actually requires a high density ratio. If the Reynolds number of the system is small (Re<<1) then an equal density model may be able to accurately simulate the system so long as the correct viscosities are assigned. Although, if inertia is important (Re>=1) then the density ratio must be accurate.
Regarding the setFreeEnergyWallBoundary function, it can only be used in conjunction with the free energy model. I don’t believe there are any similar wetting conditions implemented yet for the free surface or Shan-Chen model.
For Shan-Chen, a wetting condition could be implemented using an additional solid-liquid interaction (for example, see this paper: https://doi.org/10.1103/PhysRevE.76.066701). As for the density ratio, I believe there is a working prototype with density ratios of up to 1000, but this is not fully implemented yet.
And of course, all OpenLB models can be adapted and extended. In the framework of a common project we are happy to help with this!
SamMarch 14, 2023 at 7:13 pm #7305
Thanks for the reply.
Assuming I understand correctly, the free energy wall boundary condition works by 1) formulating a contribution to the free energy functional which depends on the order parameter at the boundary and 2) taking the negative gradient of the free energy as a kind of thermodynamic force. It seems to me that something very similar could be done for the free surface model where instead (of the order parameter) the “thermodynamic force” depends on the local mass.
I would be happy to try to implement this, test it using an analogous contact angle simulation, and share my code if successful. That being said, I would also welcome any advice on how to best get started. I understand that what I most likely need to implement is a “postProcessor”. I’ve had some difficulty tracing back through the call stack of setFreeEnergyWallBoundary and understanding exactly what is going on there. Are there any additional examples, documentation, references, etc., that you think may help me in getting up to speed on postProcessors and how to use one to simulate wetting in a free surface model? I understand C++ and LBM theory well enough but I am new to OpenLB. I’m glad the community here is consistently responsive and helpful.
– MattMarch 16, 2023 at 3:27 am #7308savisParticipant
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:
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.
SamMarch 22, 2023 at 5:32 am #7314
Thanks, Sam. This is indeed very helpful.
- You must be logged in to reply to this topic.