From ea64630cc77ade246dbcc83e397137f12941104b Mon Sep 17 00:00:00 2001 From: Rex Zhe Li Date: Thu, 25 Mar 2021 23:07:01 -0400 Subject: [PATCH] further regulate the phase field --- cpu/FreeLee.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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);