Skip to content

Commit fff74d8

Browse files
committed
add perturbed IC stuff
1 parent ca56a8f commit fff74d8

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

src/post_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ contains
110110
& 'lag_rvel_wrt', 'lag_r0_wrt', 'lag_rmax_wrt', 'lag_rmin_wrt', &
111111
& 'lag_dphidt_wrt', 'lag_pres_wrt', 'lag_mv_wrt', 'lag_mg_wrt', &
112112
& 'lag_betaT_wrt', 'lag_betaC_wrt', 'bc_io', 'down_sample' ]
113+
call MPI_BCAST(${VAR}$, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
113114
#:endfor
114115
115116
call MPI_BCAST(flux_wrt(1), 3, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)

src/pre_process/include/3dHardcodedIC.fpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,45 @@
77
! Case 302 - IGR Jet
88
real(wp) :: r, ux_th, ux_am, p_th, p_am, rho_th, rho_am, y_th, z_th, r_th, eps_smooth
99

10+
real(wp), allocatable, dimension(:, :) :: ih
11+
integer :: i, j, pos, start, end
12+
logical :: file_exist
13+
character(len=10000) :: line
14+
character(len=25) :: value
15+
16+
if (patch_icpp(patch_id)%hcid == 303) then
17+
allocate(ih(0:m_glb, 0:p_glb))
18+
19+
if (interface_file == '.') then
20+
call s_mpi_abort("Error: interface_file must be specified for hcid=303")
21+
else
22+
inquire (file=trim(interface_file), exist=file_exist)
23+
if (file_exist) then
24+
open(unit=10, file=trim(interface_file), status="old", action="read")
25+
do i = 0, m_glb
26+
read(10, '(A)') line ! Read a full line as a string
27+
start = 1
28+
29+
do j = 0, p_glb
30+
end = index(line(start:), ',') ! Find the next comma
31+
if (end == 0) then
32+
value = trim(adjustl(line(start:))) ! Last value in the line
33+
else
34+
value = trim(adjustl(line(start:start+end-2))) ! Extract substring
35+
start = start + end ! Move to next value
36+
end if
37+
read(value, *) ih(i, j) ! Convert string to numeric value
38+
if (.not. f_is_default(normMag)) ih(i,j )= ih(i,j) * normMag
39+
if (.not. f_is_default(normFac)) ih(i,j) = ih(i,j) + normFac
40+
end do
41+
end do
42+
close(10)
43+
else
44+
call s_mpi_abort("Error: interface_file specified for hcid=303 does not exist")
45+
end if
46+
end if
47+
end if
48+
1049
eps = 1e-9_wp
1150

1251
#:enddef
@@ -86,6 +125,23 @@
86125

87126
q_prim_vf(E_idx)%sf(i, j, k) = p_th*f_cut_on(r - r_th, eps_smooth)*f_cut_on(x_cc(i), eps_smooth) + p_am
88127

128+
case (303) ! 3D Interface from file
129+
130+
alph = 0.5_wp * (1 + (1._wp - 2._wp * eps) * &
131+
tanh((ih(start_idx(1) + i,start_idx(3) + k) - y_cc(j))*0.1_wp))
132+
133+
q_prim_vf(advxb)%sf(i,j,k) = alph
134+
q_prim_vf(advxe)%sf(i,j,k) = 1._wp - alph
135+
136+
q_prim_vf(contxb)%sf(i,j,k) = q_prim_vf(advxb)%sf(i,j,k) * 1._wp
137+
q_prim_vf(contxe)%sf(i,j,k) = q_prim_vf(advxe)%sf(i,j,k) * (1._wp / 950._wp)
138+
139+
q_prim_vf(E_idx)%sf(i,j,k) = p0 + &
140+
(q_prim_vf(contxb)%sf(i,j,k) + q_prim_vf(contxe)%sf(i,j,k)) * g0 * &
141+
(ih(start_idx(1) + i, start_idx(3) + k) - y_cc(j))
142+
143+
if (surface_tension) q_prim_vf(c_idx)%sf(i,j,k) = alph
144+
89145
case (370)
90146
! This hardcoded case extrudes a 2D profile to initialize a 3D simulation domain
91147
@: HardcodedReadValues()

src/pre_process/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ contains
7272
& 'perturb_flow_mag', 'pref', 'rhoref', 'poly_sigma', 'R0ref', &
7373
& 'Web', 'Ca', 'Re_inv', 'sigR', 'sigV', 'rhoRV', 'palpha_eps', &
7474
& 'ptgalpha_eps', 'sigma', 'pi_fac', 'mixlayer_vel_coef', 'Bx0', &
75-
& 'mixlayer_perturb_k0']
75+
& 'mixlayer_perturb_k0', 'normFac', 'normMag', 'p0', 'g0']
7676
call MPI_BCAST(${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
7777
#:endfor
7878

0 commit comments

Comments
 (0)