Skip to content

Commit ab22596

Browse files
committed
add elliptic smoothing
1 parent d863869 commit ab22596

File tree

10 files changed

+679
-24
lines changed

10 files changed

+679
-24
lines changed

docs/documentation/case.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ These physical parameters must be consistent with fluid material's parameters de
269269

270270
- `model_spc` and `model_threshold` are ray-tracing parameters. `model_spc` defines the number of rays per cell to render the model. `model_threshold` defines the ray-tracing threshold at which the cell is marked as the model.
271271

272+
#### Elliptic Smoothing
273+
274+
Initial conditions in which not all patches support the `patch_icpp(j)%smoothen` parameter can still be smoothed by applying iterations of the heat equation to the initial condition.
275+
This is enabled by adding `'elliptic_smoothing': "T",` and `'elliptic_smoothing_iters': N,` to the case dictionary, where `N` is the number of smoothing iterations to apply.
276+
272277
### 4. Immersed Boundary Patches
273278

274279
| Parameter | Type | Description |

src/common/m_variables_conversion.fpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -746,14 +746,14 @@ contains
746746

747747
type(scalar_field), dimension(sys_size), intent(in) :: qK_cons_vf
748748

749-
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: mv
749+
real(wp), dimension(idwint(1)%beg:, idwint(2)%beg:, idwint(3)%beg:, 1:, 1:), intent(inout) :: mv
750750

751751
integer :: i, j, k, l
752752
real(wp) :: mu, sig, nbub_sc
753753

754-
do l = idwbuff(3)%beg, idwbuff(3)%end
755-
do k = idwbuff(2)%beg, idwbuff(2)%end
756-
do j = idwbuff(1)%beg, idwbuff(1)%end
754+
do l = idwint(3)%beg, idwint(3)%end
755+
do k = idwint(2)%beg, idwint(2)%end
756+
do j = idwint(1)%beg, idwint(1)%end
757757

758758
nbub_sc = qK_cons_vf(bubxb)%sf(j, k, l)
759759

@@ -778,15 +778,15 @@ contains
778778
subroutine s_initialize_pb(qK_cons_vf, mv, pb)
779779
type(scalar_field), dimension(sys_size), intent(in) :: qK_cons_vf
780780

781-
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(in) :: mv
782-
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb
781+
real(wp), dimension(idwint(1)%beg:, idwint(2)%beg:, idwint(3)%beg:, 1:, 1:), intent(in) :: mv
782+
real(wp), dimension(idwint(1)%beg:, idwint(2)%beg:, idwint(3)%beg:, 1:, 1:), intent(inout) :: pb
783783

784784
integer :: i, j, k, l
785785
real(wp) :: mu, sig, nbub_sc
786786

787-
do l = idwbuff(3)%beg, idwbuff(3)%end
788-
do k = idwbuff(2)%beg, idwbuff(2)%end
789-
do j = idwbuff(1)%beg, idwbuff(1)%end
787+
do l = idwint(3)%beg, idwint(3)%end
788+
do k = idwint(2)%beg, idwint(2)%end
789+
do j = idwint(1)%beg, idwint(1)%end
790790

791791
nbub_sc = qK_cons_vf(bubxb)%sf(j, k, l)
792792

src/pre_process/m_checker.fpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ contains
192192
@:PROHIBIT(mixlayer_perturb .and. num_fluids > 1, "mixlayer_perturb requires num_fluids = 1")
193193
@:PROHIBIT(mixlayer_perturb .and. any((/bc_y%beg, bc_y%end/) /= -6), &
194194
"mixlayer_perturb requires both bc_y%beg and bc_y%end to be 6")
195+
@:PROHIBIT(elliptic_smoothing .and. elliptic_smoothing_iters < 1, &
196+
"elliptic_smoothing_iters must be positive")
197+
195198
end subroutine s_check_inputs_misc
196199

197200
end module m_checker

src/pre_process/m_global_parameters.fpp

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ module m_global_parameters
8282
integer :: num_fluids !< Number of different fluids present in the flow
8383
logical :: mpp_lim !< Alpha limiter
8484
integer :: sys_size !< Number of unknowns in the system of equations
85+
integer :: weno_polyn !< Degree of the WENO polynomials (polyn)
8586
integer :: weno_order !< Order of accuracy for the WENO reconstruction
8687
logical :: hypoelasticity !< activate hypoelasticity
8788
logical :: hyperelasticity !< activate hyperelasticity
@@ -130,6 +131,9 @@ module m_global_parameters
130131

131132
real(wp) :: pi_fac !< Factor for artificial pi_inf
132133

134+
logical :: viscous
135+
logical :: bubbles_lagrange
136+
133137
! Perturb density of surrounding air so as to break symmetry of grid
134138
logical :: perturb_flow
135139
integer :: perturb_flow_fluid !< Fluid to be perturbed with perturb_flow flag
@@ -138,6 +142,9 @@ module m_global_parameters
138142
integer :: perturb_sph_fluid !< Fluid to be perturbed with perturb_sph flag
139143
real(wp), dimension(num_fluids_max) :: fluid_rho
140144

145+
logical :: elliptic_smoothing
146+
integer :: elliptic_smoothing_iters
147+
141148
integer, allocatable, dimension(:) :: proc_coords !<
142149
!! Processor coordinates in MPI_CART_COMM
143150

