Skip to content

Commit c28be63

Browse files
committed
Debug Convergence and 1D cases
1 parent ff6a240 commit c28be63

13 files changed

Lines changed: 54 additions & 54 deletions

File tree

examples/2D_ibm_Thermal_Flatplate/case.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"cantera_file": ctfile,
5252
"chem_wrt_T": "T",
5353
"ib": "T",
54+
"fd_order": 2,
5455
"num_ibs": 1,
5556
"patch_icpp(1)%geometry": 3,
5657
"patch_icpp(1)%hcid": 291,
@@ -70,7 +71,7 @@
7071
"patch_ib(1)%length_y": Ly / 10,
7172
"patch_ib(1)%slip": "F",
7273
"patch_ib(1)%isothermal": "T",
73-
"patch_ib(1)%Twall": 600.0,
74+
"patch_ib(1)%twall": 600.0,
7475
"fluid_pp(1)%gamma": 1.0e00 / (1.4e00 - 1.0e00),
7576
"fluid_pp(1)%pi_inf": 0.0e00,
7677
"viscous": "T",

src/common/m_variables_conversion.fpp

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ module m_variables_conversion
4646
#endif
4747

4848
#ifndef MFC_SIMULATION
49-
! type(integer_field), public :: ghost_points_index
50-
! type(scalar_field), public :: pressure_ghost_point
51-
! $:GPU_DECLARE(create='[ghost_points_index, pressure_ghost_point]')
49+
type(integer_field), public :: ghost_points_index
50+
type(scalar_field), public :: pressure_ghost_point
51+
$:GPU_DECLARE(create='[ghost_points_index, pressure_ghost_point]')
5252
#else
53-
!! type(integer_field), public :: ghost_points_index
54-
! type(scalar_field), public :: pressure_ghost_point
55-
! $:GPU_DECLARE(create='[ghost_points_index, pressure_ghost_point]')
53+
type(integer_field), public :: ghost_points_index
54+
type(scalar_field), public :: pressure_ghost_point
55+
$:GPU_DECLARE(create='[ghost_points_index, pressure_ghost_point]')
5656
#endif
5757

5858
real(wp), allocatable, dimension(:) :: Gs_vc
@@ -372,23 +372,21 @@ contains
372372
$:GPU_UPDATE(device='[Res_vc, Re_idx, Re_size]')
373373
end if
374374

375-
! if (chemistry) then
376-
! if (p > 0) then
377-
! @:ALLOCATE(ghost_points_index%sf(0:m, 0:n, 0:p))
378-
! @:ALLOCATE(pressure_ghost_point%sf(0:m, 0:n, 0:p))
379-
! else if (n > 0) then
380-
!! @:ALLOCATE(ghost_points_index%sf(0:m, 0:n, 0:0))
381-
! @:ALLOCATE(pressure_ghost_point%sf(0:m, 0:n, 0:0))
382-
! else ! 1D
383-
!! @:ALLOCATE(ghost_points_index%sf(0:m, 0:0, 0:0))
384-
! @:ALLOCATE(pressure_ghost_point%sf(0:m, 0:0, 0:0))
385-
! end if
386-
! ghost_points_index%sf = 0
387-
! pressure_ghost_point%sf = 0.0_wp
388-
389-
! @:ACC_SETUP_SFs(ghost_points_index)
390-
! @:ACC_SETUP_SFs(pressure_ghost_point)
391-
! end if
375+
if (p > 0) then
376+
@:ALLOCATE(ghost_points_index%sf(-buff_size:m+buff_size, -buff_size:n+buff_size, -buff_size:p+buff_size))
377+
@:ALLOCATE(pressure_ghost_point%sf(-buff_size:m+buff_size, -buff_size:n+buff_size, -buff_size:p+buff_size))
378+
else if (n > 0) then
379+
@:ALLOCATE(ghost_points_index%sf(-buff_size:m+buff_size, -buff_size:n+buff_size, 0:0))
380+
@:ALLOCATE(pressure_ghost_point%sf(-buff_size:m+buff_size, -buff_size:n+buff_size, 0:0))
381+
else ! 1D
382+
@:ALLOCATE(ghost_points_index%sf(-buff_size:m+buff_size, 0:0, 0:0))
383+
@:ALLOCATE(pressure_ghost_point%sf(-buff_size:m+buff_size, 0:0, 0:0))
384+
end if
385+
ghost_points_index%sf = 0
386+
pressure_ghost_point%sf = 0._wp
387+
388+
@:ACC_SETUP_SFs(ghost_points_index)
389+
@:ACC_SETUP_SFs(pressure_ghost_point)
392390
#endif
393391

