Skip to content

Commit

Permalink
perturb parameter (#252)
Browse files Browse the repository at this point in the history
Co-authored-by: RasmitDevkota <[email protected]>
Co-authored-by: Rasmit Devkota <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2023
1 parent 523d83d commit 620c471
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 16 deletions.
12 changes: 9 additions & 3 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,18 +505,24 @@ Implementation of the parameterse into the model follow [Ando (2010)](references
| Parameter | Type | Description |
| ---: | :----: | :--- |
| `perturb_flow` | Logical | Perturb the initlal velocity field by random noise |
| `perturb_flow_fluid` | Integer | Fluid density whose flow is to be perturbed |
| `perturb_flow_mag` | Real | Set the magnitude of flow perturbations |
| `perturb_sph` | Logical | Perturb the initial partial density by random noise |
| `perturb_sph_fluid` | Integer | Fluid component whose partial density to be perturbed |
| `perturb_sph_fluid` | Integer | Fluid component whose partial density is to be perturbed |
| `vel_profile` | Logical | Set the mean streamwise velocity to hyperbolic tangent profile |
| `instability_wave` | Logical | Perturb the initial velocity field by instability waves |

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

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

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

- `perturb_sph_fluid` specifies the fluid component whose the partial density to be perturbed.
- `perturb_flow` activates the perturbation of initial velocity by random noise.

- `perturb_sph` activates the perturbation of initial partial density by random noise.

- `perturb_sph_fluid` specifies the fluid component whose partial density is to be perturbed.

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

Expand Down
1 change: 1 addition & 0 deletions src/pre_process/m_check_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ contains

end subroutine s_check_2D_TaylorGreen_vortex_patch_geometry! --------------


!> This subroutine verifies that the geometric parameters of
!! the analytical patch have consistently been inputted by
!! the user.
Expand Down
10 changes: 7 additions & 3 deletions src/pre_process/m_checker.f90
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,15 @@ subroutine s_check_inputs()
call s_mpi_abort('Unsupported choice for the value of '// &
'num_patches. Exiting ...')
! Constraints on perturbing the initial condition
elseif ((perturb_flow .and. perturb_flow_fluid == dflt_int) &
elseif ((perturb_flow &
.and. &
(perturb_flow_fluid == dflt_int .or. perturb_flow_mag == dflt_real)) &
.or. &
((perturb_flow .neqv. .true.) .and. (perturb_flow_fluid /= dflt_int))) then
((perturb_flow .neqv. .true.) &
.and. &
(perturb_flow_fluid /= dflt_int .or. perturb_flow_mag /= dflt_real))) then
call s_mpi_abort('Unsupported choice of the combination of '// &
'values for perturb_flow and perturb_flow_fluid. '// &
'values for perturb_flow, perturb_flow_fluid, and perturb_flow_mag. '// &
'Exiting ...')
elseif ((perturb_flow_fluid > num_fluids) &
.or. &
Expand Down
2 changes: 2 additions & 0 deletions src/pre_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ module m_global_parameters
! Perturb density of surrounding air so as to break symmetry of grid
logical :: perturb_flow
integer :: perturb_flow_fluid !< Fluid to be perturbed with perturb_flow flag
real(kind(0d0)) :: perturb_flow_mag !< Magnitude of perturbation with perturb_flow flag
logical :: perturb_sph
integer :: perturb_sph_fluid !< Fluid to be perturbed with perturb_sph flag
real(kind(0d0)), dimension(num_fluids_max) :: fluid_rho
Expand Down Expand Up @@ -254,6 +255,7 @@ contains
instability_wave = .false.
perturb_flow = .false.
perturb_flow_fluid = dflt_int
perturb_flow_mag = dflt_real
perturb_sph = .false.
perturb_sph_fluid = dflt_int
fluid_rho = dflt_real
Expand Down
2 changes: 1 addition & 1 deletion src/pre_process/m_initial_condition.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ contains
! q_prim_vf(perturb_flow_fluid)%sf(i,j,k) = q_prim_vf(perturb_flow_fluid)%sf(i,j,k) + rand_real
! Perturb velocity
call random_number(rand_real)
rand_real = rand_real*1.d-2
rand_real = rand_real*perturb_flow_mag
q_prim_vf(mom_idx%beg)%sf(i, j, k) = (1.d0 + rand_real)*q_prim_vf(mom_idx%beg)%sf(i, j, k)
q_prim_vf(mom_idx%end)%sf(i, j, k) = rand_real*q_prim_vf(mom_idx%beg)%sf(i, j, k)
if (bubbles) then
Expand Down
4 changes: 2 additions & 2 deletions src/pre_process/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ contains
& 'y_domain%end', 'z_domain%beg', 'z_domain%end', 'a_x', 'a_y', &
& 'a_z', 'x_a', 'x_b', 'y_a', 'y_b', 'z_a', 'z_b', 'bc_x%beg', &
& 'bc_x%end', 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', &
& 'pref', 'rhoref', 'poly_sigma', 'R0ref', 'Web', 'Ca', 'Re_inv', &
& 'sigR', 'sigV', 'rhoRV' ]
& 'perturb_flow_mag', 'pref', 'rhoref', 'poly_sigma', 'R0ref', &
& 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV' ]
call MPI_BCAST(${VAR}$, 1, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
#:endfor
Expand Down
2 changes: 1 addition & 1 deletion src/pre_process/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ contains
weno_order, bc_x, bc_y, bc_z, num_patches, &
hypoelasticity, patch_icpp, fluid_pp, &
precision, parallel_io, vel_profile, instability_wave, &
perturb_flow, perturb_flow_fluid, &
perturb_flow, perturb_flow_fluid, perturb_flow_mag, &
perturb_sph, perturb_sph_fluid, fluid_rho, &
cyl_coord, loops_x, loops_y, loops_z, &
rhoref, pref, bubbles, R0ref, nb, &
Expand Down
10 changes: 5 additions & 5 deletions src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ contains
! ===============================================================

if (alt_soundspeed) then
!$acc parallel loop collapse(3) gang vector default(present)
!$acc parallel loop collapse(3) gang vector default(present)
do l = 0, p
do k = 0, n
do j = 0, m
Expand Down Expand Up @@ -1037,7 +1037,7 @@ contains
end do
end do
else
!$acc parallel loop collapse(3) gang vector default(present)
!$acc parallel loop collapse(3) gang vector default(present)
do l = 0, p
do k = 0, n
do j = 0, m
Expand Down Expand Up @@ -1132,7 +1132,7 @@ contains
end do
!Non-polytropic qbmm needs to account for change in bubble radius due to a change in nb
if(qbmm .and. (.not. polytropic) ) then
!$acc parallel loop collapse(5) gang vector default(present) private(nb_q, nR, nR2, R, R2, nb_dot, nR_dot, nR2_dot, var)
!$acc parallel loop collapse(5) gang vector default(present) private(nb_q, nR, nR2, R, R2, nb_dot, nR_dot, nR2_dot, var)
do i = 1, nb
do q = 1, nnode
do l = 0, p
Expand Down Expand Up @@ -1256,7 +1256,7 @@ contains
end if
end do
else
!$acc parallel loop collapse(4) gang vector default(present)
!$acc parallel loop collapse(4) gang vector default(present)
do j = advxb, advxe
do l = 0, p
do k = 0, n
Expand Down Expand Up @@ -2363,4 +2363,4 @@ contains

end subroutine s_finalize_rhs_module ! ---------------------------------

end module m_rhs
end module m_rhs
2 changes: 1 addition & 1 deletion toolchain/mfc/run/case_dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

PRE_PROCESS = COMMON + [
'old_grid', 'old_ic', 't_step_old', 't_step_start', 'vel_profile',
'instability_wave', 'perturb_flow', 'perturb_flow_fluid',
'instability_wave', 'perturb_flow', 'perturb_flow_fluid', 'perturb_flow_mag',
'perturb_sph', 'perturb_sph_fluid', 'fluid_rho', 'num_patches', 'qbmm',
'dist_type', 'R0_type', 'sigR', 'sigV', 'rhoRV'
]
Expand Down

0 comments on commit 620c471

Please sign in to comment.