diff --git a/docs/src/systems/weakly_compressible_sph.md b/docs/src/systems/weakly_compressible_sph.md index fbbd52bc1..c4823b39c 100644 --- a/docs/src/systems/weakly_compressible_sph.md +++ b/docs/src/systems/weakly_compressible_sph.md @@ -97,7 +97,7 @@ Modules = [TrixiParticles] Pages = [joinpath("schemes", "fluid", "weakly_compressible_sph", "density_diffusion.jl")] ``` -## Corrections +## [Corrections](@id corrections) ```@autodocs Modules = [TrixiParticles] diff --git a/src/schemes/boundary/dummy_particles/dummy_particles.jl b/src/schemes/boundary/dummy_particles/dummy_particles.jl index e42289918..8168709b5 100644 --- a/src/schemes/boundary/dummy_particles/dummy_particles.jl +++ b/src/schemes/boundary/dummy_particles/dummy_particles.jl @@ -1,6 +1,8 @@ @doc raw""" - BoundaryModelDummyParticles(initial_density, hydrodynamic_mass, state_equation, - density_calculator, smoothing_kernel, smoothing_length) + BoundaryModelDummyParticles(initial_density, hydrodynamic_mass, + density_calculator, smoothing_kernel, + smoothing_length; viscosity=NoViscosity(), + state_equation=nothing, correction=nothing) Boundaries modeled as dummy particles, which are treated like fluid particles, but their positions and velocities are not evolved in time. Since the force towards the fluid @@ -33,8 +35,10 @@ f_{ab} = m_a m_b \left( \frac{p_a}{\rho_a^2} + \frac{p_b}{\rho_b^2} \right) \nab The quantities to be defined here are the density ``\rho_b`` and pressure ``p_b`` of the boundary particle ``b``. +## Hydrodynamic density of dummy particles + We provide five options to compute the boundary density and pressure, determined by the `density_calculator`: -1. With [`AdamiPressureExtrapolation`](@ref), the pressure is extrapolated from the pressure of the +1. (Recommended) With [`AdamiPressureExtrapolation`](@ref), the pressure is extrapolated from the pressure of the fluid according to (Adami et al., 2012), and the density is obtained by applying the inverse of the state equation. This option usually yields the best results of the options listed here. 2. With [`SummationDensity`](@ref), the density is calculated by summation over the neighboring particles, @@ -56,6 +60,54 @@ We provide five options to compute the boundary density and pressure, determined This option is not recommended due to stability issues. See [`PressureMirroring`](@ref) for more details. +## No-slip conditions + +For the interaction of dummy particles and fluid particles, Adami et al. (2012) +impose a no-slip boundary condition by assigning a wall velocity ``v_w`` to the dummy particle. + +The wall velocity of particle ``a`` is calculated from the prescribed boundary particle +velocity ``v_a`` and the smoothed velocity field +```math +v_w = 2 v_a - \frac{\sum_b v_b W_{ab}}{\sum_b W_{ab}}, +``` +where the sum is over all fluid particles. + +By choosing the viscosity model [`ViscosityAdami`](@ref) for `viscosity`, a no-slip +condition is imposed. It is recommended to choose `nu` in the order of either the kinematic +viscosity parameter of the adjacent fluid or the equivalent from the artificial parameter +`alpha` of the adjacent fluid (``\nu = \frac{\alpha h c }{2d + 4}``). When omitting the +viscous interaction (default `viscosity=NoViscosity()`), a free-slip wall boundary +condition is applied. + +# Arguments +- `initial_density`: Vector holding the initial density of each boundary particle. +- `hydrodynamic_mass`: Vector holding the "hydrodynamic mass" of each boundary particle. + See description above for more information. +- `density_calculator`: Strategy to compute the hydrodynamic density of the boundary particles. + See description above for more information. +- `smoothing_kernel`: Smoothing kernel should be the same as for the adjacent fluid system. +- `smoothing_length`: Smoothing length should be the same as for the adjacent fluid system. + +# Keywords +- `state_equation`: This should be the same as for the adjacent fluid system + (see e.g. [`StateEquationCole`](@ref)). +- `correction`: Correction method of the adjacent fluid system (see [Corrections](@ref corrections)). +- `viscosity`: Slip (default) or no-slip condition. See description above for further + information. + +# Examples + +```julia +# Free-slip condition +boundary_model = BoundaryModelDummyParticles(densities, masses, AdamiPressureExtrapolation(), + smoothing_kernel, smoothing_length)) + +# No-slip condition +boundary_model = BoundaryModelDummyParticles(densities, masses, AdamiPressureExtrapolation(), + smoothing_kernel, smoothing_length), + viscosity=ViscosityAdami(nu)) + +``` ## References: - S. Adami, X. Y. Hu, N. A. Adams. "A generalized wall boundary condition for smoothed particle hydrodynamics". diff --git a/src/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl b/src/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl index f2befd71c..9727ac4e1 100644 --- a/src/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl +++ b/src/schemes/boundary/monaghan_kajtar/monaghan_kajtar.jl @@ -1,5 +1,6 @@ @doc raw""" - BoundaryModelMonaghanKajtar(K, beta, boundary_particle_spacing) + BoundaryModelMonaghanKajtar(K, beta, boundary_particle_spacing, mass; + viscosity=NoViscosity()) Boundaries modeled as boundary particles which exert forces on the fluid particles (Monaghan, Kajtar, 2009). The force on fluid particle ``a`` due to boundary particle ``b`` is given by @@ -42,6 +43,25 @@ The viscosity ``\Pi_{ab}`` is calculated according to the viscosity used in the simulation, where the density of the boundary particle if needed is assumed to be identical to the density of the fluid particle. +# No-slip condition + +By choosing the viscosity model [`ArtificialViscosityMonaghan`](@ref) for `viscosity`, +a no-slip condition is imposed. When omitting the viscous interaction +(default `viscosity=NoViscosity()`), a free-slip wall boundary condition is applied. + +# Arguments +- `K`: Scaling factor for repulsive force. +- `beta`: Ratio of fluid particle spacing to boundary particle spacing. +- `boundary_particle_spacing`: Boundary particle spacing. +- `mass`: Vector holding the mass of each boundary particle. + +# Keywords +- `viscosity`: Free-slip (default) or no-slip condition. See description above for further + information. + +!!! warning + The no-slip conditions for `BoundaryModelMonaghanKajtar` have not been verified yet. + ## References: - Joseph J. Monaghan, Jules B. Kajtar. "SPH particle boundary forces for arbitrary boundaries". In: Computer Physics Communications 180.10 (2009), pages 1811–1820. diff --git a/src/schemes/fluid/viscosity.jl b/src/schemes/fluid/viscosity.jl index f5c3942cf..df1f7e89d 100644 --- a/src/schemes/fluid/viscosity.jl +++ b/src/schemes/fluid/viscosity.jl @@ -9,6 +9,15 @@ end @doc raw""" ArtificialViscosityMonaghan(; alpha, beta, epsilon=0.01) +# Keywords +- `alpha`: A value of `0.02` is usually used for most simulations. For a relation with the + kinematic viscosity, see description below. +- `beta`: A value of `0.0` works well for simulations with shocks of moderate strength. + In simulations where the Mach number can be very high, eg. astrophysical calculation, + good results can be obtained by choosing a value of `beta=2` and `alpha=1`. +- `epsilon=0.01`: Parameter to prevent singularities. + + Artificial viscosity by Monaghan (Monaghan 1992, Monaghan 1989), given by ```math \Pi_{ab} = @@ -26,18 +35,12 @@ where ``\alpha, \beta, \epsilon`` are parameters, ``c`` is the speed of sound, ` ``v_{ab} = v_a - v_b`` is the difference of their velocities, and ``\bar{\rho}_{ab}`` is the arithmetic mean of their densities. -TODO: Check the following statement, since in Monaghan 2005 p. 1741 (10.1088/0034-4885/68/8/r01) this was meant for "interstellar cloud collisions" -The choice of the parameters ``\alpha`` and ``\beta`` is not critical, but their values should usually be near -``\alpha = 1, \beta = 2`` (Monaghan 1992, p. 551). -The parameter ``\epsilon`` prevents singularities and is usually chosen as ``\epsilon = 0.01``. - Note that ``\alpha`` needs to adjusted for different resolutions to maintain a specific Reynolds Number. To do so, Monaghan (Monaghan 2005) defined an equivalent effective physical kinematic viscosity ``\nu`` by ```math -\nu = \frac{\alpha h c }{\rho_{ab}}. + \nu = \frac{\alpha h c }{2d + 4}, ``` - -TODO: Check the following statement: [`ArtificialViscosityMonaghan`](@ref) is only applicable for the [`BoundaryModelMonaghanKajtar`](@ref), +where ``d`` is the dimension. ## References: - Joseph J. Monaghan. "Smoothed Particle Hydrodynamics". @@ -114,7 +117,7 @@ function kinematic_viscosity(system, viscosity::ArtificialViscosityMonaghan) end @doc raw""" - ViscosityAdami(; nu) + ViscosityAdami(; nu, epsilon=0.01) Viscosity by Adami (Adami et al. 2012). The viscous interaction is calculated with the shear force for incompressible flows given by @@ -130,16 +133,6 @@ The inter-particle-averaged shear stress is ``` where ``\eta_a = \rho_a \nu_a`` with ``\nu`` as the kinematic viscosity. -For the interaction of dummy particles (see [`BoundaryModelDummyParticles`](@ref)) and fluid particles, -Adami (Adami et al. 2012) imposes a no-slip boundary condition by assigning a wall velocity ``v_w`` -to the boundary particle. - -The wall velocity of particle ``a`` is calculated from the prescribed boundary particle velocity ``v_a`` and the smoothed velocity field -```math -v_w = 2 v_a - \frac{\sum_b v_b W_{ab}}{\sum_b W_{ab}}, -``` -where the sum is over all fluid particles. - # Keywords - `nu`: Kinematic viscosity - `epsilon=0.01`: Parameter to prevent singularities diff --git a/src/schemes/fluid/weakly_compressible_sph/system.jl b/src/schemes/fluid/weakly_compressible_sph/system.jl index 5ceb2e206..95f102f80 100644 --- a/src/schemes/fluid/weakly_compressible_sph/system.jl +++ b/src/schemes/fluid/weakly_compressible_sph/system.jl @@ -26,7 +26,7 @@ see [`ContinuityDensity`](@ref) and [`SummationDensity`](@ref). See [`ArtificialViscosityMonaghan`](@ref) or [`ViscosityAdami`](@ref). - `density_diffusion`: Density diffusion terms for this system. See [`DensityDiffusion`](@ref). - `acceleration`: Acceleration vector for the system. (default: zero vector) -- `correction`: Correction method used for this system. (default: no correction) +- `correction`: Correction method used for this system. (default: no correction, see [Corrections](@ref corrections)) - `source_terms`: Additional source terms for this system. Has to be either `nothing` (by default), or a function of `(coords, velocity, density, pressure)` (which are the quantities of a single particle), returning a `Tuple`