use of parfor in matlab for a lattice boltzmann code

i'm working on lattice boltzmann method and i've written a matlab code. I would like to parallelize some parts of the code but i'm new to this so i'd appreciate your help. I'd like to know if it's possible to use the parfor for this part(collision operator):
for i=1:lx
for j=1:ly
for k=1:9
f(k,i,j)=f(k,i,j) .* (1 - omega) + omega .* feq(k,i,j);
end
end
end
I've tried to replace the outermost for loop with a parfor but the code seems to be slower.
any suggestions?
thanks in advance

 Accepted Answer

Is there any reason you can't use vectorization here?
f = f .* (1-omega) + omega .* feq;

More Answers (0)

Categories

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!