Skip to content
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

Upwind SBP on curved meshes #1857

Merged
merged 20 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a6ba38e
baseline implementation of the curvilinear USBP for testing
andrewwinters5000 Feb 6, 2024
3aa5ea4
working version of curvilinear upwind solver. Needs significant clean…
andrewwinters5000 Mar 1, 2024
068ebd1
Merge branch 'main' into usbp-curvi
andrewwinters5000 Mar 1, 2024
4324ec6
cleanup of the fdsbp_2d file
andrewwinters5000 Mar 4, 2024
d28e814
clean-up FVS routines in the compressible Euler file
andrewwinters5000 Mar 4, 2024
f1cabf8
cleanup and remove unnecessary containers
andrewwinters5000 Mar 4, 2024
a8cf691
add tests for the new solver
andrewwinters5000 Mar 4, 2024
ad31bdc
Merge branch 'main' into usbp-curvi
andrewwinters5000 Mar 4, 2024
a622fb6
remove extra space
andrewwinters5000 Mar 5, 2024
75d284d
Merge branch 'usbp-curvi' of github.com:andrewwinters5000/Trixi.jl in…
andrewwinters5000 Mar 5, 2024
376e84d
run formatter
andrewwinters5000 Mar 5, 2024
40f6547
Apply suggestions from code review
andrewwinters5000 Mar 5, 2024
b836c21
add specialized calc_metric_terms function for upwind type
andrewwinters5000 Mar 6, 2024
b2a4a2d
revert change to the surface integral function
andrewwinters5000 Mar 6, 2024
5f6238e
add reference for curvilinear van Leer splitting
andrewwinters5000 Mar 6, 2024
49c87c5
new splitting_drikakis_tsangaris in Cartesian and generalized coordin…
andrewwinters5000 Mar 6, 2024
22fbda8
added test for Cartesian splitting_drikakis_tsangaris
andrewwinters5000 Mar 6, 2024
5923392
run formatter
andrewwinters5000 Mar 6, 2024
43fd5b1
Update src/equations/compressible_euler_2d.jl
ranocha Mar 6, 2024
c11af11
remove orientation_or_normal from Steger-Warming
andrewwinters5000 Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions examples/unstructured_2d_fdsbp/elixir_euler_free_stream_upwind.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# !!! warning "Experimental implementation (upwind SBP)"
# This is an experimental feature and may change in future releases.

using OrdinaryDiffEq
using Trixi
andrewwinters5000 marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# semidiscretization of the compressible Euler equations

equations = CompressibleEulerEquations2D(1.4)

initial_condition = initial_condition_constant

# Boundary conditions for free-stream preservation test
boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition)

boundary_conditions = Dict(:outerCircle => boundary_condition_free_stream,
:cone1 => boundary_condition_free_stream,
:cone2 => boundary_condition_free_stream,
:iceCream => boundary_condition_free_stream)

###############################################################################
# Get the Upwind FDSBP approximation space

# TODO: FDSBP
# Note, one must set `xmin=-1` and `xmax=1` due to the reuse
# of interpolation routines from `calc_node_coordinates!` to create
# the physical coordinates in the mappings.
Comment on lines +26 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Note, one must set `xmin=-1` and `xmax=1` due to the reuse
# of interpolation routines from `calc_node_coordinates!` to create
# the physical coordinates in the mappings.
# TODO: FDSBP
# Note, one must set `xmin=-1` and `xmax=1` due to the reuse
# of interpolation routines from `calc_node_coordinates!` to create
# the physical coordinates in the mappings.

That's fine for now but we should keep track of it so that someone can improve this later. I added it to the list in #1284

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that sounds reasonable. I thought about throwing an error if a user attempts to set anything different for the xmin and xmax values. Would this maybe be overkill? Alternatively, we could maybe add "under the hood" an affine map of the user desired xmin and xmax to the [-1,1] interval. However, I am hot sure if this would mess with plotting or post processing later.

D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
derivative_order = 1,
accuracy_order = 8,
xmin = -1.0, xmax = 1.0,
N = 17)

flux_splitting = splitting_vanleer_haenel
solver = FDSBP(D_upw,
surface_integral = SurfaceIntegralStrongForm(FluxUpwind(flux_splitting)),
volume_integral = VolumeIntegralUpwind(flux_splitting))

