sailfish-team / sailfish

Lattice Boltzmann (LBM) simulation package for GPUs (CUDA, OpenCL)
http://sailfish.us.edu.pl
230 stars 85 forks source link

N-component implementation of SC model #29

Closed nlooije closed 6 years ago

nlooije commented 10 years ago

Hi,

I have finished the implementation of the SC model for 'arbitrary' number of components.

Major revisions:

  1. the number of components may be set through the 'lat_nc' argument with max 9 components.
  2. multicomponent models now defined in 'lb_multi.py' ('lb_binary' and 'lb_ternary' are removed)
  3. density fields are now referenced by g#m0, similar for tau#, visc#. G's are following the same template, i.e. G01 is interaction between grid 0 and 1. (examples are updated)
  4. multicomp+phase mako templates are split into main, SC and FE versions for better overview
  5. extra arg 'grids' passed to fields method; easiest way i found to be able to generate a list for arbitrary number of components. (maybe there is a better way?)
  6. extra arg 'shanchen'=True/False added to cexpr(); when True does not format 'g0m0' and 'g1m0' to 'rho' and 'phi'.
  7. relevant variables in mako templates are now designated by their grid id (easier to read in source code)

Minor revisions:

  1. some grammatical mistakes in example doc strings fixed
  2. 2nd moment of eq and neq dist in boundary.mako only occur now when needed for Grad and Regularized implementation.

Some issues: lb_multi.py - line 130: is there a better way of determining SC vs FE? lb_multi.py - line 434: should be able to fit on one line but cant get it to work, i.e. gpu_rho = {c: runner.gpu_field(eval('self.g{}m0'.format(c))) for c in range(0, self.config.lat_nc)}

mjanusz commented 10 years ago

Thanks Niels, this is great work! I'm sorry about the delay in reviewing this. I added a bunch of comments, mostly about minor style issues.

What's the problem with the dict comprehension that you mentioned in the merge request? Could you please paste the error message you are getting?

nlooije commented 10 years ago

Hi Michal,

I have made modifications based on most of your comments however some of the comments i would like to get your input. I have responded to those comments (fields method, tau/visc to base class, hardcoded tau and removing indices), please take a look.

mjanusz commented 10 years ago

Hi Niels,

I added my responses a while back (just thought I'd mention that explicitly here -- I'm not sure GH sends any notifications). Please let me know if you have any additional questions :)