Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/dgsem_t8code/containers_parallel.jl
5590 views
1
function reinitialize_containers!(mesh::T8codeMeshParallel, equations, dg::DGSEM, cache)
2
@unpack elements, interfaces, boundaries, mortars, mpi_interfaces, mpi_mortars,
3
mpi_cache = cache
4
5
n_cells = ncells(mesh)
6
7
resize!(elements, n_cells)
8
init_elements!(elements, mesh, dg.basis)
9
10
# Resize volume integral and related datastructures
11
@unpack volume_integral = dg
12
resize_volume_integral_cache!(cache, mesh, volume_integral, n_cells)
13
reinit_volume_integral_cache!(cache, mesh, dg, volume_integral, n_cells)
14
15
count_required_surfaces!(mesh)
16
required = count_required_surfaces(mesh)
17
18
resize!(interfaces, required.interfaces)
19
20
resize!(boundaries, required.boundaries)
21
22
resize!(mortars, required.mortars)
23
24
resize!(mpi_interfaces, required.mpi_interfaces)
25
26
resize!(mpi_mortars, required.mpi_mortars)
27
28
mpi_mesh_info = (mpi_mortars = mpi_mortars,
29
mpi_interfaces = mpi_interfaces,
30
31
# Temporary arrays for updating `mpi_cache`.
32
global_mortar_ids = fill(UInt128(0), nmpimortars(mpi_mortars)),
33
global_interface_ids = fill(UInt128(0),
34
nmpiinterfaces(mpi_interfaces)),
35
neighbor_ranks_mortar = Vector{Vector{Int}}(undef,
36
nmpimortars(mpi_mortars)),
37
neighbor_ranks_interface = fill(-1, nmpiinterfaces(mpi_interfaces)))
38
39
fill_mesh_info!(mesh, interfaces, mortars, boundaries,
40
mesh.boundary_names; mpi_mesh_info = mpi_mesh_info)
41
42
init_mpi_cache!(mpi_cache, mesh, mpi_mesh_info, nvariables(equations), nnodes(dg),
43
eltype(elements))
44
45
empty!(mpi_mesh_info.global_mortar_ids)
46
empty!(mpi_mesh_info.global_interface_ids)
47
empty!(mpi_mesh_info.neighbor_ranks_mortar)
48
empty!(mpi_mesh_info.neighbor_ranks_interface)
49
50
# Re-initialize and distribute normal directions of MPI mortars; requires
51
# MPI communication, so the MPI cache must be re-initialized beforehand.
52
init_normal_directions!(mpi_mortars, dg.basis, elements)
53
exchange_normal_directions!(mpi_mortars, mpi_cache, mesh, nnodes(dg))
54
55
return nothing
56
end
57
58
# Compatibility to `dgsem_p4est/containers.jl`.
59
function init_mpi_interfaces!(interfaces, mesh::T8codeMeshParallel)
60
# Do nothing.
61
return nothing
62
end
63
64
# Compatibility to `dgsem_p4est/containers.jl`.
65
function init_mpi_mortars!(mortars, mesh::T8codeMeshParallel)
66
# Do nothing.
67
return nothing
68
end
69
70
# Compatibility to `dgsem_p4est/containers_parallel.jl`.
71
function init_mpi_mortars!(mpi_mortars, mesh::T8codeMeshParallel, basis, elements)
72
# Do nothing.
73
return nothing
74
end
75
76