Skip to content

Commit 9cbf136

Browse files
author
LasNikas
committed
Merge branch 'main' into validate-open-boundaries
2 parents 479c710 + 785ade6 commit 9cbf136

31 files changed

Lines changed: 10884 additions & 10383 deletions

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ used in the Julia ecosystem. Notable changes will be documented in this file for
88

99
### Features
1010

11+
- New viscosity models `ViscosityMorrisSGS` and `ViscosityAdamiSGS` were added, which use a simplified Smagorinsky-type SGS (#753).
12+
1113
- With all CPU backends, a new array type is used for the integration array, which defines
1214
broadcasting to be multithreaded, leading to speedups of up to 5x with large thread counts
1315
when combined with thread pinning (#722).

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TrixiParticles"
22
uuid = "66699cd8-9c01-4e9d-a059-b96c86d16b3a"
33
authors = ["erik.faulhaber <44124897+efaulhaber@users.noreply.github.com>"]
4-
version = "0.3.1-dev"
4+
version = "0.3.2-dev"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -47,7 +47,7 @@ DelimitedFiles = "1"
4747
DiffEqCallbacks = "4"
4848
FastPow = "0.1"
4949
FileIO = "1"
50-
ForwardDiff = "0.10"
50+
ForwardDiff = "1"
5151
GPUArraysCore = "0.2"
5252
JSON = "0.21"
5353
KernelAbstractions = "0.9"

docs/src/preprocessing/preprocessing.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,51 @@ Pages = [joinpath("preprocessing", "point_in_poly", "winding_number_hormann.jl")
250250
Modules = [TrixiParticles]
251251
Pages = [joinpath("preprocessing", "point_in_poly", "winding_number_jacobson.jl")]
252252
```
253+
# [Read geometries from file](@id read_geometries_from_file)
254+
Geometries can be imported using the [`load_geometry`](@ref) function.
255+
- For 3D geometries, we support the binary (`.stl`) format.
256+
- For 2D geometries, the recommended format is DXF (`.dxf`), with optional support for a simple ASCII (`.asc`) format.
257+
258+
## ASCII Format (.asc)
259+
An .asc file contains a list of 2D coordinates, space-delimited, one point per line,
260+
where the first column are the x values and the second the y values.
261+
For example:
262+
```plaintext
263+
# ASCII
264+
0.0 0.0
265+
1.0 0.0
266+
1.0 1.0
267+
0.0 1.0
268+
```
269+
It is the user’s responsibility to ensure the points are ordered correctly.
270+
This format is easy to generate and inspect manually.
271+
272+
## DXF Format (.dxf) – recommended
273+
The DXF (Drawing Exchange Format) is a widely-used CAD format for 2D and 3D data.
274+
We recommend this format for defining 2D polygonal.
275+
Only DXF entities of type `LINE` or `POLYLINE` are supported.
276+
To create DXF files from scratch, we recommend using the open-source tool [FreeCAD](https://www.freecad.org/).
277+
For a less technical approach, we recommend using [Inkscape](https://inkscape.org/) to create SVG files and then export them as DXF.
278+
279+
### Creating DXF Files with FreeCAD
280+
281+
- Open FreeCAD and create a new document.
282+
- Switch to the Sketcher workbench and create a new sketch.
283+
- Choose the XY-plane orientation and draw your geometry.
284+
- Select the object to be exported.
285+
- Go to "File > Export..." and choose "AutoDesk DXF (*.dxf)" as the format.
286+
- Ensure the following Import-Export options are enabled:
287+
- "Use legacy Python exporter".
288+
- "Project exported objects along current view direction".
289+
290+
### Creating DXF Files with Inkscape
291+
SVG vector graphics can also be used as a basis for geometry.
292+
Use Inkscape to open or create the SVG.
293+
You can simply draw a Bezier curve by pressing "B" on your keyboard.
294+
We reommend the mode "Create spiro paths" for a smooth curve.
295+
Select the relevant path and export it as DXF:
296+
- Go to "File > Save As...".
297+
- Choose "Desktop Cutting Plotter (AutoCAD DXF R12)(*.dxf)" format.
253298

254299
```@autodocs
255300
Modules = [TrixiParticles]

docs/src/refs.bib

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ @article{MeloEspinosa2014
715715
journal = {Energy Conversion and Management},
716716
volume = {84},
717717
pages = {50--60},
718-
doi = {https://doi.org/10.1016/j.enconman.2014.08.004},
718+
doi = {10.1016/j.enconman.2014.08.004},
719719
year = {2014}
720720
}
721721

@@ -736,6 +736,28 @@ @book{Poling2001
736736
address = {New York}
737737
}
738738

739+
@article{Smagorinsky1963,
740+
author = {Smagorinsky, Joseph},
741+
title = {General Circulation Experiments with the Primitive Equations. I. The Basic Experiment},
742+
journal = {Monthly Weather Review},
743+
volume = {91},
744+
number = {3},
745+
pages = {99--164},
746+
year = {1963},
747+
doi = {10.1175/1520-0493(1963)091<0099:GCEWTP>2.3.CO;2}
748+
}
749+
750+
@inproceedings{Lilly1967,
751+
author = {Lilly, Douglas K.},
752+
title = {The Representation of Small‑Scale Turbulence in Numerical Simulation Experiments},
753+
booktitle = {Proceedings of the {IBM} Scientific Computing Symposium on Environmental Sciences},
754+
editor = {Goldstine, Herman H.},
755+
address = {Yorktown Heights, New York},
756+
pages = {195--210},
757+
year = {1967},
758+
doi = {10.5065/D62R3PMM}
759+
}
760+
739761
@article{Zhu2021,
740762
author = {Zhu, Yujie and Zhang, Chi and Yu, Yongchuan and Hu, Xiangyu},
741763
journal = {Journal of Hydrodynamics},

examples/fluid/dam_break_2d.jl

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,29 @@ smoothing_length = 1.75 * fluid_particle_spacing
4747
smoothing_kernel = WendlandC2Kernel{2}()
4848

4949
fluid_density_calculator = ContinuityDensity()
50-
viscosity = ArtificialViscosityMonaghan(alpha=0.02, beta=0.0)
51-
# nu = 0.02 * smoothing_length * sound_speed/8
52-
# viscosity = ViscosityMorris(nu=nu)
53-
# viscosity = ViscosityAdami(nu=nu)
50+
alpha = 0.02
51+
viscosity_fluid = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0)
52+
# A typical formula to convert Artificial viscosity to a
53+
# kinematic viscosity is provided by Monaghan as
54+
# nu = alpha * smoothing_length * sound_speed/8
55+
56+
# Alternatively a kinematic viscosity for water can be set
57+
# nu = 1.0e-6
58+
59+
# This allows the use of a physical viscosity model like:
60+
# viscosity_fluid = ViscosityAdami(nu=nu)
61+
# or with additional dissipation through a Smagorinsky model
62+
# viscosity_fluid = ViscosityAdamiSGS(nu=nu)
63+
# For more details see the documentation "Viscosity model overview".
64+
5465
# Alternatively the density diffusion model by Molteni & Colagrossi can be used,
5566
# which will run faster.
5667
# density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1)
5768
density_diffusion = DensityDiffusionAntuono(tank.fluid, delta=0.1)
5869

5970
fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
6071
state_equation, smoothing_kernel,
61-
smoothing_length, viscosity=viscosity,
72+
smoothing_length, viscosity=viscosity_fluid,
6273
density_diffusion=density_diffusion,
6374
acceleration=(0.0, -gravity), correction=nothing,
6475
surface_tension=nothing,
@@ -67,12 +78,17 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
6778
# ==========================================================================================
6879
# ==== Boundary
6980
boundary_density_calculator = AdamiPressureExtrapolation()
81+
viscosity_wall = nothing
82+
# For a no-slip condition the corresponding wall viscosity without SGS can be set
83+
# viscosity_wall = ViscosityAdami(nu=nu)
84+
# viscosity_wall = ViscosityMorris(nu=nu)
7085
boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass,
7186
state_equation=state_equation,
7287
boundary_density_calculator,
7388
smoothing_kernel, smoothing_length,
7489
correction=nothing,
75-
reference_particle_spacing=0)
90+
reference_particle_spacing=0,
91+
viscosity=viscosity_wall)
7692

7793
boundary_system = BoundarySPHSystem(tank.boundary, boundary_model, adhesion_coefficient=0.0)
7894

examples/fluid/dam_break_2phase_2d.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ water_viscosity = ViscosityMorris(nu=nu_sim_water)
3737

3838
trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"),
3939
sol=nothing, fluid_particle_spacing=fluid_particle_spacing,
40-
viscosity=water_viscosity, smoothing_length=smoothing_length,
40+
viscosity_fluid=water_viscosity, smoothing_length=smoothing_length,
4141
gravity=gravity, tspan=tspan, density_diffusion=nothing,
4242
sound_speed=sound_speed, exponent=7,
4343
tank_size=(floor(5.366 * H / fluid_particle_spacing) * fluid_particle_spacing,

examples/fluid/dam_break_oil_film_2d.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ oil_viscosity = ViscosityMorris(nu=nu_sim_oil)
3030
# TODO: broken if both systems use surface tension
3131
trixi_include(@__MODULE__, joinpath(examples_dir(), "fluid", "dam_break_2d.jl"),
3232
sol=nothing, fluid_particle_spacing=fluid_particle_spacing, tspan=tspan,
33-
viscosity=ViscosityMorris(nu=nu_sim_water), smoothing_length=smoothing_length,
33+
viscosity_fluid=ViscosityMorris(nu=nu_sim_water),
34+
smoothing_length=smoothing_length,
3435
gravity=gravity, density_diffusion=nothing, sound_speed=sound_speed,
3536
prefix="", reference_particle_spacing=fluid_particle_spacing)
3637

examples/fluid/hydrostatic_water_column_2d.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ smoothing_length = 1.2 * fluid_particle_spacing
3232
smoothing_kernel = SchoenbergCubicSplineKernel{2}()
3333

3434
alpha = 0.02
35-
viscosity = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0)
35+
viscosity_fluid = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0)
3636

3737
fluid_density_calculator = ContinuityDensity()
3838

3939
# This is to set acceleration with `trixi_include`
4040
system_acceleration = (0.0, -gravity)
4141
fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
4242
state_equation, smoothing_kernel,
43-
smoothing_length, viscosity=viscosity,
43+
smoothing_length, viscosity=viscosity_fluid,
4444
acceleration=system_acceleration,
4545
source_terms=nothing)
4646

examples/fluid/pipe_flow_2d.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ saving_callback = SolutionSavingCallback(dt=0.02, prefix="")
155155

156156
extra_callback = nothing
157157

158-
callbacks = CallbackSet(info_callback, saving_callback, UpdateCallback(), extra_callback)
158+
callbacks = CallbackSet(info_callback, saving_callback, UpdateCallback(),
159+
ParticleShiftingCallback(), extra_callback)
159160

160161
sol = solve(ode, RDPK3SpFSAL35(),
161162
abstol=1e-5, # Default abstol is 1e-6 (may need to be tuned to prevent boundary penetration)

examples/fluid/taylor_green_vortex_2d.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# P. Ramachandran, K. Puri
44
# "Entropically damped artificial compressibility for SPH".
55
# In: Computers and Fluids, Volume 179 (2019), pages 579-594.
6-
# https://doi.org/10.1016/j.compfluid.2018.11.023
6+
# https://doi.org/10.1016/j.compfluid.2018.11.023
77

88
using TrixiParticles
99
using OrdinaryDiffEq

0 commit comments

Comments
 (0)