|
7 | 7 | ! Case 302 - IGR Jet |
8 | 8 | real(wp) :: r, ux_th, ux_am, p_th, p_am, rho_th, rho_am, y_th, z_th, r_th, eps_smooth |
9 | 9 |
|
| 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 | + |
10 | 49 | eps = 1e-9_wp |
11 | 50 |
|
12 | 51 | #:enddef |
|
86 | 125 |
|
87 | 126 | 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 |
88 | 127 |
|
| 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 | + |
89 | 145 | case (370) |
90 | 146 | ! This hardcoded case extrudes a 2D profile to initialize a 3D simulation domain |
91 | 147 | @: HardcodedReadValues() |
|
0 commit comments