@@ -248,6 +255,12 @@ module m_global_parameters
248255
type(pres_field) :: pb
249256
type(pres_field) :: mv
250257

258+
integer :: buff_size !<
259+
!! The number of cells that are necessary to be able to store enough boundary
260+
!! conditions data to march the solution in the physical computational domain
261+
!! to the next time-step.
262+
263+
251264
contains
252265

253266
!> Assigns default values to user inputs prior to reading
@@ -328,6 +341,8 @@ contains
328341
parallel_io = .false.
329342
file_per_process = .false.
330343
precision = 2
344+
viscous = .false.
345+
bubbles_lagrange = .false.
331346
mixlayer_vel_profile = .false.
332347
mixlayer_vel_coef = 1._wp
333348
mixlayer_domain = 1._wp
@@ -338,6 +353,8 @@ contains
338353
perturb_sph = .false.
339354
perturb_sph_fluid = dflt_int
340355
fluid_rho = dflt_real
356+
elliptic_smoothing_iters = dflt_int
357+
elliptic_smoothing = .false.
341358

342359
! Initial condition parameters
343360
num_patches = dflt_int
@@ -497,6 +514,8 @@ contains
497514

498515
integer :: i, j, fac
499516

517+
weno_polyn = (weno_order - 1)/2
518+
500519
! Determining the layout of the state vectors and overall size of
501520
! the system of equations, given the dimensionality and choice of
502521
! the equations of motion
@@ -779,12 +798,32 @@ contains
779798
chemxb = species_idx%beg
780799
chemxe = species_idx%end
781800

801+
! Determining the number of cells that are needed in order to store
802+
! sufficient boundary conditions data as to iterate the solution in
803+
! the physical computational domain from one time-step iteration to
804+
! the next one
805+
if (viscous) then
806+
buff_size = 2*weno_polyn + 2
807+
else
808+
buff_size = weno_polyn + 2
809+
end if
810+
811+
! Correction for smearing function in the lagrangian subgrid bubble model
812+
if (bubbles_lagrange) then
813+
buff_size = max(buff_size, 6)
814+
end if
815+
782816
! Configuring Coordinate Direction Indexes
783817
idwint(1)%beg = 0; idwint(2)%beg = 0; idwint(3)%beg = 0
784818
idwint(1)%end = m; idwint(2)%end = n; idwint(3)%end = p
785819

786-
! There is no buffer region in pre_process.
787-
idwbuff(1) = idwint(1); idwbuff(2) = idwint(2); idwbuff(3) = idwint(3)
820+
idwbuff(1)%beg = -buff_size
821+
if (num_dims > 1) then; idwbuff(2)%beg = -buff_size; else; idwbuff(2)%beg = 0; end if
822+
if (num_dims > 2) then; idwbuff(3)%beg = -buff_size; else; idwbuff(3)%beg = 0; end if
823+
824+
idwbuff(1)%end = idwint(1)%end - idwbuff(1)%beg
825+
idwbuff(2)%end = idwint(2)%end - idwbuff(2)%beg
826+
idwbuff(3)%end = idwint(3)%end - idwbuff(3)%beg
788827

789828
#ifdef MFC_MPI
790829

src/pre_process/m_initial_condition.fpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ contains
7575
allocate (q_cons_vf(1:sys_size))
7676

7777
do i = 1, sys_size
78-
allocate (q_prim_vf(i)%sf(0:m, 0:n, 0:p))
78+
allocate (q_prim_vf(i)%sf(idwbuff(1)%beg:idwbuff(1)%end, &
79+
idwbuff(2)%beg:idwbuff(2)%end, &
80+
idwbuff(3)%beg:idwbuff(3)%end))
7981
allocate (q_cons_vf(i)%sf(0:m, 0:n, 0:p))
8082
end do
8183

@@ -133,15 +135,15 @@ contains
133135
character(len=10) :: iStr
134136

135137
! First, compute the temperature field from the conservative variables.
136-
if (chemistry) call s_compute_q_T_sf(q_T_sf, q_cons_vf, idwbuff)
138+
if (chemistry) call s_compute_q_T_sf(q_T_sf, q_cons_vf, idwint)
137139

138140
! Converting the conservative variables to the primitive ones given
139141
! preexisting initial condition data files were read in on start-up
140142
if (old_ic) then
141143
call s_convert_conservative_to_primitive_variables(q_cons_vf, &
142144
q_T_sf, &
143145
q_prim_vf, &
144-
idwbuff)
146+
idwint)
145147
end if
146148

147149
! 3D Patch Geometries
@@ -337,6 +339,7 @@ contains
337339
if (perturb_flow) call s_perturb_surrounding_flow(q_prim_vf)
338340
if (perturb_sph) call s_perturb_sphere(q_prim_vf)
339341
if (mixlayer_perturb) call s_superposition_instability_wave(q_prim_vf)
342+
if (elliptic_smoothing) call s_elliptic_smoothing(q_prim_vf)
340343

341344
! Converting the primitive variables to the conservative ones
342345
call s_convert_primitive_to_conservative_variables(q_prim_vf, q_cons_vf)

0 commit comments

Comments
 (0)