addNaiveForce和addGuoForce的源码位置

/src/latticeBoltzmann/externalForceTemplates3D.h
以addNaiveForce为例,我们可以看到palabos是如何将外力场的3个分量分别施加到相应的18的方向的分布函数f’s上。

static void addNaiveForce(
                Array<T,descriptors::ForcedD3Q19Descriptor<T>::q>& f,
                T* externalScalars )
{
     
    static const int forceBeginsAt
        = descriptors::ForcedD3Q19Descriptor<T>::ExternalField::forceBeginsAt;
    T* force = externalScalars + forceBeginsAt;
    T& fx = force[0];
    T& fy = force[1];
    T& fz = force[2];

    f[1] +=  (-fx       )* (T)1/(T)6;
    f[2] +=  (   -fy    )* (T)1/(T)6;
    f[3] +=  (      -fz )* (T)1/(T)6;
    f[4] +=  (-fx-fy    )* (T)1/(T)12;
    f[5] +=  (-fx+fy    )* (T)1/(T)12;
    f[6] +=  (-fx   -fz )* (T)1/(T)12;
    f[7] +=  (-fx   +fz )* (T)1/(T)12;
    f[8] +=  (   -fy-fz )* (T)1/(T)12;
    f[9] +=  (   -fy+fz )* (T)1/(T)12;
                                   
    f[10] += ( fx       )* (T)1/(T)6;
    f[11] += (    fy    )* (T)1/(T)6;
    f[12] += (       fz )* (T)1/(T)6;
    f[13] += ( fx+fy    )* (T)1/(T)12;
    f[14] += ( fx-fy    )* (T)1/(T)12;
    f[15] += ( fx   +fz )* (T)1/(T)12;
    f[16] += ( fx   -fz )* (T)1/(T)12;
    f[17] += (    fy+fz )* (T)1/(T)12;
    f[18] += (    fy-fz )* (T)1/(T)12;

}

你可能感兴趣的:(Palabos进阶学习)