Skip to content

Commit 637c765

Browse files
committed
coordinate bounds updates
1 parent 2e42cc7 commit 637c765

File tree

4 files changed

+54
-98
lines changed

4 files changed

+54
-98
lines changed

src/common/m_helper_basic.f90

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module m_helper_basic
1212
public :: f_approx_equal, &
1313
f_is_default, &
1414
f_all_default, &
15-
f_is_integer
15+
f_is_integer, &
16+
s_configure_coordinate_bounds
1617

1718
contains
1819

@@ -74,4 +75,41 @@ logical function f_is_integer(var) result(res)
7475
res = f_approx_equal(var, real(nint(var), wp))
7576
end function f_is_integer
7677

78+
subroutine s_configure_coordinate_bounds(weno_polyn, buff_size, idwint, idwbuff, &
79+
viscous, bubbles_lagrange, m, n, p, num_dims)
80+
81+
integer, intent(in) :: weno_polyn, m, n, p, num_dims
82+
integer, intent(inout) :: buff_size
83+
type(int_bounds_info), dimension(3), intent(inout) :: idwint, idwbuff
84+
logical, intent(in) :: viscous, bubbles_lagrange
85+
86+
! Determining the number of cells that are needed in order to store
87+
! sufficient boundary conditions data as to iterate the solution in
88+
! the physical computational domain from one time-step iteration to
89+
! the next one
90+
if (viscous) then
91+
buff_size = 2*weno_polyn + 2
92+
else
93+
buff_size = weno_polyn + 2
94+
end if
95+
96+
! Correction for smearing function in the lagrangian subgrid bubble model
97+
if (bubbles_lagrange) then
98+
buff_size = max(buff_size, 6)
99+
end if
100+
101+
! Configuring Coordinate Direction Indexes
102+
idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
103+
idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
104+
105+
idwbuff(1)%beg = -buff_size
106+
if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
107+
if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
108+
109+
idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
110+
idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
111+
idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
112+
113+
end subroutine s_configure_coordinate_bounds
114+
77115
end module m_helper_basic

src/post_process/m_global_parameters.fpp

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,6 @@ module m_global_parameters
194194
type(bounds_info) :: x_output, y_output, z_output !< Portion of domain to output for post-processing
195195
type(int_bounds_info) :: x_output_idx, y_output_idx, z_output_idx !< Indices of domain to output for post-processing
196196

197-
!> @name Size of the ghost zone layer in the x-, y- and z-coordinate directions.
198-
!! The definition of the ghost zone layers is only necessary when using the
199-
!! Silo database file format in multidimensions. These zones provide VisIt
200-
!! with the subdomain connectivity information that it requires in order to
201-
!! produce smooth plots.
202-
!> @{
203-
type(int_bounds_info) :: offset_x, offset_y, offset_z
204-
!> @}
205-
206197
!> @name The list of all possible flow variables that may be written to a database
207198
!! file. It includes partial densities, density, momentum, velocity, energy,
208199
!! pressure, volume fraction(s), specific heat ratio function, specific heat
@@ -719,7 +710,6 @@ contains
719710
chemxe = species_idx%end
720711

721712
#ifdef MFC_MPI
722-
723713
if (bubbles_lagrange) then
724714
allocate (MPI_IO_DATA%view(1:sys_size + 1))
725715
allocate (MPI_IO_DATA%var(1:sys_size + 1))
@@ -739,35 +729,7 @@ contains
739729
if (ib) allocate (MPI_IO_IB_DATA%var%sf(0:m, 0:n, 0:p))
740730
#endif
741731

742-
! Size of the ghost zone layer is non-zero only when post-processing
743-
! the raw simulation data of a parallel multidimensional computation
744-
! in the Silo-HDF5 format. If this is the case, one must also verify
745-
! whether the raw simulation data is 2D or 3D. In the 2D case, size
746-
! of the z-coordinate direction ghost zone layer must be zeroed out.
747-
if (num_procs == 1 .or. format /= 1 .or. n == 0) then
748-
749-
offset_x%beg = 0
750-
offset_x%end = 0
751-
offset_y%beg = 0
752-
offset_y%end = 0
753-
offset_z%beg = 0
754-
offset_z%end = 0
755-
756-
elseif (p == 0) then
757-
758-
offset_z%beg = 0
759-
offset_z%end = 0
760-
761-
end if
762-
763-
! Determining the finite-difference number and the buffer size. Note
764-
! that the size of the buffer is unrelated to the order of the WENO
765-
! scheme. Rather, it is directly dependent on maximum size of ghost
766-
! zone layers and possibly the order of the finite difference scheme
767-
! used for the computation of vorticity and/or numerical Schlieren
768-
! function.
769-
buff_size = max(offset_x%beg, offset_x%end, offset_y%beg, &
770-
offset_y%end, offset_z%beg, offset_z%end)
732+
buff_size = 0
771733

