Skip to content

Add simple SGS to Adami and Morris Viscosity #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9657150
add sgs
svchb Apr 9, 2025
f3dde2b
Merge remote-tracking branch 'origin/main' into sgs
svchb Apr 9, 2025
639be87
update
svchb Apr 9, 2025
365c160
fix
svchb Apr 9, 2025
1c9e306
remove
svchb Apr 9, 2025
19451d8
fix doc
svchb Apr 9, 2025
22d62ea
fix
svchb Apr 9, 2025
6d7bec4
fixes
svchb Apr 9, 2025
5f90bf7
typo
svchb Apr 9, 2025
2963202
tpo
svchb Apr 9, 2025
82c9e9b
format
svchb Apr 9, 2025
183d413
Merge branch 'main' into sgs
svchb Apr 11, 2025
cbdadd5
Merge branch 'main' into sgs
svchb Apr 17, 2025
4f208f9
Merge branch 'main' into sgs
svchb May 6, 2025
5ff0c74
add explanation
svchb May 6, 2025
77bf5ef
adjust tests
svchb May 6, 2025
a288da5
Merge remote-tracking branch 'upstream/main' into sgs
svchb May 12, 2025
bad1954
add to validation setup for wcsph
svchb May 13, 2025
a48ca7d
Merge branch 'main' into sgs
svchb May 13, 2025
bea7af6
review fixes
svchb May 13, 2025
fa6df69
Update taylor_green_vortex_2d.jl
svchb May 14, 2025
0458976
Update validation_taylor_green_vortex_2d.jl
svchb May 14, 2025
de606e1
Update dam_break_2d.jl
svchb May 14, 2025
c45fdb6
fix and add citations
svchb May 14, 2025
a1920a5
Merge branch 'main' into sgs
svchb May 14, 2025
41938af
add news
svchb May 14, 2025
1716f99
Merge branch 'sgs' of https://github.com/svchb/TrixiParticles.jlOpen …
svchb May 14, 2025
8e83d5b
Merge branch 'main' into sgs
svchb May 16, 2025
af656b6
implement suggestions
svchb May 21, 2025
6a14443
format
svchb May 21, 2025
646b496
Merge branch 'main' into sgs
svchb May 21, 2025
639a5a4
Merge branch 'main' into sgs
svchb May 21, 2025
0ee856e
rename viscosity
svchb May 22, 2025
df12585
Merge branch 'main' into sgs
svchb May 22, 2025
f038002
too much renaming
svchb May 22, 2025
5643d86
Merge branch 'sgs' of https://github.com/svchb/TrixiParticles.jlOpen …
svchb May 22, 2025
2e9c7ff
Merge branch 'main' into sgs
svchb May 22, 2025
9c9186f
implement suggestions
svchb May 23, 2025
507138a
Merge branch 'main' into sgs
svchb May 26, 2025
7436332
Merge branch 'main' into sgs
efaulhaber May 28, 2025
1f72f09
Merge branch 'main' into sgs
svchb May 28, 2025
2f3bbbb
Update validation_taylor_green_vortex_2d.jl
svchb May 28, 2025
1d19cef
Merge branch 'main' into sgs
LasNikas Jun 12, 2025
1188a9a
Merge branch 'main' into sgs
svchb Jun 13, 2025
6a83b83
fix tests again
svchb Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions examples/fluid/dam_break_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,21 @@ smoothing_length = 1.75 * fluid_particle_spacing
smoothing_kernel = WendlandC2Kernel{2}()

fluid_density_calculator = ContinuityDensity()
viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0)
# nu = 0.02 * smoothing_length * sound_speed/8
# viscosity = ViscosityMorris(nu=nu)
# viscosity = ViscosityMorrisSGS(nu=nu)
alpha = 0.02
viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0)
# A typical formula to convert Artificial viscosity to a
# kinematic viscosity is provided by Monaghan as
# nu = alpha * smoothing_length * sound_speed/8

# Alternatively a kinematic viscosity for water can be set
# nu = 1.0e-6

# This allows the use of a physical viscosity model like:
# viscosity = ViscosityAdami(nu=nu)
# or with additional dissipation through a Smagorinsky model
# viscosity = ViscosityAdamiSGS(nu=nu)
# For more details see the documentation [Viscosity model overview](@ref viscosity_sph).

