Skip to content

Commit

Permalink
Merge branch 'main' into edac-tvf
Browse files Browse the repository at this point in the history
  • Loading branch information
LasNikas committed Jun 17, 2024
2 parents b7d3c4e + ad90288 commit 55ef6f2
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
version: '1'
show-versioninfo: true
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- name: Build package
uses: julia-actions/julia-buildpkg@v1
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
version: '1'
- run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)'
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- name: Build package
uses: julia-actions/julia-buildpkg@v1
- name: Run unit tests
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"orcid": "0000-0001-6083-7038"
},
{
"affiliation": "Applied and Computational Mathematics, RWTH Aachen University, Germany",
"affiliation": "High-Performance Scientific Computing, University of Augsburg, Germany",
"name": "Schlottke-Lakemper, Michael",
"orcid": "0000-0002-3195-2536"
},
Expand Down
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to
[Michael Schlottke-Lakemper](mailto:m.schlottke-lakemper@acom.rwth-aachen.de),
[Michael Schlottke-Lakemper](mailto:michael.schlottke-lakemper@uni-a.de),
[Sven Berger](mailto:[email protected]),
or any other of the principal developers responsible for enforcement listed in
[AUTHORS.md](AUTHORS.md).
Expand Down Expand Up @@ -128,4 +128,4 @@ enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
https://www.contributor-covenant.org/translations.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ with the help of TrixiParticles.jl, please cite it as
## Authors
Erik Faulhaber (University of Cologne) and Niklas Neher (HLRS) implemented the foundations
for TrixiParticles.jl and are principal developers along with Sven Berger (hereon).
The project was started by Michael Schlottke-Lakemper (RWTH Aachen University/HLRS)
The project was started by Michael Schlottke-Lakemper (University of Augsburg)
and Gregor Gassner (University of Cologne), who provide scientific direction and technical advice.
The full list of contributors can be found in [AUTHORS.md](AUTHORS.md).

Expand Down
2 changes: 1 addition & 1 deletion examples/n_body/n_body_system.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using TrixiParticles
using LinearAlgebra

