@@ -44,7 +44,7 @@ See [Entropically Damped Artificial Compressibility for SPH](@ref edac) for more
4444 gravity-like source terms.
4545"""
4646struct EntropicallyDampedSPHSystem{NDIMS, ELTYPE <: Real , IC, M, DC, K, V, TV,
47- PF, ST, B, C} <: FluidSystem{NDIMS, IC}
47+ PF, ST, B, PR, C} <: FluidSystem{NDIMS, IC}
4848 initial_condition :: IC
4949 mass :: M # Vector{ELTYPE}: [particle]
5050 density_calculator :: DC
@@ -59,55 +59,55 @@ struct EntropicallyDampedSPHSystem{NDIMS, ELTYPE <: Real, IC, M, DC, K, V, TV,
5959 transport_velocity :: TV
6060 source_terms :: ST
6161 buffer :: B
62+ particle_refinement :: PR
6263 cache :: C
64+ end
6365
64- function EntropicallyDampedSPHSystem (initial_condition, smoothing_kernel,
65- smoothing_length, sound_speed;
66- pressure_acceleration= inter_particle_averaged_pressure,
67- density_calculator= SummationDensity (),
68- transport_velocity= nothing ,
69- alpha= 0.5 , viscosity= nothing ,
70- acceleration= ntuple (_ -> 0.0 ,
71- ndims (smoothing_kernel)),
72- source_terms= nothing , buffer_size= nothing )
73- buffer = isnothing (buffer_size) ? nothing :
74- SystemBuffer (nparticles (initial_condition), buffer_size)
66+ function EntropicallyDampedSPHSystem (initial_condition, smoothing_kernel,
67+ smoothing_length, sound_speed;
68+ pressure_acceleration= inter_particle_averaged_pressure,
69+ density_calculator= SummationDensity (),
70+ transport_velocity= nothing ,
71+ alpha= 0.5 , viscosity= nothing ,
72+ acceleration= ntuple (_ -> 0.0 ,
73+ ndims (smoothing_kernel)),
74+ particle_refinement= nothing ,
75+ source_terms= nothing , buffer_size= nothing )
76+ buffer = isnothing (buffer_size) ? nothing :
77+ SystemBuffer (nparticles (initial_condition), buffer_size)
7578
76- initial_condition = allocate_buffer (initial_condition, buffer)
79+ initial_condition = allocate_buffer (initial_condition, buffer)
7780
78- NDIMS = ndims (initial_condition)
79- ELTYPE = eltype (initial_condition)
81+ NDIMS = ndims (initial_condition)
82+ ELTYPE = eltype (initial_condition)
8083
81- mass = copy (initial_condition. mass)
84+ mass = copy (initial_condition. mass)
8285
83- if ndims (smoothing_kernel) != NDIMS
84- throw (ArgumentError (" smoothing kernel dimensionality must be $NDIMS for a $(NDIMS) D problem" ))
85- end
86+ if ndims (smoothing_kernel) != NDIMS
87+ throw (ArgumentError (" smoothing kernel dimensionality must be $NDIMS for a $(NDIMS) D problem" ))
88+ end
8689
87- acceleration_ = SVector (acceleration... )
88- if length (acceleration_) != NDIMS
89- throw (ArgumentError (" `acceleration` must be of length $NDIMS for a $(NDIMS) D problem" ))
90- end
90+ acceleration_ = SVector (acceleration... )
91+ if length (acceleration_) != NDIMS
92+ throw (ArgumentError (" `acceleration` must be of length $NDIMS for a $(NDIMS) D problem" ))
93+ end
9194
92- pressure_acceleration = choose_pressure_acceleration_formulation (pressure_acceleration,
93- density_calculator,
94- NDIMS, ELTYPE,
95- nothing )
95+ pressure_acceleration = choose_pressure_acceleration_formulation (pressure_acceleration,
96+ density_calculator,
97+ NDIMS, ELTYPE,
98+ nothing )
9699
97- nu_edac = (alpha * smoothing_length * sound_speed) / 8
100+ nu_edac = (alpha * smoothing_length * sound_speed) /
101+ (2 * ndims (initial_condition) + 4 )
98102
99- cache = create_cache_density (initial_condition, density_calculator)
100- cache = (; create_cache_edac (initial_condition, transport_velocity)... , cache... )
103+ cache = create_cache_density (initial_condition, density_calculator)
104+ cache = (; create_cache_edac (initial_condition, transport_velocity)... , cache... )
101105
102- new{NDIMS, ELTYPE, typeof (initial_condition), typeof (mass),
103- typeof (density_calculator), typeof (smoothing_kernel), typeof (viscosity),
104- typeof (transport_velocity), typeof (pressure_acceleration), typeof (source_terms),
105- typeof (buffer),
106- typeof (cache)}(initial_condition, mass, density_calculator, smoothing_kernel,
107- smoothing_length, sound_speed, viscosity, nu_edac, acceleration_,
108- nothing , pressure_acceleration, transport_velocity, source_terms,
109- buffer, cache)
110- end
106+ return EntropicallyDampedSPHSystem (initial_condition, mass, density_calculator,
107+ smoothing_kernel, smoothing_length, sound_speed,
108+ viscosity, nu_edac, acceleration_, nothing ,
109+ pressure_acceleration, transport_velocity,
110+ source_terms, buffer, particle_refinement, cache)
111111end
112112
113113function Base. show (io:: IO , system:: EntropicallyDampedSPHSystem )
0 commit comments