Skip to content

Commit 7f36706

Browse files
committed
1 parent 177d461 commit 7f36706

File tree

4 files changed

+78
-35
lines changed

4 files changed

+78
-35
lines changed

docs/pages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pages = ["index.md",
22
"Performance" => "features/performance.md",
33
"Best practices" => "features/best-practices.md",
4-
"User inputs" => "tutorials/user_inputs.md"
4+
"User inputs" => "tutorials/user_inputs.md",
55
"Tutorials" => "tutorials/theta.md"
66
]

problems/equations/CompEuler/vortex/initialize.jl

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@ function initialize(SD::NSD_2D, PT, mesh::St_mesh, inputs::Dict, OUTPUT_DIR::Str
1313
#---------------------------------------------------------------------------------
1414
qvars = ("ρ", "ρu", "ρv", "ρe")
1515
q = define_q(SD, mesh.nelem, mesh.npoin, mesh.ngl, qvars, TFloat, inputs[:backend]; neqs=length(qvars))
16-
mycase = "the"
1716
#---------------------------------------------------------------------------------
1817
PhysConst = PhysicalConst{Float64}()
18+
19+
20+
mycase = "vor"
21+
Rair = PhysConst.Rair
22+
cv = PhysConst.cv
23+
γ = PhysConst.γ
24+
γinv = 1.0/γ
25+
γm1 = γ - 1.0
26+
γm1inv = 1.0/γm1
27+
γstar = γ*γm1inv
28+
1929
if inputs[:lrestart] == true
2030
#
2131
# READ RESTART HDF5:
@@ -38,33 +48,59 @@ function initialize(SD::NSD_2D, PT, mesh::St_mesh, inputs::Dict, OUTPUT_DIR::Str
3848

3949
else
4050
if mycase=="vor"
51+
52+
# base flow
53+
xc, yc = SVector(0.0, 0.0)
54+
4155
#
4256
# INITIAL STATE from scratch:
4357
#
44-
Tc = 5.0
58+
if inputs[:case] == "shu" #Shu
59+
60+
αdeg = 45.0
61+
Minf = sqrt(2.0/γ)
62+
ρinf = 1.0
63+
pinf = 1.0
64+
Tinf = 1.0
65+
R = 1.0
66+
σ = 1.0
67+
β = Minf*5.0*sqrt(2.0)/(4π)*exp(0.5)
68+
L = 5.0
69+
70+
elseif inputs[:case] == "vincent" #vincent
71+
72+
αdeg = 90.0
73+
Minf = 0.4
74+
ρinf = 1.0
75+
pinf = 1.0/*Minf*Minf)
76+
Tinf = 1.0
77+
R = 1.5
78+
σ = 1.0
79+
β = Minf*27.0/(4π)*exp(2.0/9.0)
80+
L = 20.0
81+
82+
elseif inputs[:case] == "hw" #Hesthaven and Warburton
83+
84+
αdeg = 0.0
85+
Minf = sqrt(1.0/γ)
86+
ρinf = 1.0
87+
pinf = 1.0
88+
Tinf = 1.0
89+
R = 0.7071067811865476
90+
σ = 1.0
91+
β = Minf*5.0/(2π)*exp(1.0)
92+
L = 5.0
93+
end
4594

46-
# base flow
47-
xc, yc = SVector(0.0, 0.0)
48-
49-
Rair = PhysConst.Rair
50-
cv = PhysConst.cv
51-
γ = PhysConst.γ
52-
γinv = 1.0/γ
53-
γm1 = γ - 1.0
54-
γm1inv = 1.0/γm1
55-
γstar = γ*γm1inv
56-
Minf = sqrt(1.0/γ)
57-
β = Minf*2.5/π
58-
σ = 1.0
59-
σ2 = σ*σ
60-
R = 0.7071067811865476
95+
α = αdeg*π/180.0
96+
MinfCos = Minf*cos(α)
97+
MinfSin = Minf*sin(α)
6198
R2 = R*R
99+
σ2 = σ*σ
62100
oneOverR = 1.0/R
63101
Const = -0.5/(σ2*R2)
64102
g = 1.0/- 1.0)
65-
α = 0.0
66-
MinfCos = Minf*cos(α)
67-
MinfSin = Minf*sin(α)
103+
Tc = 5.0
68104

69105
for ip = 1:mesh.npoin
70106

@@ -73,15 +109,15 @@ function initialize(SD::NSD_2D, PT, mesh::St_mesh, inputs::Dict, OUTPUT_DIR::Str
73109
f = Const*( (x - xc)^2 + (y - yc)^2 )
74110
Ω = β*exp(f)
75111

76-
du =0.0# -y*Ω*oneOverR
77-
dv =0.0# x*Ω*oneOverR
78-
dT =0.0# -0.5*γm1*Ω^2
112+
du = -y*Ω*oneOverR
113+
dv = x*Ω*oneOverR
114+
dT = -0.5*γm1*Ω^2
79115

80116
ρ = (1.0 + dT)^γm1inv
81117
u = MinfCos + du
82-
v = MinfSin + dv
83-
118+
v = MinfSin + dv
84119
p = γinv*(1.0 + dT)^γstar
120+
85121
T = p/*Rair)
86122
e = p/- 1.0) + 0.5*ρ*(u^2 + v^2);
87123

@@ -143,7 +179,7 @@ function initialize(SD::NSD_2D, PT, mesh::St_mesh, inputs::Dict, OUTPUT_DIR::Str
143179
end
144180

145181
if (inputs[:lwrite_initial] == true)
146-
outvarsref = ("drho_init", "du_init", "dv_init", "de_init", "dp_init")
182+
outvarsref = ("rho_init", "u_init", "v_init", "e_init", "p_init")
147183
write_vtk_ref(SD, mesh, q.qn.-q.qe, "initial_state", inputs[:output_dir]; nvar=length(q.qn[1,:]), outvarsref=outvarsref)
148184

149185
outvarsref = ("rho_ref", "u_ref", "v_ref", "e_ref", "p_ref")

problems/equations/CompEuler/vortex/user_flux.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ function user_flux!(F::SubArray{TFloat}, G::SubArray{TFloat}, SD::NSD_2D,
1515
v = ρv/ρ
1616

1717
T = (ρe/ρ - 0.5*sqrt(u*u + v*v))/PhysConst.cv
18-
18+
19+
gm1 = PhysConst.γ - 1.0
20+
#Pressure = gm1*(ρe - 0.5*ρ*(u*u + v*v))
1921
Pressure = perfectGasLaw_ρTtoP(PhysConst, ρ=ρ, Temp=T)
2022

2123
F[1] = ρu
2224
F[2] = ρu*u .+ Pressure
2325
F[3] = ρv*u
24-
F[4] = ρe*u .+ Pressure*u
26+
F[4] = u*(ρe .+ Pressure)
2527

2628
G[1] = ρv
2729
G[2] = ρu*v
2830
G[3] = ρv*v .+ Pressure
29-
G[4] = ρe*v .+ Pressure*v
31+
G[4] = v*(ρe .+ Pressure)
3032
end

problems/equations/CompEuler/vortex/user_inputs.jl

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ function user_inputs()
99
:tinit => 0.0,
1010
:tend => 20.0,
1111
:diagnostics_at_times => (1, 2, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 12, 14, 16, 18, 20),
12-
:case => "vortex",
12+
13+
:case => "shu",
14+
#:case => "hw",
15+
#:case => "vincent",
16+
1317
:lsource => true,
1418
:lperiodic => true,
19+
1520
#:backend => MetalBackend(),
1621
#:SOL_VARS_TYPE => PERT(), #TOTAL() is default
1722
#---------------------------------------------------------------------------
@@ -23,13 +28,13 @@ function user_inputs()
2328
# Physical parameters/constants:
2429
#---------------------------------------------------------------------------
2530
:lvisc => true, #false by default NOTICE: works only for Inexact
26-
:ivisc_equations => (1, 2, 3, 4),
27-
=> (0.0, 0.01, 0.01, 0.01), #horizontal viscosity constant for momentum
31+
:ivisc_equations => [1, 2, 3, 4],
32+
=> [0.0, 0.01, 0.01, 0.01], #horizontal viscosity constant for momentum
2833
#---------------------------------------------------------------------------
2934
# Mesh paramters and files:
3035
#---------------------------------------------------------------------------
3136
:lread_gmsh => true, #If false, a 1D problem will be enforced
32-
:gmsh_filename => "./meshes/gmsh_grids/unit_square_20x20.msh", #for nop=4
37+
:gmsh_filename => "./meshes/gmsh_grids/vortex_20x20.msh", #for nop=4
3338
#---------------------------------------------------------------------------
3439
# Filter parameters
3540
#---------------------------------------------------------------------------
@@ -45,7 +50,7 @@ function user_inputs()
4550
:lwrite_initial => true,
4651
:output_dir => "./output",
4752
#:output_dir => "./test/CI-run",
48-
:loutput_pert => true, #this is only implemented for VTK for now
53+
#:loutput_pert => true, #this is only implemented for VTK for now
4954
#---------------------------------------------------------------------------
5055
) #Dict
5156
#---------------------------------------------------------------------------

0 commit comments

Comments
 (0)