-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into tafuni-open-boundaries
- Loading branch information
Showing
33 changed files
with
987 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "TrixiParticles" | ||
uuid = "66699cd8-9c01-4e9d-a059-b96c86d16b3a" | ||
authors = ["erik.faulhaber <[email protected]>"] | ||
version = "0.2.3-dev" | ||
version = "0.2.4-dev" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
|
@@ -21,6 +21,7 @@ MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221" | |
PointNeighbors = "1c4d5385-0a27-49de-8e2c-43b175c8985c" | ||
Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588" | ||
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" | ||
Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | ||
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" | ||
|
@@ -35,19 +36,19 @@ Adapt = "3, 4" | |
CSV = "0.10" | ||
DataFrames = "1.6" | ||
DelimitedFiles = "1" | ||
DiffEqCallbacks = "2.25, 3" | ||
DiffEqCallbacks = "2, 3, 4" | ||
FastPow = "0.1" | ||
FileIO = "1" | ||
ForwardDiff = "0.10" | ||
GPUArraysCore = "0.1" | ||
GPUArraysCore = "0.1, 0.2" | ||
JSON = "0.21" | ||
KernelAbstractions = "0.9" | ||
MuladdMacro = "0.2" | ||
PointNeighbors = "0.4.2" | ||
Polyester = "0.7.10" | ||
RecipesBase = "1" | ||
Reexport = "1" | ||
SciMLBase = "1, 2" | ||
SciMLBase = "2" | ||
StaticArrays = "1" | ||
StrideArrays = "0.1" | ||
TimerOutputs = "0.5.25" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Lid-driven cavity | ||
# | ||
# S. Adami et al | ||
# "A transport-velocity formulation for smoothed particle hydrodynamics". | ||
# In: Journal of Computational Physics, Volume 241 (2013), pages 292-307. | ||
# https://doi.org/10.1016/j.jcp.2013.01.043 | ||
|
||
using TrixiParticles | ||
using OrdinaryDiffEq | ||
|
||
# ========================================================================================== | ||
# ==== Resolution | ||
particle_spacing = 0.02 | ||
|
||
# Make sure that the kernel support of fluid particles at a boundary is always fully sampled | ||
boundary_layers = 4 | ||
|
||
# ========================================================================================== | ||
# ==== Experiment Setup | ||
tspan = (0.0, 5.0) | ||
reynolds_number = 100.0 | ||
|
||
cavity_size = (1.0, 1.0) | ||
|
||
fluid_density = 1.0 | ||
|
||
const VELOCITY_LID = 1.0 | ||
sound_speed = 10 * VELOCITY_LID | ||
|
||
pressure = sound_speed^2 * fluid_density | ||
|
||
viscosity = ViscosityAdami(; nu=VELOCITY_LID / reynolds_number) | ||
|
||
cavity = RectangularTank(particle_spacing, cavity_size, cavity_size, fluid_density, | ||
n_layers=boundary_layers, | ||
faces=(true, true, true, false), pressure=pressure) | ||
|
||
lid_position = 0.0 - particle_spacing * boundary_layers | ||
lid_length = cavity.n_particles_per_dimension[1] + 2boundary_layers | ||
|
||
lid = RectangularShape(particle_spacing, (lid_length, 3), | ||
(lid_position, cavity_size[2]), density=fluid_density) | ||
|
||
# ========================================================================================== | ||
# ==== Fluid | ||
|
||
smoothing_length = 1.0 * particle_spacing | ||
smoothing_kernel = SchoenbergQuinticSplineKernel{2}() | ||
|
||
fluid_system = EntropicallyDampedSPHSystem(cavity.fluid, smoothing_kernel, smoothing_length, | ||
density_calculator=ContinuityDensity(), | ||
sound_speed, viscosity=viscosity, | ||
transport_velocity=TransportVelocityAdami(pressure)) | ||
|
||
# ========================================================================================== | ||
# ==== Boundary | ||
|
||
lid_movement_function(t) = SVector(VELOCITY_LID * t, 0.0) | ||
|
||
is_moving(t) = true | ||
|
||
lid_movement = BoundaryMovement(lid_movement_function, is_moving) | ||
|
||
boundary_model_cavity = BoundaryModelDummyParticles(cavity.boundary.density, | ||
cavity.boundary.mass, | ||
AdamiPressureExtrapolation(), | ||
viscosity=viscosity, | ||
smoothing_kernel, smoothing_length) | ||
|
||
boundary_model_lid = BoundaryModelDummyParticles(lid.density, lid.mass, | ||
AdamiPressureExtrapolation(), | ||
viscosity=viscosity, | ||
smoothing_kernel, smoothing_length) | ||
|
||
boundary_system_cavity = BoundarySPHSystem(cavity.boundary, boundary_model_cavity) | ||
|
||
boundary_system_lid = BoundarySPHSystem(lid, boundary_model_lid, movement=lid_movement) | ||
|
||
# ========================================================================================== | ||
# ==== Simulation | ||
bnd_thickness = boundary_layers * particle_spacing | ||
periodic_box = PeriodicBox(min_corner=[-bnd_thickness, -bnd_thickness], | ||
max_corner=cavity_size .+ [bnd_thickness, bnd_thickness]) | ||
|
||
semi = Semidiscretization(fluid_system, boundary_system_cavity, boundary_system_lid, | ||
neighborhood_search=GridNeighborhoodSearch{2}(; periodic_box)) | ||
|
||
ode = semidiscretize(semi, tspan) | ||
|
||
info_callback = InfoCallback(interval=100) | ||
|
||
saving_callback = SolutionSavingCallback(dt=0.02) | ||
|
||
pp_callback = nothing | ||
|
||
callbacks = CallbackSet(info_callback, saving_callback, pp_callback, UpdateCallback()) | ||
|
||
# Use a Runge-Kutta method with automatic (error based) time step size control | ||
sol = solve(ode, RDPK3SpFSAL49(), | ||
abstol=1e-6, # Default abstol is 1e-6 (may needs to be tuned to prevent boundary penetration) | ||
reltol=1e-4, # Default reltol is 1e-3 (may needs to be tuned to prevent boundary penetration) | ||
dtmax=1e-2, # Limit stepsize to prevent crashing | ||
maxiters=Int(1e7), | ||
save_everystep=false, callback=callbacks); |
Oops, something went wrong.