sailfish-team/sailfish — pull request #26 by nlooije (2013-12-20 23:59:22+00:00)
Title: Generalized SC model for binary fluid simulations

I have modified to code to allow setting interaction strengths between any combination of components.

lb_binary.py:
1. added force couplings between all components
2. added arguments for interaction strengths G11, G12 and G22
3. setting interaction strength G12 sets G21=G12 by default

shan_chen.mako:
1. initialized 'sca0' before function call to shan_chen_force() instead of as 'force' in shan_chen_force()
2. shan_chen_force() is now called for every interaction in the 'force_couplings' dictionary between component 'grid_idx' and component 'dists[1]' unless the 'coupling_const' is equal to 0.0. The results are added to sca0. For example, setting G11 and G12 results in the code:

// 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;	}