comparison src/SbpOperators/readoperator.jl @ 651:67639b1c99ea

Merged feature/volume_and_boundary_operators
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 20 Jan 2021 17:52:55 +0100
parents 4a81812150f4
children ec7490fb4404 e14627e79a54
comparison
equal deleted inserted replaced
615:52749b687a67 651:67639b1c99ea
6 export read_tuple 6 export read_tuple
7 7
8 export get_stencil 8 export get_stencil
9 export get_stencils 9 export get_stencils
10 export get_tuple 10 export get_tuple
11
12 11
13 function read_D2_operator(fn; order) 12 function read_D2_operator(fn; order)
14 operators = TOML.parsefile(fn)["order$order"] 13 operators = TOML.parsefile(fn)["order$order"]
15 D2 = operators["D2"] 14 D2 = operators["D2"]
16 H = operators["H"] 15 H = operators["H"]
21 innerStencil = get_stencil(operators, "D2", "inner_stencil") 20 innerStencil = get_stencil(operators, "D2", "inner_stencil")
22 21
23 # Create boundary stencils 22 # Create boundary stencils
24 boundarySize = length(D2["closure_stencils"]) 23 boundarySize = length(D2["closure_stencils"])
25 closureStencils = Vector{typeof(innerStencil)}() # TBD: is the the right way to get the correct type? 24 closureStencils = Vector{typeof(innerStencil)}() # TBD: is the the right way to get the correct type?
26
27 for i ∈ 1:boundarySize 25 for i ∈ 1:boundarySize
28 closureStencils = (closureStencils..., get_stencil(operators, "D2", "closure_stencils", i; center=i)) 26 closureStencils = (closureStencils..., get_stencil(operators, "D2", "closure_stencils", i; center=i))
29 end 27 end
30
31 # TODO: Get rid of the padding here. Any padding should be handled by the consturctor accepting the stencils. 28 # TODO: Get rid of the padding here. Any padding should be handled by the consturctor accepting the stencils.
32 quadratureClosure = pad_tuple(toml_string_array_to_tuple(Float64, H["closure"]), boundarySize)
33 eClosure = Stencil(pad_tuple(toml_string_array_to_tuple(Float64, e["closure"]), boundarySize), center=1) 29 eClosure = Stencil(pad_tuple(toml_string_array_to_tuple(Float64, e["closure"]), boundarySize), center=1)
34 dClosure = Stencil(pad_tuple(toml_string_array_to_tuple(Float64, d1["closure"]), boundarySize), center=1) 30 dClosure = Stencil(pad_tuple(toml_string_array_to_tuple(Float64, d1["closure"]), boundarySize), center=1)
35 31
32 q_tuple = pad_tuple(toml_string_array_to_tuple(Float64, H["closure"]), boundarySize)
33 quadratureClosure = Vector{typeof(innerStencil)}()
34 for i ∈ 1:boundarySize
35 quadratureClosure = (quadratureClosure..., Stencil((q_tuple[i],), center=1))
36 end
37
36 d2 = SbpOperators.D2( 38 d2 = SbpOperators.D2(
37 quadratureClosure,
38 innerStencil, 39 innerStencil,
39 closureStencils, 40 closureStencils,
40 eClosure, 41 eClosure,
41 dClosure, 42 dClosure,
43 quadratureClosure,
42 even 44 even
43 ) 45 )
44 46
45 return d2 47 return d2
46 end 48 end