-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
von-Karman Vortex Street #2246
Open
DanielDoehring
wants to merge
5
commits into
trixi-framework:main
Choose a base branch
from
DanielDoehring:VonKarmanVortexStreet
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
−3
Open
von-Karman Vortex Street #2246
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
examples/p4est_2d_dgsem/elixir_navierstokes_vortex_street.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# Semidiscretization of the compressible Euler equations | ||
|
||
# Fluid parameters | ||
gamma() = 5 / 3 | ||
prandtl_number() = 0.72 | ||
|
||
# Parameters for compressible von-Karman vortex street | ||
Re() = 500 | ||
Ma() = 0.5f0 | ||
D() = 1 # Diameter of the cylinder as in the mesh file | ||
|
||
# Parameters that can be freely chosen | ||
v_in() = 1 | ||
p_in() = 1 | ||
|
||
# Parameters that follow from Reynolds and Mach number + adiabatic index gamma | ||
mu() = v_in() * D() / Re() | ||
|
||
c() = v_in() / Ma() | ||
p_over_rho() = c()^2 / gamma() | ||
rho_in() = p_in() / p_over_rho() | ||
|
||
# Equations for this configuration | ||
equations = CompressibleEulerEquations2D(gamma()) | ||
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(), | ||
Prandtl = prandtl_number(), | ||
gradient_variables = GradientVariablesPrimitive()) | ||
|
||
# Freestream configuration | ||
@inline function initial_condition(x, t, equations::CompressibleEulerEquations2D) | ||
rho = rho_in() | ||
v1 = v_in() | ||
v2 = 0.0 | ||
p = p_in() | ||
|
||
prim = SVector(rho, v1, v2, p) | ||
return prim2cons(prim, equations) | ||
end | ||
|
||
# Mesh which is refined around the cylinder and the wake region | ||
mesh_file = Trixi.download("https://gist.githubusercontent.com/DanielDoehring/7312faba9a50ef506b13f01716b4ec26/raw/8e68f9006e634905544207ca322bc0a03a9313ad/cylinder_vortex_street.inp", | ||
joinpath(@__DIR__, "cylinder_vortex_street.inp")) | ||
mesh = P4estMesh{2}(mesh_file) | ||
|
||
bc_freestream = BoundaryConditionDirichlet(initial_condition) | ||
|
||
# Boundary names follow from the mesh file | ||
boundary_conditions = Dict(:Bottom => bc_freestream, | ||
:Circle => boundary_condition_slip_wall, | ||
:Top => bc_freestream, | ||
:Right => bc_freestream, | ||
:Left => bc_freestream) | ||
|
||
# Parabolic boundary conditions | ||
velocity_bc_free = NoSlip((x, t, equations) -> SVector(v_in(), 0)) | ||
# Use adiabatic also on the boundaries to "copy" temperature from the domain | ||
heat_bc_free = Adiabatic((x, t, equations) -> 0) | ||
boundary_condition_free = BoundaryConditionNavierStokesWall(velocity_bc_free, heat_bc_free) | ||
|
||
velocity_bc_cylinder = NoSlip((x, t, equations) -> SVector(0, 0)) | ||
heat_bc_cylinder = Adiabatic((x, t, equations) -> 0) | ||
boundary_condition_cylinder = BoundaryConditionNavierStokesWall(velocity_bc_cylinder, | ||
heat_bc_cylinder) | ||
|
||
boundary_conditions_para = Dict(:Bottom => boundary_condition_free, | ||
:Circle => boundary_condition_cylinder, | ||
:Top => boundary_condition_free, | ||
:Right => boundary_condition_free, | ||
:Left => boundary_condition_free) | ||
# Standard DGSEM sufficient here | ||
solver = DGSEM(polydeg = 3, surface_flux = flux_hll) | ||
|
||
semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), | ||
initial_condition, solver, | ||
boundary_conditions = (boundary_conditions, | ||
boundary_conditions_para)) | ||
|
||
############################################################################### | ||
# Setup an ODE problem | ||
tspan = (0, 100) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
# Callbacks | ||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 1000 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = analysis_interval, | ||
save_initial_solution = true, | ||
save_final_solution = true, | ||
solution_variables = cons2prim) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, | ||
alive_callback, | ||
save_solution) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
time_int_tol = 1e-6 | ||
sol = solve(ode, | ||
# Moderate number of threads (e.g. 4) advisable to speed things up | ||
RDPK3SpFSAL49(thread = OrdinaryDiffEq.True()); | ||
dt = 1e-3, abstol = time_int_tol, reltol = time_int_tol, | ||
ode_default_options()..., callback = callbacks) | ||
|
||
summary_callback() # print the timer summary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is setting
dt
required here?