Skip to content

Commit

Permalink
Merge branch 'trixi-framework:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ArseniyKholod authored Jun 16, 2023
2 parents acf8569 + 2bc1cc6 commit 41451f9
Show file tree
Hide file tree
Showing 224 changed files with 47,128 additions and 42,980 deletions.
8 changes: 8 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use SciML style: https://github.com/SciML/SciMLStyle
style = "sciml"

# Python style alignment. See https://github.com/domluna/JuliaFormatter.jl/pull/732.
yas_style_nesting = true

# Align struct fields for better readability of large struct definitions
align_struct_field = true
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1.8'
version: '1.9'
show-versioninfo: true
- uses: julia-actions/julia-buildpkg@v1
env:
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: format-check

on:
push:
branches:
- 'main'
tags: '*'
pull_request:

jobs:
check-format:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v3
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version = "0.13.0"))'
#
# TODO: Change the call below to
# format(".")
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(["benchmark", "ext", "src", "utils"])'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
2 changes: 1 addition & 1 deletion .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling
uses: crate-ci/[email protected].9
uses: crate-ci/[email protected].12
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-latest
version:
- '1.8'
- '1.9'
arch:
- x64
steps:
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8'
- '1.9'
# - '~1.9.0-0' # including development versions
# - 'nightly'
os:
- ubuntu-latest
Expand All @@ -79,18 +80,22 @@ jobs:
- threaded
include:
- version: '1.8'
os: ubuntu-latest
arch: x64
trixi_test: threaded_legacy
- version: '1.9'
os: macOS-latest
arch: x64
trixi_test: mpi
- version: '1.8'
- version: '1.9'
os: macOS-latest
arch: x64
trixi_test: threaded
- version: '1.8'
- version: '1.9'
os: windows-latest
arch: x64
trixi_test: mpi
- version: '1.8'
- version: '1.9'
os: windows-latest
arch: x64
trixi_test: threaded
Expand Down Expand Up @@ -121,7 +126,7 @@ jobs:
TRIXI_TEST: ${{ matrix.trixi_test }}
- uses: julia-actions/julia-processcoverage@v1
with:
directories: src,examples
directories: src,examples,ext
- uses: codecov/codecov-action@v3
with:
file: ./lcov.info
Expand Down
14 changes: 12 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>", "Jesse Chan <[email protected]>"]
version = "0.5.25-pre"
version = "0.5.29-pre"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down Expand Up @@ -42,6 +42,12 @@ Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344"
TriplotBase = "981d1d27-644d-49a2-9326-4793e63143c3"
TriplotRecipes = "808ab39a-a642-4abf-81ff-4cb34ebbffa3"

[weakdeps]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"

[extensions]
TrixiMakieExt = "Makie"

[compat]
CodeTracking = "1.0.5"
ConstructionBase = "1.3"
Expand All @@ -53,6 +59,7 @@ HDF5 = "0.14, 0.15, 0.16"
IfElse = "0.1"
LinearMaps = "2.7, 3.0"
LoopVectorization = "0.12.118"
Makie = "0.19"
MPI = "0.20"
MuladdMacro = "0.2.2"
Octavian = "0.3.5"
Expand All @@ -66,7 +73,7 @@ Requires = "1.1"
SciMLBase = "1.90"
Setfield = "0.8, 1"
SimpleUnPack = "1.1"
StartUpDG = "0.16"
StartUpDG = "0.17"
Static = "0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
StaticArrayInterface = "1.4"
StaticArrays = "1"
Expand All @@ -78,3 +85,6 @@ Triangulate = "2.0"
TriplotBase = "0.1"
TriplotRecipes = "0.1"
julia = "1.8"

[extras]
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ installation and postprocessing procedures. Its features include:
## Installation
If you have not yet installed Julia, please [follow the instructions for your
operating system](https://julialang.org/downloads/platform/). Trixi.jl works
with Julia v1.8.
with Julia v1.8 and newer. We recommend using the latest stable release of Julia.

### For users
Trixi.jl and its related tools are registered Julia packages. Hence, you
Expand Down
68 changes: 34 additions & 34 deletions benchmark/benchmark_ec.jl
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
using Printf, BenchmarkTools, Trixi

function run_benchmarks(benchmark_run; levels=0:5, polydeg=3)
runtimes = zeros(length(levels))
for (idx,initial_refinement_level) in enumerate(levels)
result = benchmark_run(; initial_refinement_level, polydeg)
display(result)
runtimes[idx] = result |> median |> time # in nanoseconds
end
return (; levels, runtimes, polydeg)
function run_benchmarks(benchmark_run; levels = 0:5, polydeg = 3)
runtimes = zeros(length(levels))
for (idx, initial_refinement_level) in enumerate(levels)
result = benchmark_run(; initial_refinement_level, polydeg)
display(result)
runtimes[idx] = result |> median |> time # in nanoseconds
end
return (; levels, runtimes, polydeg)
end

function tabulate_benchmarks(args...; kwargs...)
result = run_benchmarks(args...; kwargs...)
println("#Elements | Runtime in seconds")
for (level,runtime) in zip(result.levels, result.runtimes)
@printf("%9d | %.2e\n", 4^level, 1.0e-9 * runtime)
end
for (level,runtime) in zip(result.levels, result.runtimes)
@printf("%.16e\n", 1.0e-9 * runtime)
end
result = run_benchmarks(args...; kwargs...)
println("#Elements | Runtime in seconds")
for (level, runtime) in zip(result.levels, result.runtimes)
@printf("%9d | %.2e\n", 4^level, 1.0e-9*runtime)
end
for (level, runtime) in zip(result.levels, result.runtimes)
@printf("%.16e\n", 1.0e-9*runtime)
end
end

function benchmark_euler(; initial_refinement_level=1, polydeg=3)
function benchmark_euler(; initial_refinement_level = 1, polydeg = 3)
γ = 1.4
equations = CompressibleEulerEquations2D(γ)

γ = 1.4
equations = CompressibleEulerEquations2D(γ)
surface_flux = flux_ranocha
volume_flux = flux_ranocha
solver = DGSEM(polydeg, surface_flux, VolumeIntegralFluxDifferencing(volume_flux))

surface_flux = flux_ranocha
volume_flux = flux_ranocha
solver = DGSEM(polydeg, surface_flux, VolumeIntegralFluxDifferencing(volume_flux))
coordinates_min = (-2.0, -2.0)
coordinates_max = (2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level = initial_refinement_level,
n_cells_max = 100_000)

coordinates_min = (-2.0, -2.0)
coordinates_max = ( 2.0, 2.0)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=initial_refinement_level,
n_cells_max=100_000)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_weak_blast_wave,
solver)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_weak_blast_wave, solver)
t0 = 0.0
u0 = compute_coefficients(t0, semi)
du = similar(u0)

