Skip to content

Commit 143f6d3

Browse files
committed
Fisrt implementation for the 1D axisymmetric spherical coordinates
1 parent 340414b commit 143f6d3

15 files changed

+125
-18
lines changed

src/common/m_checker_common.fpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ contains
187187
@:PROHIBIT(n < 0)
188188
@:PROHIBIT(p < 0)
189189
@:PROHIBIT(cyl_coord .and. p > 0 .and. mod(p, 2) /= 1, "p must be odd for cylindrical coordinates")
190+
@:PROHIBIT(sph_coord .and. m /= 1 .and. p > 0, "m must not be different than 1 and p not greater than 0 for axysimmetric spherical coordinates")
190191
@:PROHIBIT(n == 0 .and. p > 0, "p must be 0 if n = 0")
191192
end subroutine s_check_inputs_simulation_domain
192193

@@ -250,10 +251,14 @@ contains
250251

251252
! Check for y and z directions for cylindrical coordinates
252253
@: PROHIBIT(cyl_coord .and. n == 0, "n must be positive (2D or 3D) for cylindrical coordinates")
254+
@: PROHIBIT(sph_coord .and. m /= 1, "m must be one (1D) for axysimmetric spherical coordinates")
253255
@: PROHIBIT(cyl_coord .and. p == 0 .and. bc_y%beg /= -2, "bc_y%beg must be -2 for 2D cylindrical coordinates (p = 0)")
256+
@: PROHIBIT(sph_coord .and. p == 0 .and. bc_y%beg /= -2, "bc_y%beg must be -2 axysimmetric spherical coordinates (p = 0)")
254257
@: PROHIBIT(cyl_coord .and. p > 0 .and. bc_y%beg /= -14, "bc_y%beg must be -14 for 3D cylindrical coordinates (p > 0)")
255258
@: PROHIBIT(cyl_coord .and. (bc_y%end > -1 .or. bc_y%end < -16), "bc_y%end must be between -1 and -16")
259+
@: PROHIBIT(sph_coord .and. (bc_y%end > -1 .or. bc_y%end < -16), "bc_y%end must be between -1 and -16")
256260
@: PROHIBIT(cyl_coord .and. bc_y%end == -14, "bc_y%end must not be -14")
261+
@: PROHIBIT(sph_coord .and. (bc_y%end == -2 .or. bc_y%end == -14), "bc_y%end must not be -2 or -14")
257262

258263
! Check for y and z directions for 3D cylindrical coordinates
259264
@: PROHIBIT(cyl_coord .and. p > 0 .and. (bc_z%beg /= -1 .and. bc_z%beg /= -2), &

src/post_process/m_global_parameters.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module m_global_parameters
4343
!> @name Cylindrical coordinates (either axisymmetric or full 3D)
4444
!> @{
4545
logical :: cyl_coord
46+
logical :: sph_coord
4647
integer :: grid_geometry
4748
!> @}
4849

@@ -318,6 +319,7 @@ contains
318319
m = dflt_int; n = 0; p = 0
319320
m_root = dflt_int
320321
cyl_coord = .false.
322+
sph_coord = .false.
321323

322324
t_step_start = dflt_int
323325
t_step_stop = dflt_int
@@ -834,7 +836,7 @@ contains
834836

835837
if (cyl_coord .neqv. .true.) then ! Cartesian grid
836838
grid_geometry = 1
837-
elseif (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
839+
elseif ((cyl_coord .or. sph_coord) .and. p == 0) then ! Axisymmetric cylindrical grid
838840
grid_geometry = 2
839841
else ! Fully 3D cylindrical grid
840842
grid_geometry = 3

src/post_process/m_mpi_proxy.fpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ contains
168168
& 'prim_vars_wrt', 'c_wrt', 'qm_wrt','schlieren_wrt', 'bubbles_euler', 'qbmm', &
169169
& 'polytropic', 'polydisperse', 'file_per_process', 'relax', 'cf_wrt', &
170170
& 'adv_n', 'ib', 'cfl_adap_dt', 'cfl_const_dt', 'cfl_dt', &
171-
& 'surface_tension', 'hyperelasticity', 'bubbles_lagrange', 'rkck_adap_dt', 'output_partial_domain']
171+
& 'surface_tension', 'hyperelasticity', 'bubbles_lagrange', 'rkck_adap_dt', 'output_partial_domain', &
172+
& 'sph_coord']
172173
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
173174
#:endfor
174175

src/post_process/m_start_up.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ subroutine s_read_input_file
8484
relax_model, cf_wrt, sigma, adv_n, ib, num_ibs, &
8585
cfl_adap_dt, cfl_const_dt, t_save, t_stop, n_start, &
8686
cfl_target, surface_tension, bubbles_lagrange, rkck_adap_dt, &
87-
sim_data, hyperelasticity
87+
sim_data, hyperelasticity, sph_coord
8888

8989
! Inquiring the status of the post_process.inp file
9090
file_loc = 'post_process.inp'