394392
if (bubbles_euler) then
@@ -705,15 +703,15 @@ contains
705703
& pi_inf_K, gamma_K, rho_K, qv_K, rhoYks, pres, T, pres_mag=pres_mag)
706704

707705
#ifdef MFC_SIMULATION
708-
!if (chemistry) then
709-
! if (n > 0 ) then
710-
! if (.not. (t_step == 0 .and. stage == 1)) then
711-
! if (ghost_points_index%sf(j, k, l) == 1) then
712-
! pres = pressure_ghost_point%sf(j, k, l)
713-
! end if
714-
! end if
715-
! end if
716-
! end if
706+
if (chemistry) then
707+
if (n > 0) then
708+
if (.not. (t_step == 0 .and. stage == 1)) then
709+
if (ghost_points_index%sf(j, k, l) == 1) then
710+
pres = pressure_ghost_point%sf(j, k, l)
711+
end if
712+
end if
713+
end if
714+
end if
717715
#endif
718716

719717
qK_prim_vf(eqn_idx%E)%sf(j, k, l) = pres
@@ -1275,8 +1273,8 @@ contains
12751273

12761274
#ifdef MFC_SIMULATION
12771275
@:DEALLOCATE(gammas, gs_min, pi_infs, ps_inf, cvs, qvs, qvps, Gs_vc)
1278-
! @:DEALLOCATE(ghost_points_index%sf)
1279-
! @:DEALLOCATE(pressure_ghost_point%sf)
1276+
@:DEALLOCATE(ghost_points_index%sf)
1277+
@:DEALLOCATE(pressure_ghost_point%sf)
12801278
if (bubbles_euler) then
12811279
@:DEALLOCATE(bubrs_vc)
12821280
end if

src/pre_process/m_check_ib_patches.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ contains
8181

8282
if (.not. patch_ib(patch_id)%isothermal) return
8383

