Skip to content

Commit

Permalink
Adjust Schwarz time step
Browse files Browse the repository at this point in the history
  • Loading branch information
lxmota committed Feb 5, 2025
1 parent ecdfe7a commit a6b5a5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/schwarz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ function SolidSchwarzController(params::Dict{String,Any})
initial_time = params["initial time"]
final_time = params["final time"]
time_step = params["time step"]
println("Requested time step is ", time_step)
num_stops = ceil(Int64, (final_time - initial_time) / time_step) + 1
time_step = (final_time - initial_time) / (num_stops - 1)
println("Adjusted time step is ", time_step, " with ", num_stops, " stops")
absolute_error = relative_error = 0.0
time = prev_time = initial_time
same_step = get(params, "same time step for domains", false)
Expand Down Expand Up @@ -60,6 +64,7 @@ function SolidSchwarzController(params::Dict{String,Any})
time,
prev_time,
same_step,
num_stops,
stop,
converged,
iteration_number,
Expand Down
1 change: 1 addition & 0 deletions src/schwarz_def.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mutable struct SolidSchwarzController <: SchwarzController
time::Float64
prev_time::Float64
same_step::Bool
num_stops::Int64
stop::Int64
converged::Bool
iteration_number::Int64
Expand Down
3 changes: 1 addition & 2 deletions test/opinf-schwarz-overlap-cuboid-hex8.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# the U.S. Government retains certain rights in this software. This software
# is released under the BSD license detailed in the file license.txt in the
# top-level Norma.jl directory.
@testset "schwarz-overlap-static-cuboid-hex8-same-step" begin
@testset "opinf-schwarz-overlap-static-cuboid-hex8-same-step" begin
cp("../examples/ahead/overlap/cuboid/dynamic-opinf-rom/cuboid-1.yaml", "cuboid-1.yaml", force=true)
cp("../examples/ahead/overlap/cuboid/dynamic-opinf-rom/cuboid-2.yaml", "cuboid-2.yaml", force=true)
cp("../examples/ahead/overlap/cuboid/dynamic-opinf-rom/cuboids.yaml", "cuboids.yaml", force=true)
Expand All @@ -22,7 +22,6 @@
rm("cuboid-1.e")
rm("cuboid-2.e")
rm("opinf-operator.npz")
print(model_coarse.reduced_state[1])
@test model_coarse.reduced_state[1] 0.04508462384388636 rtol = 1.0e-06
@test model_coarse.reduced_state[2] 0.0450846238438998 rtol = 1.0e-06
@test model_coarse.reduced_state[3] 0.21766337487648266 rtol = 1.0e-06
Expand Down

0 comments on commit a6b5a5b

Please sign in to comment.