@@ -312,8 +312,9 @@ contains
312312 do i = 0, m
313313 if (patch_icpp(patch_id)%smoothen) then
314314 ! Smooth Heaviside via hyperbolic tangent; smooth_coeff controls interface sharpness
315- eta = tanh(smooth_coeff/min(dx, &
316- & dy)*(sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp
315+ eta = tanh(smooth_coeff/min(x%min_spacing, &
316+ & y%min_spacing)*(sqrt((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2) - radius))*(-0.5_wp) &
317+ & + 0.5_wp
317318 end if
318319
319320 if (((x%cc(i) - x_centroid)**2 + (y%cc(j) - y_centroid)**2 <= radius**2 &
@@ -485,9 +486,9 @@ contains
485486 do j = 0 , n
486487 do i = 0 , m
487488 if (patch_icpp(patch_id)%smoothen) then
488- eta = tanh (smooth_coeff/ min (dx , &
489- & dy )* (sqrt (((x%cc(i) - x_centroid)/ a)** 2 + ((y%cc(j) - y_centroid)/ b)** 2 ) - 1._wp )) * ( - 0.5_wp ) &
490- & + 0.5_wp
489+ eta = tanh (smooth_coeff/ min (x%min_spacing , &
490+ & y%min_spacing )* (sqrt (((x%cc(i) - x_centroid)/ a)** 2 + ((y%cc(j) - y_centroid)/ b)** 2 ) - 1._wp )) &
491+ & * ( - 0.5_wp ) + 0.5_wp
491492 end if
492493
493494 if ((((x%cc(i) - x_centroid)/ a)** 2 + ((y%cc(j) - y_centroid)/ b)** 2 <= 1._wp &
@@ -555,8 +556,8 @@ contains
555556 end if
556557
557558 if (patch_icpp(patch_id)%smoothen) then
558- eta = tanh(smooth_coeff/min(dx, dy , &
559- & dz )*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z &
559+ eta = tanh(smooth_coeff/min(x%min_spacing, y%min_spacing , &
560+ & z%min_spacing )*(sqrt(((x%cc(i) - x_centroid)/a)**2 + ((cart_y - y_centroid)/b)**2 + ((cart_z &
560561 & - z_centroid)/c)**2) - 1._wp))*(-0.5_wp) + 0.5_wp
561562 end if
562563
@@ -688,7 +689,8 @@ contains
688689 do j = 0 , n
689690 do i = 0 , m
690691 if (patch_icpp(patch_id)%smoothen) then
691- eta = 5.e-1_wp + 5.e-1_wp * tanh (smooth_coeff/ min (dx, dy)* (a* x%cc(i) + b* y%cc(j) + c)/ sqrt (a** 2 + b** 2 ))
692+ eta = 5.e-1_wp + 5.e-1_wp * tanh (smooth_coeff/ min (x%min_spacing, &
693+ & y%min_spacing)* (a* x%cc(i) + b* y%cc(j) + c)/ sqrt (a** 2 + b** 2 ))
692694 end if
693695
694696 if ((a* x%cc(i) + b* y%cc(j) + c >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, &
@@ -878,7 +880,7 @@ contains
878880 end if
879881 end if
880882 if (patch_icpp(patch_id)%smoothen) then
881- eta = 0.5_wp + 0.5_wp * tanh (smooth_coeff/ min (dx, dy )* (R_boundary - r))
883+ eta = 0.5_wp + 0.5_wp * tanh (smooth_coeff/ min (x%min_spacing, y%min_spacing )* (R_boundary - r))
882884 end if
883885 if ((r <= R_boundary .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, 0 ))) .or. patch_id_fp(i, j, &
884886 & 0 ) == smooth_patch_id) then
@@ -940,7 +942,8 @@ contains
940942 end do
941943 end do
942944 if (patch_icpp(patch_id)%smoothen) then
943- eta_local = 0.5_wp + 0.5_wp * tanh (smooth_coeff/ min (dx, dy, dz)* (R_surface - r))
945+ eta_local = 0.5_wp + 0.5_wp * tanh (smooth_coeff/ min (x%min_spacing, y%min_spacing, &
946+ & z%min_spacing)* (R_surface - r))
944947 end if
945948 if ((r <= R_surface .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, k))) .or. patch_id_fp(i, j, &
946949 & k) == smooth_patch_id) then
@@ -998,9 +1001,9 @@ contains
9981001 end if
9991002
10001003 if (patch_icpp(patch_id)%smoothen) then
1001- eta = tanh(smooth_coeff/min(dx, dy , &
1002- & dz )*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2) &
1003- & - radius))*(-0.5_wp) + 0.5_wp
1004+ eta = tanh(smooth_coeff/min(x%min_spacing, y%min_spacing , &
1005+ & z%min_spacing )*(sqrt((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z &
1006+ & - z_centroid)**2) - radius))*(-0.5_wp) + 0.5_wp
10041007 end if
10051008
10061009 if ((((x%cc(i) - x_centroid)**2 + (cart_y - y_centroid)**2 + (cart_z - z_centroid)**2 <= radius**2) &
@@ -1146,17 +1149,17 @@ contains
11461149
11471150 if (patch_icpp(patch_id)%smoothen) then
11481151 if (.not. f_is_default(length_x)) then
1149- eta = tanh (smooth_coeff/ min (dy , &
1150- & dz )* (sqrt ((cart_y - y_centroid)** 2 + (cart_z - z_centroid)** 2 ) - radius)) * ( - 0.5_wp ) &
1151- & + 0.5_wp
1152+ eta = tanh (smooth_coeff/ min (y%min_spacing , &
1153+ & z%min_spacing )* (sqrt ((cart_y - y_centroid)** 2 + (cart_z - z_centroid)** 2 ) - radius)) &
1154+ & * ( - 0.5_wp ) + 0.5_wp
11521155 else if (.not. f_is_default(length_y)) then
1153- eta = tanh (smooth_coeff/ min (dx , &
1154- & dz )* (sqrt ((x%cc(i) - x_centroid)** 2 + (cart_z - z_centroid)** 2 ) - radius)) * ( - 0.5_wp ) &
1155- & + 0.5_wp
1156+ eta = tanh (smooth_coeff/ min (x%min_spacing , &
1157+ & z%min_spacing )* (sqrt ((x%cc(i) - x_centroid)** 2 + (cart_z - z_centroid)** 2 ) - radius)) &
1158+ & * ( - 0.5_wp ) + 0.5_wp
11561159 else
1157- eta = tanh (smooth_coeff/ min (dx , &
1158- & dy )* (sqrt ((x%cc(i) - x_centroid)** 2 + (cart_y - y_centroid)** 2 ) - radius)) * ( - 0.5_wp ) &
1159- & + 0.5_wp
1160+ eta = tanh (smooth_coeff/ min (x%min_spacing , &
1161+ & y%min_spacing )* (sqrt ((x%cc(i) - x_centroid)** 2 + (cart_y - y_centroid)** 2 ) - radius)) &
1162+ & * ( - 0.5_wp ) + 0.5_wp
11601163 end if
11611164 end if
11621165
@@ -1232,8 +1235,9 @@ contains
12321235 end if
12331236
12341237 if (patch_icpp(patch_id)%smoothen) then
1235- eta = 5.e-1_wp + 5.e-1_wp * tanh (smooth_coeff/ min (dx, dy, &
1236- & dz)* (a* x%cc(i) + b* cart_y + c* cart_z + d)/ sqrt (a** 2 + b** 2 + c** 2 ))
1238+ eta = 5.e-1_wp + 5.e-1_wp * tanh (smooth_coeff/ min (x%min_spacing, y%min_spacing, &
1239+ & z%min_spacing)* (a* x%cc(i) + b* cart_y + c* cart_z + d)/ sqrt (a** 2 + b** 2 &
1240+ & + c** 2 ))
12371241 end if
12381242
12391243 if ((a* x%cc(i) + b* cart_y + c* cart_z + d >= 0._wp .and. patch_icpp(patch_id)%alter_patch(patch_id_fp(i, j, &
@@ -1326,11 +1330,11 @@ contains
13261330 write (* , " (A, 3(2X, F20.10))" ) " > Cen:" , (bbox%min (1 :3 ) + bbox%max (1 :3 ))/ 2._wp
13271331 write (* , " (A, 3(2X, F20.10))" ) " > Max:" , bbox%max (1 :3 )
13281332
1329- grid_mm(1 ,:) = (/ minval (x%cc) - 0.e5_wp * dx , maxval (x%cc) + 0.e5_wp * dx / )
1330- grid_mm(2 ,:) = (/ minval (y%cc) - 0.e5_wp * dy , maxval (y%cc) + 0.e5_wp * dy / )
1333+ grid_mm(1 ,:) = (/ minval (x%cc) - 0.e5_wp * x%min_spacing , maxval (x%cc) + 0.e5_wp * x%min_spacing / )
1334+ grid_mm(2 ,:) = (/ minval (y%cc) - 0.e5_wp * y%min_spacing , maxval (y%cc) + 0.e5_wp * y%min_spacing / )
13311335
13321336 if (p > 0 ) then
1333- grid_mm(3 ,:) = (/ minval (z%cc) - 0.e5_wp * dz , maxval (z%cc) + 0.e5_wp * dz / )
1337+ grid_mm(3 ,:) = (/ minval (z%cc) - 0.e5_wp * z%min_spacing , maxval (z%cc) + 0.e5_wp * z%min_spacing / )
13341338 else
13351339 grid_mm(3 ,:) = (/ 0._wp , 0._wp / )
13361340 end if
@@ -1356,7 +1360,7 @@ contains
13561360 point = f_convert_cyl_to_cart(point)
13571361 end if
13581362
1359- eta = f_model_is_inside(model, point, (/ dx, dy, dz / ), patch_icpp(patch_id)%model_spc)
1363+ eta = f_model_is_inside(model, point, (/ x%min_spacing, y%min_spacing, z%min_spacing / ), patch_icpp(patch_id)%model_spc)
13601364
13611365 if (eta > patch_icpp(patch_id)%model_threshold) then
13621366 eta = 1._wp
0 commit comments