# Alternatively the density diffusion model by Molteni & Colagrossi can be used,
# which will run faster.
# density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1)
Expand Down
4 changes: 2 additions & 2 deletions examples/fluid/taylor_green_vortex_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if wcsph
state_equation, smoothing_kernel,
pressure_acceleration=TrixiParticles.inter_particle_averaged_pressure,
smoothing_length,
viscosity=ViscosityAdamiSGS(; nu, C_S=0.2),
viscosity=ViscosityAdami(; nu),
transport_velocity=TransportVelocityAdami(background_pressure))
else
density_calculator = SummationDensity()
Expand All @@ -100,7 +100,7 @@ ode = semidiscretize(semi, tspan)

info_callback = InfoCallback(interval=100)

saving_callback = SolutionSavingCallback(dt=0.02, prefix="SGS")
saving_callback = SolutionSavingCallback(dt=0.02)

pp_callback = nothing

Expand Down
16 changes: 8 additions & 8 deletions src/schemes/fluid/viscosity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ struct ViscosityAdami{ELTYPE}
end

function adami_viscosity_force(smoothing_length_average, pos_diff, distance, grad_kernel,
m_a,
m_b, rho_a, rho_b, v_diff, nu_a, nu_b, epsilon)
m_a, m_b, rho_a, rho_b, v_diff, nu_a, nu_b, epsilon)
eta_a = nu_a * rho_a
eta_b = nu_b * rho_b

Expand Down Expand Up @@ -241,8 +240,9 @@ end
@doc raw"""
ViscosityAdamiSGS(; nu, C_S=0.1, epsilon=0.01)

Viscosity model that extends the standard Adami formulation by incorporating a subgrid-scale (SGS)
eddy viscosity via a Smagorinsky-type closure. The effective kinematic viscosity is defined as
Viscosity model that extends the standard [Adami formulation](@ref ViscosityAdami)
by incorporating a subgrid-scale (SGS) eddy viscosity via a Smagorinsky-type closure.
The effective kinematic viscosity is defined as

```math
\nu_{\mathrm{eff}} = \nu_{\\mathrm{std}} + \nu_{\\mathrm{SGS}},
Expand Down Expand Up @@ -278,10 +278,10 @@ This model is appropriate for turbulent flows where unresolved scales contribute
# Keywords
- `nu`: Standard kinematic viscosity.
- `C_S`: Smagorinsky constant.
- `epsilon`: Epsilon for singularity prevention [e.g., 0.001]
- `epsilon=0.01`: Parameter to prevent singularities
"""
struct ViscosityAdamiSGS{ELTYPE}
nu::ELTYPE # Standard (molecular) kinematic viscosity [e.g., 1e-6 m²/s]
nu::ELTYPE # kinematic viscosity [e.g., 1e-6 m²/s]
C_S::ELTYPE # Smagorinsky constant [e.g., 0.1-0.2]
epsilon::ELTYPE # Epsilon for singularity prevention [e.g., 0.001]
end
Expand Down Expand Up @@ -379,10 +379,10 @@ This model is appropriate for turbulent flows where unresolved scales contribute
# Keywords
- `nu`: Standard kinematic viscosity.
- `C_S`: Smagorinsky constant.
- `epsilon`: Epsilon for singularity prevention [e.g., 0.001]
- `epsilon=0.01`: Parameter to prevent singularities
"""
struct ViscosityMorrisSGS{ELTYPE}
nu::ELTYPE # Standard (molecular) kinematic viscosity [e.g., 1e-6 m²/s]
nu::ELTYPE # kinematic viscosity [e.g., 1e-6 m²/s]
C_S::ELTYPE # Smagorinsky constant [e.g., 0.1-0.2]
epsilon::ELTYPE # Epsilon for singularity prevention [e.g., 0.001]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ using TrixiParticles

# ==========================================================================================
# ==== Resolution
# P. Ramachandran, K. Puri
# "Entropically damped artificial compressibility for SPH".
# In: Computers and Fluids, Volume 179 (2019), pages 579-594.
# https://doi.org/10.1016/j.compfluid.2018.11.023
# The following resolutions are used in the paper:
# particle_spacings = [0.02, 0.01, 0.005]

# To save time only the configuration with 50x50 particles are used here.
particle_spacings = [0.02]

# ==========================================================================================
Expand Down
Loading