Skip to content
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

Validation TVF #640

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion examples/fluid/taylor_green_vortex_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ background_pressure = sound_speed^2 * fluid_density
smoothing_length = 1.0 * particle_spacing
smoothing_kernel = SchoenbergQuinticSplineKernel{2}()

# To be set via `trixi_include`
perturb_coordinates = true
fluid = RectangularShape(particle_spacing, (n_particles_xy, n_particles_xy), (0.0, 0.0),
coordinates_perturbation=0.2, # To avoid stagnant streamlines when not using TVF.
# Perturb particle coordinates to avoid stagnant streamlines without TVF
coordinates_perturbation=perturb_coordinates ? 0.2 : nothing, # To avoid stagnant streamlines when not using TVF.
density=fluid_density, pressure=initial_pressure_function,
velocity=initial_velocity_function)

density_calculator = SummationDensity()
fluid_system = EntropicallyDampedSPHSystem(fluid, smoothing_kernel, smoothing_length,
sound_speed,
density_calculator=density_calculator,
transport_velocity=TransportVelocityAdami(background_pressure),
viscosity=ViscosityAdami(; nu))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ particle_spacings = [0.02, 0.01, 0.005]
tspan = (0.0, 5.0)
reynolds_number = 100.0

density_calculators = [SummationDensity(), ContinuityDensity()]
perturb_coordinates = [false, true]

function compute_l1v_error(v, u, t, system)
v_analytical_avg = 0.0
v_avg = 0.0
Expand Down Expand Up @@ -60,10 +63,16 @@ function diff_p_loc_p_avg(v, u, t, system)
return v[end, :] .- p_avg_tot
end

for particle_spacing in particle_spacings
for density_calculator in density_calculators, perturbation in perturb_coordinates,
particle_spacing in particle_spacings

n_particles_xy = round(Int, 1.0 / particle_spacing)

output_directory = joinpath("out_tgv",
name_density_calculator = density_calculator isa SummationDensity ?
"summation_density" : "continuity_density"
name_perturbation = perturbation ? "perturbed" : ""

output_directory = joinpath("out_tgv", "$(name_density_calculator)_$name_perturbation",
"validation_run_taylor_green_vortex_2d_nparticles_$(n_particles_xy)x$(n_particles_xy)")
saving_callback = SolutionSavingCallback(dt=0.02,
output_directory=output_directory,
Expand All @@ -79,6 +88,8 @@ for particle_spacing in particle_spacings
# Import variables into scope
trixi_include(@__MODULE__,
joinpath(examples_dir(), "fluid", "taylor_green_vortex_2d.jl"),
density_calculator=density_calculator,
perturb_coordinates=perturbation,
particle_spacing=particle_spacing, reynolds_number=reynolds_number,
tspan=tspan, saving_callback=saving_callback, pp_callback=pp_callback)
end
Loading