772734
if (any(omega_wrt) .or. schlieren_wrt .or. qm_wrt) then
773735
fd_number = max(1, fd_order/2)
@@ -788,31 +750,31 @@ contains
788750

789751
! Allocating single precision grid variables if needed
790752
if (precision == 1) then
791-
allocate (x_cb_s(-1 - offset_x%beg:m + offset_x%end))
753+
allocate (x_cb_s(-1:m))
792754
if (n > 0) then
793-
allocate (y_cb_s(-1 - offset_x%beg:n + offset_x%end))
755+
allocate (y_cb_s(-1:n))
794756
if (p > 0) then
795-
allocate (z_cb_s(-1 - offset_x%beg:m + offset_x%end))
757+
allocate (z_cb_s(-1:m))
796758
end if
797759
end if
798760
else
799761
allocate (x_cc_s(-buff_size:m + buff_size))
800762
end if
801763

802764
! Allocating the grid variables in the x-coordinate direction
803-
allocate (x_cb(-1 - offset_x%beg:m + offset_x%end))
765+
allocate (x_cb(-1:m))
804766
allocate (x_cc(-buff_size:m + buff_size))
805767
allocate (dx(-buff_size:m + buff_size))
806768

807769
! Allocating grid variables in the y- and z-coordinate directions
808770
if (n > 0) then
809771

810-
allocate (y_cb(-1 - offset_y%beg:n + offset_y%end))
772+
allocate (y_cb(-1:n))
811773
allocate (y_cc(-buff_size:n + buff_size))
812774
allocate (dy(-buff_size:n + buff_size))
813775

814776
if (p > 0) then
815-
allocate (z_cb(-1 - offset_z%beg:p + offset_z%end))
777+
allocate (z_cb(-1:p))
816778
allocate (z_cc(-buff_size:p + buff_size))
817779
allocate (dz(-buff_size:p + buff_size))
818780
end if

src/pre_process/m_global_parameters.fpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -797,32 +797,10 @@ contains
797797
chemxb = species_idx%beg
798798
chemxe = species_idx%end
799799

800-
! Determining the number of cells that are needed in order to store
801-
! sufficient boundary conditions data as to iterate the solution in
802-
! the physical computational domain from one time-step iteration to
803-
! the next one
804-
if (viscous) then
805-
buff_size = 2*weno_polyn + 2
806-
else
807-
buff_size = weno_polyn + 2
808-
end if
809-
810-
! Correction for smearing function in the lagrangian subgrid bubble model
811-
if (bubbles_lagrange) then
812-
buff_size = max(buff_size, 6)
813-
end if
814-
815-
! Configuring Coordinate Direction Indexes
816-
idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
817-
idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
818-
819-
idwbuff(1)%beg = -buff_size
820-
if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
821-
if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
822-
823-
idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
824-
idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
825-
idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
800+
call s_configure_coordinate_bounds(weno_polyn, buff_size, &
801+
idwint, idwbuff, viscous, &
802+
bubbles_lagrange, m, n, p, &
803+
num_dims)
826804

827805
#ifdef MFC_MPI
828806

src/simulation/m_global_parameters.fpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,41 +1093,19 @@ contains
10931093
Np = 0
10941094
10951095
!$acc update device(Re_size)
1096-
! Determining the number of cells that are needed in order to store
1097-
! sufficient boundary conditions data as to iterate the solution in
1098-
! the physical computational domain from one time-step iteration to
1099-
! the next one
1100-
if (viscous) then
1101-
buff_size = 2*weno_polyn + 2
1102-
else
1103-
buff_size = weno_polyn + 2
1104-
end if
11051096
11061097
if (elasticity) then
11071098
fd_number = max(1, fd_order/2)
1108-
!buff_size = buff_size + fd_number
11091099
end if
11101100
11111101
if (probe_wrt) then
11121102
fd_number = max(1, fd_order/2)
11131103
end if
11141104
1115-
! Correction for smearing function in the lagrangian subgrid bubble model
1116-
if (bubbles_lagrange) then
1117-
buff_size = max(buff_size, 6)
1118-
end if
1119-
1120-
! Configuring Coordinate Direction Indexes
1121-
idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
1122-
idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
1123-
1124-
idwbuff(1)%beg = -buff_size
1125-
if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
1126-
if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
1127-
1128-
idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
1129-
idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
1130-
idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
1105+
call s_configure_coordinate_bounds(weno_polyn, buff_size, &
1106+
idwint, idwbuff, viscous, &
1107+
bubbles_lagrange, m, n, p, &
1108+
num_dims)
11311109
!$acc update device(idwint, idwbuff)
11321110
11331111
! Configuring Coordinate Direction Indexes

0 commit comments

Comments
 (0)