src/pre_process/m_check_patches.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ contains
158158
@:PROHIBIT(patch_icpp(patch_id)%length_x <= 0._wp, "Line segment patch "//trim(iStr)//": length_x must be greater than zero")
159159
@:PROHIBIT(f_is_default(patch_icpp(patch_id)%x_centroid), "Line segment patch "//trim(iStr)//": x_centroid must be set")
160160
@:PROHIBIT(cyl_coord, "Line segment patch "//trim(iStr)//": cyl_coord is not supported")
161+
@:PROHIBIT(sph_coord, "Line segment patch "//trim(iStr)//": sph_coord is not supported")
161162

162163
end subroutine s_check_line_segment_patch_geometry
163164

src/pre_process/m_checker.fpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ contains
9494
@:PROHIBIT(cyl_coord .and. p > 0 .and. (z_domain%beg /= 0._wp .or. z_domain%end /= 2._wp*pi), &
9595
"z_domain%beg must be 0 and z_domain%end must be 2*pi for 3D cylindrical coordinates")
9696

97+
@:PROHIBIT(sph_coord .and. n == 0, &
98+
"n must be positive for 1D axisymmetric spherical coordinates")
99+
@:PROHIBIT(sph_coord .and. (f_is_default(y_domain%beg) .or. f_is_default(y_domain%end)), &
100+
"y_domain%beg and y_domain%end must be set for n > 0 (1D axisymmetric spherical coordinates)")
101+
@:PROHIBIT(sph_coord .and. (y_domain%beg /= 0._wp .or. y_domain%end <= 0._wp), &
102+
"y_domain%beg must be 0 and y_domain%end must be positive for 1D axisymmetric spherical coordinates")
103+
@:PROHIBIT(sph_coord .and. p == 0 .and. ((.not. f_is_default(z_domain%beg)) .or. (.not. f_is_default(z_domain%end))), &
104+
"z_domain%beg and z_domain%end are not supported for p = 0 (1D spherical coordinates)")
105+
@:PROHIBIT(sph_coord .and. p > 0 &
106+
"only 1D axisymmetric (m = 1, n > 0, p = 0) is supported with spherical coordinates")
107+
97108
@:PROHIBIT(num_patches < 0)
98109
@:PROHIBIT(num_patches == 0 .and. t_step_old == dflt_int, &
99110
"num_patches must be positive for the non-restart case")

src/pre_process/m_global_parameters.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module m_global_parameters
4747
integer :: num_dims !< Number of spatial dimensions
4848

4949
logical :: cyl_coord
50+
logical :: sph_coord
5051
integer :: grid_geometry !< Cylindrical coordinates (either axisymmetric or full 3D)
5152

5253
real(wp), allocatable, dimension(:) :: x_cc, y_cc, z_cc !<
@@ -275,6 +276,7 @@ contains
275276
m = dflt_int; n = 0; p = 0
276277

277278
cyl_coord = .false.
279+
sph_coord = .false.
278280

279281
x_domain%beg = dflt_real
280282
x_domain%end = dflt_real
@@ -828,7 +830,7 @@ contains
828830

829831
if (cyl_coord .neqv. .true.) then ! Cartesian grid
830832
grid_geometry = 1
831-
elseif (cyl_coord .and. p == 0) then ! Axisymmetric cylindrical grid
833+
elseif ((cyl_coord .or. sph_coord) .and. p == 0) then ! Axisymmetric cylindrical grid
832834
grid_geometry = 2
833835
else ! Fully 3D cylindrical grid
834836
grid_geometry = 3

src/pre_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ contains
5555
& 'mixlayer_perturb', 'bubbles_euler', 'polytropic', 'polydisperse',&
5656
& 'qbmm', 'file_per_process', 'adv_n', 'ib' , 'cfl_adap_dt', &
5757
& 'cfl_const_dt', 'cfl_dt', 'surface_tension', &
58-
& 'hyperelasticity', 'pre_stress' ]
58+
& 'hyperelasticity', 'pre_stress', 'sph_coord']
5959
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
6060
#:endfor
6161
call MPI_BCAST(fluid_rho(1), num_fluids_max, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)

src/pre_process/m_start_up.fpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ contains
140140
file_per_process, relax, relax_model, &
141141
palpha_eps, ptgalpha_eps, ib, num_ibs, patch_ib, &
142142
sigma, adv_n, cfl_adap_dt, cfl_const_dt, n_start, &
143-
n_start_old, surface_tension, hyperelasticity, pre_stress, rkck_adap_dt
143+
n_start_old, surface_tension, hyperelasticity, pre_stress, rkck_adap_dt, &
144+
sph_coord
144145

145146
! Inquiring the status of the pre_process.inp file
146147
file_loc = 'pre_process.inp'

src/simulation/m_cbc.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ contains
901901
end if
902902
903903
! Be careful about the cylindrical coordinate!
904-
if (cyl_coord .and. cbc_dir == 2 .and. cbc_loc == 1) then
904+
if ((cyl_coord .or. sph_coord) .and. cbc_dir == 2 .and. cbc_loc == 1) then
905905
dpres_dt = -5e-1_wp*(L(advxe) + L(1)) + rho*c*c*vel(dir_idx(1)) &
906906
/y_cc(n)
907907
else
@@ -929,7 +929,7 @@ contains
929929
end do
930930
931931
! The treatment of void fraction source is unclear
932-
if (cyl_coord .and. cbc_dir == 2 .and. cbc_loc == 1) then
932+
if ((cyl_coord .or. sph_coord) .and. cbc_dir == 2 .and. cbc_loc == 1) then
933933
!$acc loop seq
934934
do i = 1, advxe - E_idx
935935
dadv_dt(i) = -L(momxe + i) !+ adv(i) * vel(dir_idx(1))/y_cc(n)

0 commit comments

Comments
 (0)