diff --git a/cpu/FreeLee.cpp b/cpu/FreeLee.cpp index 5daac030..1e2fc04d 100644 --- a/cpu/FreeLee.cpp +++ b/cpu/FreeLee.cpp @@ -161,6 +161,9 @@ extern "C" void ScaLBL_D3Q7_AAodd_FreeLeeModel_PhaseField(int *neighborList, int fq = hq[nread]; phi += fq; + if (phi > 1.f) phi = 1.0; + if (phi < -1.f) phi = -1.0; + // save the number densities Den[n] = rhoA + 0.5*(1.0-phi)*(rhoB-rhoA); @@ -207,6 +210,9 @@ extern "C" void ScaLBL_D3Q7_AAeven_FreeLeeModel_PhaseField(int *Map, double *hq, fq = hq[5*Np+n]; phi += fq; + if (phi > 1.f) phi = 1.0; + if (phi < -1.f) phi = -1.0; + // save the number densities Den[n] = rhoA + 0.5*(1.0-phi)*(rhoB-rhoA);