Skip to content

Commit 33f8547

Browse files
authored
Merge pull request #150 from haochey/master
2 parents a27ef39 + 740cf39 commit 33f8547

File tree

6 files changed

+304
-4
lines changed

6 files changed

+304
-4
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python3
2+
3+
import math
4+
import json
5+
6+
gam_a = 1.4
7+
8+
# Dimension of the Vortex
9+
l = 1.0
10+
L = math.pi*l
11+
import json
12+
13+
# Configuring case dictionary
14+
print(json.dumps({
15+
# Logistics ================================================
16+
'run_time_info' : 'T',
17+
# ==========================================================
18+
19+
# Computational Domain Parameters ==========================
20+
# Periodic Domain from -pi*l to pi*l
21+
'x_domain%beg' : -L,
22+
'x_domain%end' : L,
23+
'y_domain%beg' : -L,
24+
'y_domain%end' : L,
25+
'm' : 199,
26+
'n' : 199,
27+
'p' : 0,
28+
'dt' : 1.0E-08,
29+
't_step_start' : 0,
30+
't_step_stop' : 10000,
31+
't_step_save' : 100,
32+
# ==========================================================
33+
34+
# Simulation Algorithm Parameters ==========================
35+
'num_patches' : 1,
36+
'model_eqns' : 2,
37+
'alt_soundspeed' : 'F',
38+
'num_fluids' : 1,
39+
'adv_alphan' : 'T',
40+
'mpp_lim' : 'F',
41+
'mixture_err' : 'T',
42+
'time_stepper' : 3,
43+
'weno_order' : 5,
44+
'weno_eps' : 1.E-16,
45+
'mapped_weno' : 'T',
46+
'null_weights' : 'F',
47+
'mp_weno' : 'F',
48+
'weno_Re_flux' : 'T',
49+
'riemann_solver' : 2,
50+
'wave_speeds' : 1,
51+
'avg_state' : 2,
52+
'bc_x%beg' : -1,
53+
'bc_x%end' : -1,
54+
'bc_y%beg' : -1,
55+
'bc_y%end' : -1,
56+
# ==========================================================
57+
58+
# Formatted Database Files Structure Parameters ============
59+
'format' : 1,
60+
'precision' : 2,
61+
'prim_vars_wrt' :'T',
62+
'parallel_io' :'T',
63+
# ==========================================================
64+
65+
# Patch 1: Base ============================================
66+
# Uncomment the configuration of the Taylor Green Vortex in
67+
# 2D analytical patch under m_patch.f90
68+
'patch_icpp(1)%geometry' : 20,
69+
'patch_icpp(1)%x_centroid' : 0.0,
70+
'patch_icpp(1)%y_centroid' : 0.0,
71+
'patch_icpp(1)%length_x' : 2.0*L,
72+
'patch_icpp(1)%length_y' : 2.0*L,
73+
'patch_icpp(1)%vel(1)' : 1.E-01, # Define the characteristic velocity of the vortex
74+
'patch_icpp(1)%vel(2)' : 1.E+00, # Define the characteristic length of the vortex
75+
'patch_icpp(1)%pres' : 1.E+05,
76+
'patch_icpp(1)%alpha_rho(1)' : 1.22,
77+
'patch_icpp(1)%alpha(1)' : 1.,
78+
# ==========================================================
79+
80+
81+
# Fluids Physical Parameters ===============================
82+
'fluid_pp(1)%gamma' : 1.E+00/(gam_a-1.E+00),
83+
'fluid_pp(1)%pi_inf' : 0.0,
84+
# Shear viscosity of STD air
85+
'fluid_pp(1)%Re(1)' : 0.0001,
86+
# ==========================================================
87+
}))
88+
# ==============================================================================

src/common/m_derived_types.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ module m_derived_types
106106
real(kind(0d0)) :: gamma
107107
real(kind(0d0)) :: pi_inf !<
108108

109+
109110
!! Primitive variables associated with the patch. In order, these include
110111
!! the partial densities, density, velocity, pressure, volume fractions,
111112
!! specific heat ratio function and the liquid stiffness function.

