Skip to content

Commit

Permalink
non-functionalized mu
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Mar 19, 2024
1 parent 4ddfaf6 commit 040eca8
Show file tree
Hide file tree
Showing 26 changed files with 68 additions and 56 deletions.
6 changes: 3 additions & 3 deletions examples/dgmulti_2d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations2D(1.4)
# Note: If you change the Navier-Stokes parameters here, also change them in the initial condition
# I really do not like this structure but it should work for now
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -55,7 +55,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
6 changes: 3 additions & 3 deletions examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations2D(1.4)
# Note: If you change the Navier-Stokes parameters here, also change them in the initial condition
# I really do not like this structure but it should work for now
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -63,7 +63,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.001
mu = 0.001

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
Expand Down
6 changes: 3 additions & 3 deletions examples/dgmulti_3d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -57,7 +57,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
c = 2.0
Expand Down
6 changes: 3 additions & 3 deletions examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -65,7 +65,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
c = 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
Expand Down
6 changes: 3 additions & 3 deletions examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -55,7 +55,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -55,7 +55,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.001
mu = 0.001

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.001
mu = 0.001

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
Expand Down
6 changes: 3 additions & 3 deletions examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -58,7 +58,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
c = 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu() = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations1D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu(),
Prandtl = prandtl_number())

# This convergence test setup was originally derived by Andrew Winters (@andrewwinters5000)
Expand All @@ -36,7 +36,7 @@ initial_condition = initial_condition_navier_stokes_convergence_test
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations1D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -53,7 +53,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations1D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion1D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesEntropy())

Expand Down Expand Up @@ -53,7 +53,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
6 changes: 3 additions & 3 deletions examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -55,7 +55,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Same settings as in `initial_condition`
# Amplitude and shift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.001
mu = 0.001

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 1.0 / 3.0 * 10^(-4) # equivalent to Re = 30,000
mu = 1.0 / 3.0 * 10^(-4) # equivalent to Re = 30,000

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations2D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu,
Expand Down
6 changes: 3 additions & 3 deletions examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ using Trixi
# semidiscretization of the ideal compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 0.01
mu() = 0.01

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesPrimitive())

Expand Down Expand Up @@ -58,7 +58,7 @@ end
# see also https://github.com/trixi-framework/Trixi.jl/pull/1160
inv_gamma_minus_one = inv(equations.gamma - 1)
Pr = prandtl_number()
mu_ = mu(u, equations)
mu_ = mu()

# Constants. OBS! Must match those in `initial_condition_navier_stokes_convergence_test`
c = 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using Trixi
# semidiscretization of the compressible Navier-Stokes equations

prandtl_number() = 0.72
mu(u, equations) = 6.25e-4 # equivalent to Re = 1600
mu = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu,
Expand Down
10 changes: 7 additions & 3 deletions src/equations/compressible_navier_stokes_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,15 @@ function flux(u, gradients, orientation::Integer,
# in the implementation
q1 = equations.kappa * dTdx

# The equations are equipped with a function that computes the dynamic viscosity mu
# from the current state.
# In the simplest case, `mu(u, equations)` returns just a constant but
# more complex functions like Sutherland's law are possible.
mu = equations.mu(u, equations)
if equations.mu isa Real
mu = equations.mu
# The equations are equipped with a function that computes the dynamic viscosity mu
# from the current state.
else
mu = equations.mu(u, equations)
end

# viscous flux components in the x-direction
f1 = zero(rho)
Expand Down
Loading

0 comments on commit 040eca8

Please sign in to comment.