Skip to content

Commit

Permalink
Fix normalization for the special boundary points
Browse files Browse the repository at this point in the history
Need to normalise by the sum of weights obviously
(otherwise would leads to crazy low values of the phase field
in random points of the domain)
  • Loading branch information
shkodm committed Aug 26, 2024
1 parent 9a0f8d6 commit 5ca385b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion models/multiphase/d3q27_pf_velocity/Boundary.c.Rt
Original file line number Diff line number Diff line change
Expand Up @@ -781,17 +781,19 @@ CudaDeviceFunction void calcWallPhase_correction() {
int count = 0;
real_t fluid_average = 0.0;
real_t x, y, z;
real_t denom = 0.0;
for (int i=1; i<27 ; i++){
x = d3q27_ex[i];
y = d3q27_ey[i];
z = d3q27_ez[i];
if (!IsBoundary_dyn(int(x), int(y), int(z)) && PhaseF_dyn(int(x), int(y), int(z)) > -0.5) {
fluid_average += wg[i]*PhaseF_dyn(int(x), int(y), int(z));
denom += wg[i];
count++;
}
}
// print sum and average and count
PhaseF = count == 0 ? 1 : fluid_average / count;
PhaseF = count == 0 ? 1 : fluid_average / denom;
} else {
PhaseF = point_in_the_normal_direction;
}
Expand Down

0 comments on commit 5ca385b

Please sign in to comment.