Skip to content

Commit

Permalink
docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Mar 19, 2024
1 parent a198ee0 commit b2bec6f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
32 changes: 14 additions & 18 deletions src/callbacks_step/analysis_surface_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
@muladd begin
#! format: noindent

# The boundary_index is chosen so that
# semi.boundary_conditions.boundary_indices[boundary_index]
# gives the solution point indices on which the function `variable` will compute
# the quantity of interest. The `variable` can, e.g., integrate over all indices
# to compute the coefficient of lift. But it can also be used to loop over all indices
# to save coefficient of pressure versus surface points in a data file
# The struct contains an inner constructor which helps the user choose those indices
# by specifying the `boundary_condition_type` of the indices. The user needs to make
# sure that they choose the `boundary_condition_type` so that it is only applying to the
# parts of boundary that are of interest
"""
AnalysisSurfaceIntegral{Semidiscretization, Variable}(semi,
boundary_symbol_or_boundary_symbols,
variable)
This struct is used to compute the surface integral of a quantity of interest `variable` alongside
the boundary/boundaries associated with `boundary_symbol` or `boundary_symbols`.
For instance, this can be used to compute the lift or drag coefficient of e.g. an airfoil in 2D.
"""
struct AnalysisSurfaceIntegral{Semidiscretization, Variable}
semi::Semidiscretization # Semidiscretization of PDE used by the solver
semi::Semidiscretization # passed in to retrieve boundary condition information
indices::Vector{Int} # Indices in `boundary_condition_indices` where quantity of interest is computed
variable::Variable # Quantity of interest, like lift or drag

Expand Down Expand Up @@ -92,16 +91,12 @@ function analyze(surface_variable::AnalysisSurfaceIntegral, du, u, t,
@unpack boundaries = cache
@unpack surface_flux_values, node_coordinates, contravariant_vectors = cache.elements
@unpack weights = dg.basis
@unpack semi, indices, variable = surface_variable

@unpack indices, variable = surface_variable

surface_integral = zero(eltype(u))
index_range = eachnode(dg)
for local_index in eachindex(indices)
# Use the local index to get the global boundary index from the pre-sorted list
boundary = indices[local_index]

# Get information on the adjacent element, compute the surface fluxes,
# and store them
for boundary in indices
element = boundaries.neighbor_ids[boundary]
node_indices = boundaries.node_indices[boundary]
direction = indices2direction(node_indices)
Expand All @@ -120,6 +115,7 @@ function analyze(surface_variable::AnalysisSurfaceIntegral, du, u, t,

# L2 norm of normal direction is the surface element
dS = weights[node_index] * norm(normal_direction)
# Integral over whole boundary surface
surface_integral += variable(u_node, normal_direction, equations) * dS

i_node += i_node_step
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/dgsem_unstructured/sort_boundary_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"""
UnstructuredSortedBoundaryTypes
General container to sort the boundary conditions by type for some unstructured meshes/solvers.
It stores a set of global indices for each boundary condition type to expedite computation
General container to sort the boundary conditions by type and name for some unstructured meshes/solvers.
It stores a set of global indices for each boundary condition type and name to expedite computation
during the call to `calc_boundary_flux!`. The original dictionary form of the boundary conditions
set by the user in the elixir file is also stored for printing.
"""
Expand Down

0 comments on commit b2bec6f

Please sign in to comment.