OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics mrtCollision operator in OpenLB

Viewing 3 posts - 1 through 3 (of 3 total)
• Author
Posts
• #1982
Eric
Participant

Dear OpenLB team,

I have a question about the mrtCollision solver implemented in OpenLB. As far as I understand, the original code first compute momenta and momenta_eq, but I can see that only 6 of 9 parameters are calculated here:

Code:
template<typename T>
38 struct mrtHelpers<T, descriptors::MRTD2Q9Descriptor> {
39
41 static void computeEquilibrium( T momentaEq,
42 T rho, const T u,
43 const T uSqr )
44 {
45 // momentaEq = T();
46 momentaEq = -(T)2*rho + (T)3*uSqr;
47 momentaEq = rho – (T)3*uSqr;
48 // momentaEq = T();
49 momentaEq = -u;
50 // momentaEq = T();
51 momentaEq = -u;
52 momentaEq = u*u – u*u;
53 momentaEq = u*u;
54 }
55
57 static void computeMomenta(T momenta, Cell<T,MRTD2Q9Descriptor> &cell)
58 {
59 // momenta = cell + cell + cell + cell +
60 // cell + cell + cell + cell + cell + (T)1;
61
62 momenta = -(T)4*cell +(T)2*cell – cell + (T)2*cell – cell +
63 (T)2*cell – cell + (T)2*cell – cell – (T)2;
64
65 momenta = (T)4*cell + cell – (T)2*cell + cell – (T)2*cell +
66 cell – (T)2*cell + cell – (T)2*cell + (T)1;
67
68 // momenta = – cell – cell – cell +
69 // cell + cell + cell;
70
71 momenta = – cell + (T)2*cell – cell +
72 cell – (T)2*cell + cell;
73
74 // momenta = cell – cell – cell –
75 // cell + cell + cell;
76
77 momenta = cell – cell + (T)2*cell –
78 cell + cell – (T)2*cell;
79
80 momenta = cell – cell + cell – cell;
81
82 momenta = – cell + cell – cell + cell;
83 }

May I ask why there’s no need to calculate index 0,3, and 5? I guess it might help reduce computation time, but when updating

Code:
cell[iPop] -= invM_S[iPop][jPop]*momX

the deleted element in invM_S is not always 0. So will this affect the computation?

P.S. Could you also explain why we need to add 2 to the momenta when calculating momenta in the following code? I understand this is energy momenta, but the matrix multiplication should not produce 2?

Code:
62 momenta = -(T)4*cell +(T)2*cell – cell + (T)2*cell – cell +
63 (T)2*cell – cell + (T)2*cell – cell – (T)2;

Looking forward to hearing from you.

Best regards,
Eric

#2864
mathias
Keymaster

Dear Eric,

1/ Actually 0,3, and 5 are ZERO:

template<typename T>
const T MRTD2Q9DescriptorBase<T>::S[MRTD2Q9DescriptorBase<T>::q_] =
{ T(), (T)1.1, (T)1.1, T(), (T)1.1, T(), (T)1.1, T(), T() };
// s7=s8 to have a shear viscosity nu
// and the bulk viscosity depends on s2.

2/ In openLB we save f_OLB = f – f^eq. So \sum_q f_OLB + 1 = rho.

Best
Mathias

#2881
Eric
Participant

Dear Mathias,

Thank you very much for you explanation!

Best regards,
Eric

Viewing 3 posts - 1 through 3 (of 3 total)
• You must be logged in to reply to this topic.