struct NBodySystem{NDIMS, ELTYPE <: Real} <: TrixiParticles.System{NDIMS}
struct NBodySystem{NDIMS, ELTYPE <: Real} <: TrixiParticles.System{NDIMS, Nothing}
initial_condition :: InitialCondition{ELTYPE}
mass :: Array{ELTYPE, 1} # [particle]
G :: ELTYPE
Expand Down
3 changes: 1 addition & 2 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ end
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
return interval > 0 && (((integrator.stats.naccept % interval == 0) &&
!(integrator.stats.naccept == 0 && integrator.iter > 0)) ||
return interval > 0 && ((integrator.stats.naccept % interval == 0) ||
(save_final_solution && isfinished(integrator)))
end

Expand Down
8 changes: 1 addition & 7 deletions src/callbacks/density_reinit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ end
function (reinit_callback::DensityReinitializationCallback{Int})(u, t, integrator)
(; interval) = reinit_callback

# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
return interval > 0 && ((integrator.stats.naccept % interval == 0) &&
!(integrator.stats.naccept == 0 && integrator.iter > 0))
return condition_integrator_interval(integrator, interval, save_final_solution=false)
end

# condition with dt
Expand Down
13 changes: 9 additions & 4 deletions src/general/general.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
abstract type System{NDIMS} end
# Abstract supertype for all system types. We additionally store the type of the system's
# initial condition, which is `Nothing` when using KernelAbstractions.jl.
abstract type System{NDIMS, IC} end

abstract type FluidSystem{NDIMS} <: System{NDIMS} end
# When using KernelAbstractions.jl, the initial condition has been replaced by `nothing`
GPUSystem = System{NDIMS, Nothing} where {NDIMS}

abstract type FluidSystem{NDIMS, IC} <: System{NDIMS, IC} end
timer_name(::FluidSystem) = "fluid"

abstract type SolidSystem{NDIMS} <: System{NDIMS} end
abstract type SolidSystem{NDIMS, IC} <: System{NDIMS, IC} end
timer_name(::SolidSystem) = "solid"

abstract type BoundarySystem{NDIMS} <: System{NDIMS} end
abstract type BoundarySystem{NDIMS, IC} <: System{NDIMS, IC} end
timer_name(::BoundarySystem) = "boundary"

@inline function set_zero!(du)
Expand Down
2 changes: 2 additions & 0 deletions src/general/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ struct Semidiscretization{S, RU, RV, NS}
end
end

GPUSemidiscretization = Semidiscretization{<:NTuple{<:Any, GPUSystem}}

function Semidiscretization(systems...; neighborhood_search=GridNeighborhoodSearch,
periodic_box_min_corner=nothing,
periodic_box_max_corner=nothing, threaded_nhs_update=true)
Expand Down
19 changes: 10 additions & 9 deletions src/schemes/boundary/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ The interaction between fluid and boundary particles is specified by the boundar
- `adhesion_coefficient`: Coefficient specifying the adhesion of a fluid to the surface.
Note: currently it is assumed that all fluids have the same adhesion coefficient.
"""
struct BoundarySPHSystem{BM, NDIMS, ELTYPE <: Real, IC, CO, M, IM, CA} <:
BoundarySystem{NDIMS}
struct BoundarySPHSystem{BM, NDIMS, ELTYPE, IC, CO, M, IM, CA} <: BoundarySystem{NDIMS, IC}
initial_condition :: IC
coordinates :: CO # Array{ELTYPE, 2}
boundary_model :: BM
Expand Down Expand Up @@ -68,20 +67,22 @@ The interaction between fluid and boundary particles is specified by the boundar
This is an experimental feature and may change in a future releases.
"""
struct BoundaryDEMSystem{NDIMS, ELTYPE <: Real, ARRAY1D, ARRAY2D} <: BoundarySystem{NDIMS}
coordinates :: ARRAY2D # [dimension, particle]
radius :: ARRAY1D # [particle]
normal_stiffness :: ELTYPE
struct BoundaryDEMSystem{NDIMS, ELTYPE <: Real, IC,
ARRAY1D, ARRAY2D} <: BoundarySystem{NDIMS, IC}
initial_condition :: IC
coordinates :: ARRAY2D # [dimension, particle]
radius :: ARRAY1D # [particle]
normal_stiffness :: ELTYPE

function BoundaryDEMSystem(initial_condition, normal_stiffness)
coordinates = initial_condition.coordinates
radius = 0.5 * initial_condition.particle_spacing *
ones(length(initial_condition.mass))
NDIMS = size(coordinates, 1)

return new{NDIMS, eltype(coordinates), typeof(radius), typeof(coordinates)}(coordinates,
radius,
normal_stiffness)
return new{NDIMS, eltype(coordinates), typeof(initial_condition),
typeof(radius), typeof(coordinates)}(initial_condition, coordinates,
radius, normal_stiffness)
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/schemes/fluid/entropically_damped_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ See [Entropically Damped Artificial Compressibility for SPH](@ref edac) for more
gravity-like source terms.
"""
struct EntropicallyDampedSPHSystem{NDIMS, ELTYPE <: Real, IC, M, DC, K, V, TV,
PF, ST, C} <: FluidSystem{NDIMS}
PF, ST, C} <: FluidSystem{NDIMS, IC}
initial_condition :: IC
mass :: M # Vector{ELTYPE}: [particle]
density_calculator :: DC
Expand Down
2 changes: 1 addition & 1 deletion src/schemes/fluid/weakly_compressible_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ See [Weakly Compressible SPH](@ref wcsph) for more details on the method.
"""
struct WeaklyCompressibleSPHSystem{NDIMS, ELTYPE <: Real, IC, MA, P, DC, SE, K,
V, DD, COR, PF, ST, SRFT, C} <: FluidSystem{NDIMS}
V, DD, COR, PF, ST, SRFT, C} <: FluidSystem{NDIMS, IC}
initial_condition :: IC
mass :: MA # Array{ELTYPE, 1}
pressure :: P # Array{ELTYPE, 1}
Expand Down
6 changes: 3 additions & 3 deletions src/schemes/solid/discrete_element_method/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ specified material properties and contact mechanics.
!!! warning "Experimental Implementation"
This is an experimental feature and may change in a future releases.
"""
struct DEMSystem{NDIMS, ELTYPE <: Real, ARRAY1D, ST} <: SolidSystem{NDIMS}
initial_condition :: InitialCondition{ELTYPE}
struct DEMSystem{NDIMS, ELTYPE <: Real, IC, ARRAY1D, ST} <: SolidSystem{NDIMS, IC}
initial_condition :: IC
mass :: ARRAY1D # [particle]
radius :: ARRAY1D # [particle]
elastic_modulus :: ELTYPE
Expand All @@ -53,7 +53,7 @@ struct DEMSystem{NDIMS, ELTYPE <: Real, ARRAY1D, ST} <: SolidSystem{NDIMS}
throw(ArgumentError("`acceleration` must be of length $NDIMS for a $(NDIMS)D problem"))
end

return new{NDIMS, ELTYPE, typeof(mass),
return new{NDIMS, ELTYPE, typeof(initial_condition), typeof(mass),
typeof(source_terms)}(initial_condition, mass, radius, elastic_modulus,
poissons_ratio, normal_stiffness,
damping_coefficient, acceleration_, source_terms)
Expand Down
2 changes: 1 addition & 1 deletion src/schemes/solid/total_lagrangian_sph/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ See [Total Lagrangian SPH](@ref tlsph) for more details on the method.
where `beam` and `fixed_particles` are of type `InitialCondition`.
"""
struct TotalLagrangianSPHSystem{BM, NDIMS, ELTYPE <: Real, IC, ARRAY1D, ARRAY2D, ARRAY3D,
K, PF, ST} <: SolidSystem{NDIMS}
K, PF, ST} <: SolidSystem{NDIMS, IC}
initial_condition :: IC
initial_coordinates :: ARRAY2D # Array{ELTYPE, 2}: [dimension, particle]
current_coordinates :: ARRAY2D # Array{ELTYPE, 2}: [dimension, particle]
Expand Down
6 changes: 3 additions & 3 deletions test/general/semidiscretization.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use `@trixi_testset` to isolate the mock functions in a separate namespace
@trixi_testset "Semidiscretization" begin
# Mock systems
struct System1 <: TrixiParticles.System{3} end
struct System2 <: TrixiParticles.System{3} end
struct System1 <: TrixiParticles.System{3, Nothing} end
struct System2 <: TrixiParticles.System{3, Nothing} end

system1 = System1()
system2 = System2()
Expand Down Expand Up @@ -39,7 +39,7 @@
struct BoundaryModelMock end

# Mock fluid system
struct FluidSystemMock <: TrixiParticles.FluidSystem{2} end
struct FluidSystemMock <: TrixiParticles.FluidSystem{2, Nothing} end

kernel = Val(:smoothing_kernel)
Base.ndims(::Val{:smoothing_kernel}) = 2
Expand Down

0 comments on commit 55ef6f2

Please sign in to comment.