fix divide by zero
This commit is contained in:
commit
64e7b1211a
@ -278,15 +278,12 @@ void SubPhase::Basic(){
|
|||||||
dir_y = Fy/force_mag;
|
dir_y = Fy/force_mag;
|
||||||
dir_z = Fz/force_mag;
|
dir_z = Fz/force_mag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Dm->BoundaryCondition > 0 ){
|
if (Dm->BoundaryCondition > 0 ){
|
||||||
// compute the pressure drop
|
// compute the pressure drop
|
||||||
double pressure_drop = (Pressure(Nx*Ny + Nx + 1) - 1.0) / 3.0;
|
double pressure_drop = (Pressure(Nx*Ny + Nx + 1) - 1.0) / 3.0;
|
||||||
double length = ((Nz-2)*Dm->nprocz);
|
double length = ((Nz-2)*Dm->nprocz());
|
||||||
force_mag -= pressure_drop/length;
|
force_mag += pressure_drop/length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force_mag == 0.0){
|
if (force_mag == 0.0){
|
||||||
// default to z direction
|
// default to z direction
|
||||||
dir_x = 0.0;
|
dir_x = 0.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user