Skip to content

Commit

Permalink
docstring and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Mar 22, 2024
1 parent b0d2c6e commit 03c7c88
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/equations/compressible_navier_stokes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ Under `GradientVariablesEntropy`, the Navier-Stokes discretization is provably e
struct GradientVariablesPrimitive end
struct GradientVariablesEntropy end

"""
dynamic_viscosity(u, equations)
Wrapper for the dynamic viscosity that calls
`dynamic_viscosity(u, equations.mu, equations)` which dispatches on the type of
`equations.mu`.
For constant `equations.mu`, i.e., `equations.mu` is of `Real`-type it is returned directly.
In the opposite case, `equations.mu` is assumed to be a function with arguments
`u` and `equations` and is called with these arguments.
"""
dynamic_viscosity(u, equations) = dynamic_viscosity(u, equations.mu, equations)
dynamic_viscosity(u, mu::Real, equations) = mu
dynamic_viscosity(u, mu::T, equations) where {T} = mu(u, equations)
2 changes: 2 additions & 0 deletions src/equations/compressible_navier_stokes_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ function flux(u, gradients, orientation::Integer,
# In the simplest cases, the user passed in `mu` or `mu()`
# (which returns just a constant) but
# more complex functions like Sutherland's law are possible.
# `dynamic_viscosity` is a helper function that handles both cases
# by dispatching on the type of `equations.mu`.
mu = dynamic_viscosity(u, equations)

# viscous flux components in the x-direction
Expand Down
2 changes: 2 additions & 0 deletions src/equations/compressible_navier_stokes_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ function flux(u, gradients, orientation::Integer,
# In the simplest cases, the user passed in `mu` or `mu()`
# (which returns just a constant) but
# more complex functions like Sutherland's law are possible.
# `dynamic_viscosity` is a helper function that handles both cases
# by dispatching on the type of `equations.mu`.
mu = dynamic_viscosity(u, equations)

if orientation == 1
Expand Down
2 changes: 2 additions & 0 deletions src/equations/compressible_navier_stokes_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ function flux(u, gradients, orientation::Integer,
# In the simplest cases, the user passed in `mu` or `mu()`
# (which returns just a constant) but
# more complex functions like Sutherland's law are possible.
# `dynamic_viscosity` is a helper function that handles both cases
# by dispatching on the type of `equations.mu`.
mu = dynamic_viscosity(u, equations)

if orientation == 1
Expand Down

0 comments on commit 03c7c88

Please sign in to comment.