t0 = 0.0
u0 = compute_coefficients(t0, semi)
du = similar(u0)

@benchmark Trixi.rhs!($du, $u0, $semi, $t0)
@benchmark Trixi.rhs!($du, $u0, $semi, $t0)
end

# versioninfo(verbose=true)
@show Threads.nthreads()
tabulate_benchmarks(benchmark_euler, levels=0:8)
tabulate_benchmarks(benchmark_euler, levels = 0:8)
3 changes: 3 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Disable formatting this file since it contains highly unusual formatting for better
# readability
#! format: off

using BenchmarkTools
using Trixi
Expand Down
80 changes: 40 additions & 40 deletions benchmark/elixir_2d_euler_vortex_p4est.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,42 @@ The classical isentropic vortex test case of
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543)
"""
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D)
# needs appropriate mesh size, e.g. [-10,-10]x[10,10]
# make sure that the inicenter does not exit the domain, e.g. T=10.0
# initial center of the vortex
inicenter = SVector(0.0, 0.0)
# size and strength of the vortex
iniamplitude = 0.2
# base flow
rho = 1.0
v1 = 1.0
v2 = 1.0
vel = SVector(v1, v2)
p = 10.0
rt = p / rho # ideal gas equation
cent = inicenter + vel*t # advection of center
cent = x - cent # distance to centerpoint
#cent=cross(iniaxis,cent) # distance to axis, tangent vector, length r
# cross product with iniaxis = [0,0,1]
cent = SVector(-cent[2], cent[1])
r2 = cent[1]^2 + cent[2]^2
du = iniamplitude/(2*π)*exp(0.5*(1-r2)) # vel. perturbation
dtemp = -(equations.gamma-1)/(2*equations.gamma*rt)*du^2 # isentrop
rho = rho * (1+dtemp)^(1\(equations.gamma-1))
vel = vel + du*cent
v1, v2 = vel
p = p * (1+dtemp)^(equations.gamma/(equations.gamma-1))
prim = SVector(rho, v1, v2, p)
return prim2cons(prim, equations)
# needs appropriate mesh size, e.g. [-10,-10]x[10,10]
# make sure that the inicenter does not exit the domain, e.g. T=10.0
# initial center of the vortex
inicenter = SVector(0.0, 0.0)
# size and strength of the vortex
iniamplitude = 0.2
# base flow
rho = 1.0
v1 = 1.0
v2 = 1.0
vel = SVector(v1, v2)
p = 10.0
rt = p / rho # ideal gas equation
cent = inicenter + vel * t # advection of center
cent = x - cent # distance to centerpoint
#cent=cross(iniaxis,cent) # distance to axis, tangent vector, length r
# cross product with iniaxis = [0,0,1]
cent = SVector(-cent[2], cent[1])
r2 = cent[1]^2 + cent[2]^2
du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation
dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentrop
rho = rho * (1 + dtemp)^(1 \ (equations.gamma - 1))
vel = vel + du * cent
v1, v2 = vel
p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1))
prim = SVector(rho, v1, v2, p)
return prim2cons(prim, equations)
end
initial_condition = initial_condition_isentropic_vortex
solver = DGSEM(polydeg=3, surface_flux=flux_lax_friedrichs)
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)

coordinates_min = (-10.0, -10.0)
coordinates_max = ( 10.0, 10.0)
mesh = P4estMesh((1, 1), polydeg=Trixi.polydeg(solver),
coordinates_min=coordinates_min, coordinates_max=coordinates_max,
initial_refinement_level=4)

coordinates_max = (10.0, 10.0)
mesh = P4estMesh((1, 1), polydeg = Trixi.polydeg(solver),
coordinates_min = coordinates_min, coordinates_max = coordinates_max,
initial_refinement_level = 4)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

Expand All @@ -66,19 +65,20 @@ ode = semidiscretize(semi, tspan)
summary_callback = SummaryCallback()

analysis_interval = 100
analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true,
extra_analysis_errors=(:conservation_error,),
extra_analysis_integrals=(entropy, energy_total,
energy_kinetic, energy_internal))
analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
save_analysis = true,
extra_analysis_errors = (:conservation_error,),
extra_analysis_integrals = (entropy, energy_total,
energy_kinetic,
energy_internal))

alive_callback = AliveCallback(analysis_interval=analysis_interval)
alive_callback = AliveCallback(analysis_interval = analysis_interval)

callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback)


###############################################################################
# run the simulation

sol = solve(ode, BS3(),
save_everystep=false, callback=callbacks);
save_everystep = false, callback = callbacks);
summary_callback() # print the timer summary
Loading

0 comments on commit 41451f9

Please sign in to comment.