Closed nlooije closed 10 years ago
Could you please also update subdomains/binary_pbc.py to use G12 instead of G?
Completely agreed re test case. Unfortunately, I don't know of any such case either. When you decided to work on this generalization of the SC implementation, did you have some specific use cases in mind? If so, perhaps having some code related to these could be helpful...
The case i had in mind when implementing was a two component system with G11 set instead of G12, i.e. have one ideal gas and a liquid-vapor component. The original code was only for setting G12, thats why i decided to modify it. As far as i know there is no physical system that requires setting both G11 and G12/G21.
If you set G11, but not G12, wouldn't you end up with two components that would not interact with themselves at all? I.e. wouldn't that be the same as running two simulations simultaneously, one for each component: 1) single-phase Shan-Chen (G11), 2) standard single component fluid flow?
From the perspective of the Shan-Chen force implementation there would be no interaction between component 1 and 2 due to G12=G21=0 (i.e. ideal interactions). However, the equilibrium velocities are still based on a common mixture velocity: v = ( sum_c rho_c*v_c/tau_c ) / (sum_c rho_c/tau_c) regardless if they are being shifted by a force or not. So technically they do interact, just not through the force term.
Makes sense, thanks for explaining that. I forgot about the mixture velocity when I wrote my comment..
I merged your code into the master branch (after collapsing several G12 update commits to one). Thanks Niels!
I have modified to code to allow setting interaction strengths between any combination of components. The SC drop example case is converted to a binary fluid case and used to test self-interaction for the model. The other binary_fluid example cases are updated to work with the new interaction strength symbols.
lb_binary.py:
shan_chen.mako:
// for grid_idx = 0: float sca0[2]={}: if (isWetNode(type)) {
shan_chen_force(gi, g0m0, gg0m0, G11, sca0, gx, gy); shan_chen_force(gi, g0m0, gg1m0, G12, sca0, gx, gy); // Convert momentum and force into velocity and acceleration. sca0[0] /= g1m0; sca0[1] /= g1m0; }
// for grid_idx = 1: float sca0[2]={}: if (isWetNode(type)) {
shan_chen_force(gi, g1m0, gg0m0, G21, sca0, gx, gy); // Convert momentum and force into velocity and acceleration. sca0[0] /= g1m0; sca0[1] /= g1m0; }