###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)

# Mesh with second-order boundary polynomials requires an upwind SBP operator
# with (at least) 4th order boundary closure to guarantee the approximation is
# free-stream preserving
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/ec9a345f09199ebe471d35d5c1e4e08f/raw/15975943d8642e42f8292235314b6f1b30aa860d/mesh_inner_outer_boundaries.mesh",
joinpath(@__DIR__, "mesh_inner_outer_boundaries.mesh"))

mesh = UnstructuredMesh2D(mesh_file)

###############################################################################
# create the semi discretization object

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
boundary_conditions = boundary_conditions)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 5.0)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 1000
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)

alive_callback = AliveCallback(analysis_interval = analysis_interval)

save_solution = SaveSolutionCallback(interval = 1000,
save_initial_solution = true,
save_final_solution = true)

callbacks = CallbackSet(summary_callback,
analysis_callback,
save_solution,
alive_callback)

###############################################################################
# run the simulation

# set small tolerances for the free-stream preservation test
sol = solve(ode, SSPRK43(), abstol = 1.0e-12, reltol = 1.0e-12,
save_everystep = false, callback = callbacks)

summary_callback() # print the timer summary
87 changes: 87 additions & 0 deletions examples/unstructured_2d_fdsbp/elixir_euler_source_terms_upwind.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# !!! warning "Experimental implementation (upwind SBP)"
# This is an experimental feature and may change in future releases.

using OrdinaryDiffEq
using Trixi
andrewwinters5000 marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# semidiscretization of the compressible Euler equations

equations = CompressibleEulerEquations2D(1.4)

initial_condition = initial_condition_convergence_test

source_term = source_terms_convergence_test

boundary_condition_eoc = BoundaryConditionDirichlet(initial_condition)

boundary_conditions = Dict(:Top => boundary_condition_eoc,
:Bottom => boundary_condition_eoc,
:Right => boundary_condition_eoc,
:Left => boundary_condition_eoc)

###############################################################################
# Get the Upwind FDSBP approximation space

# TODO: FDSBP
# Note, one must set `xmin=-1` and `xmax=1` due to the reuse
# of interpolation routines from `calc_node_coordinates!` to create
# the physical coordinates in the mappings.
andrewwinters5000 marked this conversation as resolved.
Show resolved Hide resolved
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
derivative_order = 1,
accuracy_order = 4,
xmin = -1.0, xmax = 1.0,
N = 9)

flux_splitting = splitting_drikakis_tsangaris
solver = FDSBP(D_upw,
surface_integral = SurfaceIntegralStrongForm(FluxUpwind(flux_splitting)),
volume_integral = VolumeIntegralUpwind(flux_splitting))

###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)

# Mesh with first-order boundary polynomials requires an upwind SBP operator
# with (at least) 2nd order boundary closure to guarantee the approximation is
# free-stream preserving
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/a4f4743008bf3233957a9ea6ac7a62e0/raw/8b36cc6649153fe0a5723b200368a210a1d74eaf/mesh_refined_box.mesh",
joinpath(@__DIR__, "mesh_refined_box.mesh"))

mesh = UnstructuredMesh2D(mesh_file)

###############################################################################
# create the semidiscretization object

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
source_terms = source_term,
boundary_conditions = boundary_conditions)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 1000
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)

alive_callback = AliveCallback(analysis_interval = analysis_interval)

save_solution = SaveSolutionCallback(interval = 1000,
save_initial_solution = true,
save_final_solution = true)

callbacks = CallbackSet(summary_callback,
analysis_callback,
save_solution,
alive_callback)

###############################################################################
# run the simulation

sol = solve(ode, SSPRK43(), abstol = 1.0e-6, reltol = 1.0e-6,
save_everystep = false, callback = callbacks)

summary_callback() # print the timer summary
3 changes: 2 additions & 1 deletion src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ export flux, flux_central, flux_lax_friedrichs, flux_hll, flux_hllc, flux_hlle,
FluxUpwind

export splitting_steger_warming, splitting_vanleer_haenel,
splitting_coirier_vanleer, splitting_lax_friedrichs
splitting_coirier_vanleer, splitting_lax_friedrichs,
splitting_drikakis_tsangaris

export initial_condition_constant,
initial_condition_gauss,
Expand Down
Loading
Loading