Skip to content

Commit 0da8bbe

Browse files
committed
Add velocity limiter
1 parent 463ce27 commit 0da8bbe

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

models/multiphase/d3q27_pf_velocity/Dynamics.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ if (Options$thermo){
259259
AddSetting(name="BuoyancyX", default=0.0, comment='applied (rho_h-rho)*BuoyancyX')
260260
AddSetting(name="BuoyancyY", default=0.0, comment='applied (rho_h-rho)*BuoyancyY')
261261
AddSetting(name="BuoyancyZ", default=0.0, comment='applied (rho_h-rho)*BuoyancyZ')
262+
AddSetting(name="vlimiter", default=0.0, comment="Velocity limiter value")
262263
##################################
263264
########TRACKING VARIABLES########
264265
##################################
@@ -321,6 +322,7 @@ if (Options$thermo){
321322
AddGlobal(name="LiqTotalVelocityX", comment='use to determine avg velocity of droplets', unit="m/s")
322323
AddGlobal(name="LiqTotalVelocityY", comment='use to determine avg velocity of droplets', unit="m/s")
323324
AddGlobal(name="LiqTotalVelocityZ", comment='use to determine avg velocity of droplets', unit="m/s")
325+
AddGlobal(name="LimitedCells", comment='Number of cells where we limited the velocity', unit="1")
324326
AddGlobal(name="NumFluidCells", comment='Number of fluid cells')
325327
AddGlobal(name="NumSpecialPoints", comment='Number of special points')
326328
AddGlobal(name="NumWallBoundaryPoints", comment='Number of boundary nodes')

models/multiphase/d3q27_pf_velocity/Dynamics.c.Rt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,18 @@ CudaDeviceFunction void CollisionMRT()
687687

688688
<?R C( u, m0[2:4] + 0.5 * F_total * rho.inv) ?>
689689
} while (j<force_fixed_iterator);
690+
691+
if (vlimiter != 0) {
692+
real_t vl = U*U + V*V + W*W;
693+
if (vl > vlimiter*vlimiter){
694+
real_t reducer = vlimiter / sqrt(vl);
695+
AddToLimitedCells(1);
696+
U = U * reducer;
697+
V = V * reducer;
698+
W = W * reducer;
699+
}
700+
}
701+
690702
// PHASE FIELD POPULATION UPDATE:
691703
tmp1 = (1.0 - 4.0*(C - 0.5)*(C - 0.5))/IntWidth;
692704
<?R

0 commit comments

Comments
 (0)