src/pre_process/m_assign_variables.f90

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ subroutine s_assign_patch_species_primitive_variables_bubbles(patch_id, j, k, l,
238238
real(kind(0d0)) :: orig_pi_inf
239239
real(kind(0d0)) :: muR, muV
240240

241+
real(kind(0d0)), dimension(int(E_idx - mom_idx%beg)) :: vel !< velocity
242+
real(kind(0d0)) :: pres !< pressure
243+
real(kind(0d0)) :: x_centroid, y_centroid
244+
real(kind(0d0)) :: epsilon, beta
245+
241246
real(kind(0d0)), dimension(sys_size) :: orig_prim_vf !<
242247
!! Vector to hold original values of cell for smoothing purposes
243248

@@ -557,6 +562,47 @@ subroutine s_assign_patch_species_primitive_variables_bubbles(patch_id, j, k, l,
557562
end if
558563
end do
559564
end if
565+
566+
if (patch_icpp(patch_id)%geometry == 6) then
567+
x_centroid = patch_icpp(patch_id)%x_centroid
568+
y_centroid = patch_icpp(patch_id)%y_centroid
569+
epsilon = patch_icpp(patch_id)%epsilon
570+
beta = patch_icpp(patch_id)%beta
571+
572+
! Reference density, velocity, pressure and specific heat ratio
573+
! function of the isentropic vortex patch
574+
rho = patch_icpp(patch_id)%rho
575+
vel = patch_icpp(patch_id)%vel
576+
pres = patch_icpp(patch_id)%pres
577+
gamma = patch_icpp(patch_id)%gamma
578+
579+
! Density
580+
q_prim_vf(1)%sf(j, k, 0) = &
581+
rho*(1d0 - (rho/pres)*(epsilon/(2d0*pi))* &
582+
(epsilon/(8d0*beta*(gamma + 1d0)*pi))* &
583+
exp(2d0*beta*(1d0 - (x_cc(j) - x_centroid)**2 &
584+
- (y_cc(k) - y_centroid)**2)) &
585+
)**gamma
586+
587+
! Velocity
588+
q_prim_vf(2)%sf(j, k, 0) = &
589+
vel(1) - (y_cc(k) - y_centroid)*(epsilon/(2d0*pi))* &
590+
exp(beta*(1d0 - (x_cc(j) - x_centroid)**2 &
591+
- (y_cc(k) - y_centroid)**2))
592+
q_prim_vf(3)%sf(j, k, 0) = &
593+
vel(2) + (x_cc(j) - x_centroid)*(epsilon/(2d0*pi))* &
594+
exp(beta*(1d0 - (x_cc(j) - x_centroid)**2 &
595+
- (y_cc(k) - y_centroid)**2))
596+
597+
! Pressure
598+
q_prim_vf(4)%sf(j, k, 0) = &
599+
pres*(1d0 - (rho/pres)*(epsilon/(2d0*pi))* &
600+
(epsilon/(8d0*beta*(gamma + 1d0)*pi))* &
601+
exp(2d0*beta*(1d0 - (x_cc(j) - x_centroid)**2 &
602+
- (y_cc(k) - y_centroid)**2)) &
603+
)**(gamma + 1d0)
604+
605+
end if
560606

561607
! Updating the patch identities bookkeeping variable
562608
if (1d0 - eta < 1d-16) patch_id_fp(j, k, l) = patch_id
@@ -585,6 +631,7 @@ subroutine s_assign_patch_species_primitive_variables(patch_id, j, k, l, &
585631
integer, intent(INOUT), dimension(0:m, 0:n, 0:p) :: patch_id_fp
586632
type(scalar_field), dimension(1:sys_size) :: q_prim_vf
587633
real(kind(0d0)) :: eta !<
634+
588635
integer, intent(IN) :: j, k, l
589636

590637
real(kind(0d0)) :: rho
@@ -597,6 +644,11 @@ subroutine s_assign_patch_species_primitive_variables(patch_id, j, k, l, &
597644
!! function, respectively, obtained from the combination of primitive
598645
!! variables of the current and smoothing patches
599646

647+
real(kind(0d0)), dimension(int(E_idx - mom_idx%beg)) :: vel !< velocity
648+
real(kind(0d0)) :: pres !< pressure
649+
real(kind(0d0)) :: x_centroid, y_centroid
650+
real(kind(0d0)) :: epsilon, beta
651+
600652
real(kind(0d0)), dimension(sys_size) :: orig_prim_vf !<
601653
! Vector to hold original values of cell for smoothing purposes
602654

@@ -713,6 +765,47 @@ subroutine s_assign_patch_species_primitive_variables(patch_id, j, k, l, &
713765
q_prim_vf(i)%sf(j, k, l) = q_prim_vf(E_idx)%sf(j, k, l)
714766
end do
715767
end if
768+
769+
if (patch_icpp(patch_id)%geometry == 6) then
770+
x_centroid = patch_icpp(patch_id)%x_centroid
771+
y_centroid = patch_icpp(patch_id)%y_centroid
772+
epsilon = patch_icpp(patch_id)%epsilon
773+
beta = patch_icpp(patch_id)%beta
774+
775+
! Reference density, velocity, pressure and specific heat ratio
776+
! function of the isentropic vortex patch
777+
rho = patch_icpp(patch_id)%rho
778+
vel = patch_icpp(patch_id)%vel
779+
pres = patch_icpp(patch_id)%pres
780+
gamma = patch_icpp(patch_id)%gamma
781+
782+
! Density
783+
q_prim_vf(1)%sf(j, k, 0) = &
784+
rho*(1d0 - (rho/pres)*(epsilon/(2d0*pi))* &
785+
(epsilon/(8d0*beta*(gamma + 1d0)*pi))* &
786+
exp(2d0*beta*(1d0 - (x_cc(j) - x_centroid)**2 &
787+
- (y_cc(k) - y_centroid)**2)) &
788+
)**gamma
789+
790+
! Velocity
791+
q_prim_vf(2)%sf(j, k, 0) = &
792+
vel(1) - (y_cc(k) - y_centroid)*(epsilon/(2d0*pi))* &
793+
exp(beta*(1d0 - (x_cc(j) - x_centroid)**2 &
794+
- (y_cc(k) - y_centroid)**2))
795+
q_prim_vf(3)%sf(j, k, 0) = &
796+
vel(2) + (x_cc(j) - x_centroid)*(epsilon/(2d0*pi))* &
797+
exp(beta*(1d0 - (x_cc(j) - x_centroid)**2 &
798+
- (y_cc(k) - y_centroid)**2))
799+
800+
! Pressure
801+
q_prim_vf(4)%sf(j, k, 0) = &
802+
pres*(1d0 - (rho/pres)*(epsilon/(2d0*pi))* &
803+
(epsilon/(8d0*beta*(gamma + 1d0)*pi))* &
804+
exp(2d0*beta*(1d0 - (x_cc(j) - x_centroid)**2 &
805+
- (y_cc(k) - y_centroid)**2)) &
806+
)**(gamma + 1d0)
807+
808+
end if
716809

717810
! Updating the patch identities bookkeeping variable
718811
if (1d0 - eta < 1d-16) patch_id_fp(j, k, l) = patch_id

src/pre_process/m_check_patches.fpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ contains
7878
print *, '2d var circle'
7979
elseif (patch_icpp(i)%geometry == 19) then
8080
print *, '3d var circle'
81+
elseif (patch_icpp(i)%geometry == 20) then
82+
call s_check_2D_TaylorGreen_vortex_patch_geometry(i)
8183
else
8284
call s_mpi_abort('Unsupported choice of the '// &
8385
'geometry of active patch '//trim(iStr)//&
@@ -292,6 +294,36 @@ contains
292294

293295
end subroutine s_check_isentropic_vortex_patch_geometry ! --------------
294296

297+
!> This subroutine verifies that the geometric parameters of
298+
!! the Taylor Green vortex patch have been entered by the user
299+
!! consistently.
300+
!! @param patch_id Patch identifier
301+
subroutine s_check_2D_TaylorGreen_vortex_patch_geometry(patch_id) ! --------
302+
303+
integer, intent(IN) :: patch_id
304+
call s_int_to_str(patch_id, iStr)
305+
306+
! Constraints on the TaylorGreen vortex patch geometric parameters
307+
if (n == 0 .or. p > 0 &
308+
.or. &
309+
patch_icpp(patch_id)%x_centroid == dflt_real &
310+
.or. &
311+
patch_icpp(patch_id)%y_centroid == dflt_real &
312+
.or. &
313+
patch_icpp(patch_id)%length_x <= 0d0 &
314+
.or. &
315+
patch_icpp(patch_id)%length_y <= 0d0 &
316+
.or. &
317+
patch_icpp(patch_id)%vel(2)<= 0d0) then
318+
319+
call s_mpi_abort('Inconsistency(ies) detected in '// &
320+
'geometric parameters of Taylor Green '// &
321+
'vortex patch '//trim(iStr)//'. Exiting ...')
322+
323+
end if
324+
325+
end subroutine s_check_2D_TaylorGreen_vortex_patch_geometry! --------------
326+
295327
!> This subroutine verifies that the geometric parameters of
296328
!! the analytical patch have consistently been inputted by
297329
!! the user.

src/pre_process/m_initial_condition.fpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ contains
184184
elseif (patch_icpp(i)%geometry == 18) then
185185
call s_varcircle(i, patch_id_fp, q_prim_vf)
186186

187+
! TaylorGreen vortex patch
188+
elseif (patch_icpp(i)%geometry == 20) then
189+
call s_2D_TaylorGreen_vortex(i, patch_id_fp, q_prim_vf)
190+
187191
end if
188192

189193
end do

0 commit comments

Comments
 (0)