You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
A multiple dimensional BC, supporting arbitrary BCs at each boundary point.
363
-
To construct an arbitrary BC, pass an Array of BCs with dimension one less than that of your domain u - denoted N,
364
-
with a size of size(u)[setdiff(1:N, dim)], where dim is the dimension orthogonal to the boundary that you want to extend.
365
-
366
-
It is also possible to call
367
-
Q_dim = MultiDimBC(YourBC, size(u), dim)
368
-
to use YourBC for the whole boundary orthogonal to that dimension.
369
-
370
-
Further, it is possible to call
371
-
Qx, Qy, Qz... = MultiDimBC(YourBC, size(u))
372
-
to use YourBC for the whole boundary for all dimensions. Valid for any number of dimensions greater than 1.
373
-
However this is only valid for Robin/General type BCs (including neummann/dirichlet) when the grid steps are equal in each dimension - including uniform grid case.
374
-
375
-
In the case where you want to extend the same Robin/GeneralBC to the whole boundary with a non unifrom grid, please use
#Extra constructor to make a set of BC operators that extend an atomic BC Operator to the whole domain
387
-
#Only valid in the uniform grid case!
388
-
MultiDimBC(BC::B, s) where {B} =Tuple([MultiDimDirectionalBC{gettype(BC), B, dim, length(s), length(s)-1}(fill(BC, s[setdiff(1:length(s), dim)])) for dim in1:length(s)])
389
-
390
-
# Additional constructors for cases when the BC is the same for all boundarties
391
-
392
-
PeriodicBC{T}(s) where T =MultiDimBC(PeriodicBC{T}(), s)
393
-
394
-
NeumannBC(α::AbstractVector{T}, dxyz, order, s) where T =RobinBC([zero(T), one(T), α[1]], [zero(T), one(T), α[2]], dxyz, order, s)
395
-
DirichletBC(αl::T, αr::T, s) where T =RobinBC([one(T), zero(T), αl], [one(T), zero(T), αr], [ones(T, si) for si in s], 2.0, s)
throw("hilo2 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim2 of u2 or \"low\" to connect along the lower index end")
throw("hilo2 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim2 of u2 or \"low\" to connect along the lower index end")
450
-
end
451
-
else
452
-
throw("hilo1 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim1 of u1 or \"low\" to connect along the lower index end")
BC1[i, j] =MixedBC(BridgeBC{T, N, eltype(s1)}(zeros(T, 1), view(view2, i, j), zeros(T, 1), view(view2, i, j)), bc1.BCs[i,j])
479
-
BC2[i, j] =MixedBC(bc2.BCs[i,j], BridgeBC{T, N, eltype(s1)}(zeros(T, 1), view(view1, i, j), zeros(T, 1), view(view1, i, j)))
480
-
end
481
-
else
482
-
throw("hilo2 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim2 of u2 or \"low\" to connect along the lower index end")
BC1[i, j] =MixedBC(bc1.BCs[i,j], BridgeBC{T, N, eltype(s1)}(zeros(T, 1), view(view2, i, j), zeros(T, 1), view(view2, i, j)))
501
-
BC2[i, j] =MixedBC(bc2.BCs[i,j], BridgeBC{T, N, eltype(s1)}(zeros(T, 1), view(view1, i, j), zeros(T, 1), view(view1, i, j)))
502
-
end
503
-
else
504
-
throw("hilo2 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim2 of u2 or \"low\" to connect along the lower index end")
505
-
end
506
-
else
507
-
throw("hilo1 not recognized, please use \"high\" to connect u1 to u2 along the upper index of dim1 of u1 or \"low\" to connect along the lower index end")
Creates a ComposedMultiDimBC operator, Q, that extends every boundary when applied to a `u` with compatible size and number of dimensions.
521
-
522
-
Qx Qy and Qz can be passed in any order, as long as there is exactly one BC operator that extends each dimension.
523
-
"""
524
-
functioncompose(BCs...)
525
-
T =gettype(BCs[1])
526
-
N =ndims(BCs[1])
527
-
Ds =getaxis.(BCs)
528
-
(length(BCs) == N) ||throw("There must be enough BCs to cover every dimension - check that the number of MultiDimBCs == N")
529
-
for D in Ds
530
-
length(setdiff(Ds, D)) == (N-1) ||throw("There are multiple boundary conditions that extend along $D - make sure every dimension has a unique extension")
531
-
end
532
-
BCs = BCs[sortperm([Ds...])]
533
-
534
-
ComposedMultiDimBC{T, Union{eltype.(BCs)...}, N,N-1}([condition.BC for condition in BCs])
0 commit comments