Skip to content

Commit 620c471

Browse files
perturb parameter (#252)
Co-authored-by: RasmitDevkota <[email protected]> Co-authored-by: Rasmit Devkota <[email protected]>
1 parent 523d83d commit 620c471

File tree

9 files changed

+29
-16
lines changed

9 files changed

+29
-16
lines changed

docs/documentation/case.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,18 +505,24 @@ Implementation of the parameterse into the model follow [Ando (2010)](references
505505
| Parameter | Type | Description |
506506
| ---: | :----: | :--- |
507507
| `perturb_flow` | Logical | Perturb the initlal velocity field by random noise |
508+
| `perturb_flow_fluid` | Integer | Fluid density whose flow is to be perturbed |
509+
| `perturb_flow_mag` | Real | Set the magnitude of flow perturbations |
508510
| `perturb_sph` | Logical | Perturb the initial partial density by random noise |
509-
| `perturb_sph_fluid` | Integer | Fluid component whose partial density to be perturbed |
511+
| `perturb_sph_fluid` | Integer | Fluid component whose partial density is to be perturbed |
510512
| `vel_profile` | Logical | Set the mean streamwise velocity to hyperbolic tangent profile |
511513
| `instability_wave` | Logical | Perturb the initial velocity field by instability waves |
512514

513515
The table lists velocity field parameters. The parameters are optionally used to define initial velocity profiles and perturbations.
514516

515517
- `perturb_flow` activates the perturbation of initial velocity by random noise.
516518

517-
- `perturb_sph` activates the perturbation of intial partial density by random noise.
519+
- `perturb_flow_fluid` specifies the fluid component whose flow is to be perturbed.
518520

519-
- `perturb_sph_fluid` specifies the fluid component whose the partial density to be perturbed.
521+
- `perturb_flow` activates the perturbation of initial velocity by random noise.
522+
523+
- `perturb_sph` activates the perturbation of initial partial density by random noise.
524+
525+
- `perturb_sph_fluid` specifies the fluid component whose partial density is to be perturbed.
520526

521527
- `vel_profile` activates setting the mean streamwise velocity to hyperbolic tangent profile. This option works only for 2D and 3D cases.
522528

src/pre_process/m_check_patches.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ contains
302302

303303
end subroutine s_check_2D_TaylorGreen_vortex_patch_geometry! --------------
304304

305+
305306
!> This subroutine verifies that the geometric parameters of
306307
!! the analytical patch have consistently been inputted by
307308
!! the user.

src/pre_process/m_checker.f90

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,15 @@ subroutine s_check_inputs()
543543
call s_mpi_abort('Unsupported choice for the value of '// &
544544
'num_patches. Exiting ...')
545545
! Constraints on perturbing the initial condition
546-
elseif ((perturb_flow .and. perturb_flow_fluid == dflt_int) &
546+
elseif ((perturb_flow &
547+
.and. &
548+
(perturb_flow_fluid == dflt_int .or. perturb_flow_mag == dflt_real)) &
547549
.or. &
548-
((perturb_flow .neqv. .true.) .and. (perturb_flow_fluid /= dflt_int))) then
550+
((perturb_flow .neqv. .true.) &
551+
.and. &
552+
(perturb_flow_fluid /= dflt_int .or. perturb_flow_mag /= dflt_real))) then
549553
call s_mpi_abort('Unsupported choice of the combination of '// &
550-
'values for perturb_flow and perturb_flow_fluid. '// &
554+
'values for perturb_flow, perturb_flow_fluid, and perturb_flow_mag. '// &
551555
'Exiting ...')
552556
elseif ((perturb_flow_fluid > num_fluids) &
553557
.or. &

src/pre_process/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ module m_global_parameters
103103
! Perturb density of surrounding air so as to break symmetry of grid
104104
logical :: perturb_flow
105105
integer :: perturb_flow_fluid !< Fluid to be perturbed with perturb_flow flag
106+
real(kind(0d0)) :: perturb_flow_mag !< Magnitude of perturbation with perturb_flow flag
106107
logical :: perturb_sph
107108
integer :: perturb_sph_fluid !< Fluid to be perturbed with perturb_sph flag
108109
real(kind(0d0)), dimension(num_fluids_max) :: fluid_rho
@@ -254,6 +255,7 @@ contains
254255
instability_wave = .false.
255256
perturb_flow = .false.
256257
perturb_flow_fluid = dflt_int
258+
perturb_flow_mag = dflt_real
257259
perturb_sph = .false.
258260
perturb_sph_fluid = dflt_int
259261
fluid_rho = dflt_real

src/pre_process/m_initial_condition.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ contains
324324
! q_prim_vf(perturb_flow_fluid)%sf(i,j,k) = q_prim_vf(perturb_flow_fluid)%sf(i,j,k) + rand_real
325325
! Perturb velocity
326326
call random_number(rand_real)
327-
rand_real = rand_real*1.d-2
327+
rand_real = rand_real*perturb_flow_mag
328328
q_prim_vf(mom_idx%beg)%sf(i, j, k) = (1.d0 + rand_real)*q_prim_vf(mom_idx%beg)%sf(i, j, k)
329329
q_prim_vf(mom_idx%end)%sf(i, j, k) = rand_real*q_prim_vf(mom_idx%beg)%sf(i, j, k)
330330
if (bubbles) then

src/pre_process/m_mpi_proxy.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ contains
6565
& 'y_domain%end', 'z_domain%beg', 'z_domain%end', 'a_x', 'a_y', &
6666
& 'a_z', 'x_a', 'x_b', 'y_a', 'y_b', 'z_a', 'z_b', 'bc_x%beg', &
6767
& 'bc_x%end', 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', &
68-
& 'pref', 'rhoref', 'poly_sigma', 'R0ref', 'Web', 'Ca', 'Re_inv', &
69-
& 'sigR', 'sigV', 'rhoRV' ]
68+
& 'perturb_flow_mag', 'pref', 'rhoref', 'poly_sigma', 'R0ref', &
69+
& 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV' ]
7070
call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
7171
#:endfor
7272

src/pre_process/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ contains
115115
weno_order, bc_x, bc_y, bc_z, num_patches, &
116116
hypoelasticity, patch_icpp, fluid_pp, &
117117
precision, parallel_io, vel_profile, instability_wave, &
118-
perturb_flow, perturb_flow_fluid, &
118+
perturb_flow, perturb_flow_fluid, perturb_flow_mag, &
119119
perturb_sph, perturb_sph_fluid, fluid_rho, &
120120
cyl_coord, loops_x, loops_y, loops_z, &
121121
rhoref, pref, bubbles, R0ref, nb, &

src/simulation/m_rhs.fpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ contains
845845
! ===============================================================
846846

847847
if (alt_soundspeed) then
848-
!$acc parallel loop collapse(3) gang vector default(present)
848+
!$acc parallel loop collapse(3) gang vector default(present)
849849
do l = 0, p
850850
do k = 0, n
851851
do j = 0, m
@@ -1037,7 +1037,7 @@ contains
10371037
end do
10381038
end do
10391039
else
1040-
!$acc parallel loop collapse(3) gang vector default(present)
1040+
!$acc parallel loop collapse(3) gang vector default(present)
10411041
do l = 0, p
10421042
do k = 0, n
10431043
do j = 0, m
@@ -1132,7 +1132,7 @@ contains
11321132
end do
11331133
!Non-polytropic qbmm needs to account for change in bubble radius due to a change in nb
11341134
if(qbmm .and. (.not. polytropic) ) then
1135-
!$acc parallel loop collapse(5) gang vector default(present) private(nb_q, nR, nR2, R, R2, nb_dot, nR_dot, nR2_dot, var)
1135+
!$acc parallel loop collapse(5) gang vector default(present) private(nb_q, nR, nR2, R, R2, nb_dot, nR_dot, nR2_dot, var)
11361136
do i = 1, nb
11371137
do q = 1, nnode
11381138
do l = 0, p
@@ -1256,7 +1256,7 @@ contains
12561256
end if
12571257
end do
12581258
else
1259-
!$acc parallel loop collapse(4) gang vector default(present)
1259+
!$acc parallel loop collapse(4) gang vector default(present)
12601260
do j = advxb, advxe
12611261
do l = 0, p
12621262
do k = 0, n
@@ -2363,4 +2363,4 @@ contains
23632363

23642364
end subroutine s_finalize_rhs_module ! ---------------------------------
23652365

2366-
end module m_rhs
2366+
end module m_rhs

toolchain/mfc/run/case_dicts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
PRE_PROCESS = COMMON + [
1515
'old_grid', 'old_ic', 't_step_old', 't_step_start', 'vel_profile',
16-
'instability_wave', 'perturb_flow', 'perturb_flow_fluid',
16+
'instability_wave', 'perturb_flow', 'perturb_flow_fluid', 'perturb_flow_mag',
1717
'perturb_sph', 'perturb_sph_fluid', 'fluid_rho', 'num_patches', 'qbmm',
1818
'dist_type', 'R0_type', 'sigR', 'sigV', 'rhoRV'
1919
]

0 commit comments

Comments
 (0)