From 03c7c889dec99215908a520464b7359707267cd9 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 22 Mar 2024 09:05:11 +0100 Subject: [PATCH] docstring and comments --- src/equations/compressible_navier_stokes.jl | 10 ++++++++++ src/equations/compressible_navier_stokes_1d.jl | 2 ++ src/equations/compressible_navier_stokes_2d.jl | 2 ++ src/equations/compressible_navier_stokes_3d.jl | 2 ++ 4 files changed, 16 insertions(+) diff --git a/src/equations/compressible_navier_stokes.jl b/src/equations/compressible_navier_stokes.jl index d4bcb8c8181..b0258e4b98a 100644 --- a/src/equations/compressible_navier_stokes.jl +++ b/src/equations/compressible_navier_stokes.jl @@ -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) \ No newline at end of file diff --git a/src/equations/compressible_navier_stokes_1d.jl b/src/equations/compressible_navier_stokes_1d.jl index 0e13a4e0111..3dbdf11c56b 100644 --- a/src/equations/compressible_navier_stokes_1d.jl +++ b/src/equations/compressible_navier_stokes_1d.jl @@ -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 diff --git a/src/equations/compressible_navier_stokes_2d.jl b/src/equations/compressible_navier_stokes_2d.jl index a4f11f27ede..3256343703a 100644 --- a/src/equations/compressible_navier_stokes_2d.jl +++ b/src/equations/compressible_navier_stokes_2d.jl @@ -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 diff --git a/src/equations/compressible_navier_stokes_3d.jl b/src/equations/compressible_navier_stokes_3d.jl index cdc2bbba462..9833122eb32 100644 --- a/src/equations/compressible_navier_stokes_3d.jl +++ b/src/equations/compressible_navier_stokes_3d.jl @@ -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