Skip to content

Commit

Permalink
Add numerical support of other real types (laplace) (trixi-framewor…
Browse files Browse the repository at this point in the history
…k#2025)

* start

* reformat

* Update test/test_type.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update test/test_type.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update test/test_type.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

---------

Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
huiyuxie and ranocha authored Aug 20, 2024
1 parent ba82d36 commit 1c1d5ea
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions test/test_type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,69 @@ isdir(outdir) && rm(outdir, recursive = true)
end
end

@timed_testset "Laplace Diffusion 1D" begin
for RealT in (Float32, Float64)
equations = @inferred LinearScalarAdvectionEquation1D(RealT(1))
equations_parabolic = @inferred LaplaceDiffusion1D(RealT(0.1), equations)

x = SVector(zero(RealT))
t = zero(RealT)
u = gradients = SVector(one(RealT))
orientation = 1

@test eltype(@inferred flux(u, gradients, orientation, equations_parabolic)) ==
RealT

# TODO: BC tests for BoundaryConditionDirichlet
# TODO: BC tests for BoundaryConditionNeumann
end
end

@timed_testset "Laplace Diffusion 2D" begin
for RealT in (Float32, Float64)
equations = LinearScalarAdvectionEquation2D(RealT(1), RealT(1))
equations_parabolic = LaplaceDiffusion2D(RealT(0.1), equations)

x = SVector(zero(RealT), zero(RealT))
t = zero(RealT)
u = u_inner = u_outer = inv_h = gradients = SVector(one(RealT), one(RealT))
orientations = [1, 2]

for orientation in orientations
@test eltype(@inferred flux(u, gradients, orientation, equations_parabolic)) ==
RealT
end

parabolic_solver = ViscousFormulationLocalDG(RealT(0.1))
@test eltype(@inferred Trixi.penalty(u_outer, u_inner, inv_h,
equations_parabolic, parabolic_solver)) ==
RealT
end
end

@timed_testset "Laplace Diffusion 3D" begin
for RealT in (Float32, Float64)
equations = LinearScalarAdvectionEquation3D(RealT(1), RealT(1), RealT(1))
equations_parabolic = LaplaceDiffusion3D(RealT(0.1), equations)

x = SVector(zero(RealT), zero(RealT), zero(RealT))
t = zero(RealT)
u = u_inner = u_outer = inv_h = gradients = SVector(one(RealT), one(RealT),
one(RealT))
orientations = [1, 2, 3]

for orientation in orientations
@test eltype(@inferred flux(u, gradients, orientation, equations_parabolic)) ==
RealT
end

parabolic_solver = ViscousFormulationLocalDG(RealT(0.1))
@test eltype(@inferred Trixi.penalty(u_outer, u_inner, inv_h,
equations_parabolic, parabolic_solver)) ==
RealT
end
end

@timed_testset "Lattice Boltzmann 2D" begin
for RealT in (Float32, Float64)
equations = @inferred LatticeBoltzmannEquations2D(Ma = RealT(0.1), Re = 1000)
Expand Down

0 comments on commit 1c1d5ea

Please sign in to comment.