Skip to content

Commit d2c1c43

Browse files
author
Steve
committed
PR corrections
1 parent 05a01e1 commit d2c1c43

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,16 @@ equations = LinearScalarAdvectionEquation2D(advection_velocity)
1111
diffusivity() = 5.0e-2
1212
equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations)
1313

14-
# Create DG solver with polynomial degree = 3 and (local) Lax-Friedrichs/Rusanov flux as surface flux
1514
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)
1615

17-
coordinates_min = (-1.0, -1.0) # minimum coordinates (min(x), min(y))
18-
coordinates_max = (1.0, 1.0) # maximum coordinates (max(x), max(y))
16+
coordinates_min = (-1.0, -1.0)
17+
coordinates_max = (1.0, 1.0)
1918

20-
# Create a uniformly refined mesh with periodic boundaries
2119
mesh = TreeMesh(coordinates_min, coordinates_max,
2220
initial_refinement_level = 4,
2321
periodicity = true,
24-
n_cells_max = 30_000) # set maximum capacity of tree data structure
22+
n_cells_max = 30_000)
2523

26-
# Define initial condition
2724
function initial_condition_diffusive_convergence_test(x, t,
2825
equation::LinearScalarAdvectionEquation2D)
2926
# Store translated coordinate for easy use of exact solution
@@ -41,7 +38,6 @@ function initial_condition_diffusive_convergence_test(x, t,
4138
end
4239
initial_condition = initial_condition_diffusive_convergence_test
4340

44-
# define periodic boundary conditions everywhere
4541
boundary_conditions = boundary_condition_periodic
4642
boundary_conditions_parabolic = boundary_condition_periodic
4743

@@ -53,7 +49,6 @@ jac_detector = TracerSparsityDetector()
5349
# sparsity-detection ready datatype, which is retrieved here
5450
jac_eltype = jacobian_eltype(real(solver), jac_detector)
5551

56-
# A semidiscretization collects data structures and functions for the spatial discretization
5752
semi_jac_type = SemidiscretizationHyperbolicParabolic(mesh,
5853
(equations, equations_parabolic),
5954
initial_condition, solver,
@@ -90,7 +85,7 @@ coloring_result = coloring(jac_prototype_parabolic, coloring_prob, coloring_alg)
9085
coloring_vec_parabolic = column_colors(coloring_result)
9186

9287
###############################################################################
93-
### sparsity-aware semidiscretization and ode ###
88+
### sparsity-aware semidiscretization and ODE ###
9489

9590
# Semidiscretization for actual simulation. `eEltype` is here retrieved from `solver`
9691
semi_float_type = SemidiscretizationHyperbolicParabolic(mesh,
@@ -109,15 +104,11 @@ ode_jac_sparse = semidiscretize(semi_float_type, tspan,
109104
###############################################################################
110105
### callbacks ###
111106

112-
# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup
113-
# and resets the timers
114107
summary_callback = SummaryCallback()
115108

116-
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results
117109
analysis_interval = 100
118110
analysis_callback = AnalysisCallback(semi_float_type, interval = analysis_interval)
119111

120-
# The AliveCallback prints short status information in regular intervals
121112
alive_callback = AliveCallback(analysis_interval = analysis_interval)
122113

123114
save_restart = SaveRestartCallback(interval = 100,

src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ The initial condition etc. is taken from the `restart_file`.
338338
Optional keyword arguments:
339339
- `jac_prototype_parabolic`: Expected to come from [SparseConnectivityTracer.jl](https://github.com/adrhill/SparseConnectivityTracer.jl).
340340
Specifies the sparsity structure of the parabolic function's Jacobian to enable e.g. efficient implicit time stepping.
341+
The [SplitODEProblem](https://docs.sciml.ai/DiffEqDocs/stable/types/split_ode_types/#SciMLBase.SplitODEProblem) only expects the Jacobian
342+
to be defined on the first function it takes in, which is treated implicitly. This corresponds to the parabolic right-hand side in Trixi.
343+
The hyperbolic right-hand side is treated explicitly, and therefore its Jacobian is irrelevant.
341344
- `colorvec_parabolic`: Expected to come from [SparseMatrixColorings.jl](https://github.com/gdalle/SparseMatrixColorings.jl).
342345
Allows for even faster Jacobian computation. Not necessarily required when `jac_prototype_parabolic` is given.
343346
"""

0 commit comments

Comments
 (0)