84-
@:PROHIBIT(f_is_default(patch_ib(patch_id)%Twall) .or. patch_ib(patch_id)%Twall <= 0._wp, &
85-
& 'in immersed boundary patch ' // trim(iStr) // ': patch_ib('//trim(iStr)//')%Twall must be set and > 0')
84+
@:PROHIBIT(f_is_default(patch_ib(patch_id)%twall) .or. patch_ib(patch_id)%twall <= 0._wp, &
85+
& 'in immersed boundary patch ' // trim(iStr) // ': patch_ib('//trim(iStr)//')%twall must be set and > 0')
8686

8787
end subroutine s_check_ib_patch_thermal
8888

@@ -247,7 +247,7 @@ contains
247247
& .or. (.not. f_is_default(patch_ib(patch_id)%z_centroid)) &
248248
& .or. (.not. f_is_default(patch_ib(patch_id)%length_x)) .or. (.not. f_is_default(patch_ib(patch_id)%length_y)) &
249249
& .or. (.not. f_is_default(patch_ib(patch_id)%length_z)) .or. (.not. f_is_default(patch_ib(patch_id)%radius)) &
250-
& .or. patch_ib(patch_id)%isothermal .or. (.not. f_is_default(patch_ib(patch_id)%Twall)), &
250+
& .or. patch_ib(patch_id)%isothermal .or. (.not. f_is_default(patch_ib(patch_id)%twall)), &
251251
& 'in inactive IB patch ' // trim(iStr))
252252

253253
end subroutine s_check_inactive_ib_patch_geometry

src/pre_process/m_global_parameters.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ contains
306306
patch_ib(i)%model_id = 0
307307
patch_ib(i)%slip = .false.
308308
patch_ib(i)%isothermal = .false.
309-
patch_ib(i)%Twall = dflt_real
309+
patch_ib(i)%twall = dflt_real
310310

311311
! Variables to handle moving immersed boundaries, defaulting to no movement
312312
patch_ib(i)%moving_ibm = 0

src/pre_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ contains
125125
call MPI_BCAST(patch_ib(i)%geometry, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
126126

127127
#:for VAR in [ 'x_centroid', 'y_centroid', 'z_centroid', &
128-
& 'length_x', 'length_y', 'length_z', 'radius', 'Twall']
128+
& 'length_x', 'length_y', 'length_z', 'radius', 'twall']
129129
call MPI_BCAST(patch_ib(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
130130
#:endfor
131131
call MPI_BCAST(patch_ib(i)%airfoil_id, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)

src/simulation/m_global_parameters.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ contains
590590
patch_ib(i)%model_id = 0
591591
patch_ib(i)%slip = .false.
592592
patch_ib(i)%isothermal = .false.
593-
patch_ib(i)%Twall = dflt_real
593+
patch_ib(i)%twall = dflt_real
594594

595595
! Variables to handle moving immersed boundaries, defaulting to no movement
596596
patch_ib(i)%moving_ibm = 0

src/simulation/m_ibm.fpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ contains
216216

217217
if (p > 0) then
218218
! Parallel loop or simple assignment if compiler supports it Typically simpler to just do:
219-
! ghost_points_index%sf = 0
219+
ghost_points_index%sf = 0
220220
else
221-
! ghost_points_index%sf(0:m,0:n,0:0) = 0
221+
ghost_points_index%sf(0:m,0:n,0:0) = 0
222222
end if
223223

224224
if (num_gps > 0) then
@@ -233,7 +233,7 @@ contains
233233
l = gp%loc(3)
234234
patch_id = ghost_points(i)%ib_patch_id
235235

236-
! ghost_points_index%sf(j, k, l) = 1
236+
ghost_points_index%sf(j, k, l) = 1
237237

238238
! Calculate physical location of GP
239239
if (p > 0) then
@@ -274,7 +274,7 @@ contains
274274
end if
275275

276276
if (patch_ib(patch_id)%isothermal) then
277-
T_GP = 2.0_wp*patch_ib(patch_id)%Twall - T_IP
277+
T_GP = 2.0_wp*patch_ib(patch_id)%twall - T_IP
278278
else
279279
T_GP = T_IP
280280
end if
@@ -287,7 +287,7 @@ contains
287287
! set the pressure
288288
if (patch_ib(patch_id)%moving_ibm <= 1) then
289289
q_prim_vf(eqn_idx%E)%sf(j, k, l) = pres_IP
290-
! pressure_ghost_point%sf(j, k, l) = pres_IP
290+
pressure_ghost_point%sf(j, k, l) = pres_IP
291291
else
292292
q_prim_vf(eqn_idx%E)%sf(j, k, l) = 0._wp
293293
$:GPU_LOOP(parallelism='[seq]')

src/simulation/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ contains
123123
! manual: patch_ib (sim member subset differs from pre; uses count=3, adds mass/moving_ibm)
124124
do i = 1, num_ibs
125125
#:for VAR in [ 'radius', 'length_x', 'length_y', 'length_z', &
126-
& 'x_centroid', 'y_centroid', 'z_centroid', 'slip', 'mass', 'Twall']
126+
& 'x_centroid', 'y_centroid', 'z_centroid', 'slip', 'mass', 'twall']
127127
call MPI_BCAST(patch_ib(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
128128
#:endfor
129129
#:for VAR in ['vel', 'angular_vel', 'angles']

toolchain/mfc/case_validator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,10 +1545,10 @@ def check_chemistry(self):
15451545
not chemistry or not diffusion, f"Isothermal immersed boundary patch_ib({patch_id})%isothermal requires both chemistry='T' and chem_params%diffusion='T' to calculate heat conduction."
15461546
)
15471547

1548-
twall = self.get(f"patch_ib({patch_id})%Twall")
1549-
self.prohibit(twall is None, f"Isothermal immersed boundary patch_ib({patch_id})%isothermal requires patch_ib({patch_id})%Twall to be set.")
1548+
twall = self.get(f"patch_ib({patch_id})%twall")
1549+
self.prohibit(twall is None, f"Isothermal immersed boundary patch_ib({patch_id})%isothermal requires patch_ib({patch_id})%twall to be set.")
15501550
if twall is not None and self._is_numeric(twall):
1551-
self.prohibit(twall <= 0.0, f"Wall temperature patch_ib({patch_id})%Twall must be strictly positive for thermodynamics (got {twall}).")
1551+
self.prohibit(twall <= 0.0, f"Wall temperature patch_ib({patch_id})%twall must be strictly positive for thermodynamics (got {twall}).")
15521552

15531553
def check_misc_pre_process(self):
15541554
"""Checks miscellaneous pre-process constraints"""

toolchain/mfc/params/definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ def _load():
894894
_ib_attrs: Dict[str, tuple] = {}
895895
for a in ["geometry", "moving_ibm", "airfoil_id", "model_id"]:
896896
_ib_attrs[a] = (INT, _ib_tags)
897-
for a, pt in [("radius", REAL), ("slip", LOG), ("mass", REAL), ("Twall", REAL), ("isothermal", LOG)]:
897+
for a, pt in [("radius", REAL), ("slip", LOG), ("mass", REAL), ("twall", REAL), ("isothermal", LOG)]:
898898
_ib_attrs[a] = (pt, _ib_tags)
899899
for j in range(1, 4):
900900
_ib_attrs[f"angles({j})"] = (REAL, _ib_tags)

0 commit comments

Comments
 (0)