Skip to content

Commit

Permalink
Change swapping of swappable BCs
Browse files Browse the repository at this point in the history
The swapping should happen at the beginning of a controller
step before the Schwarz loop for a multidomain simulation.

N/A for a single domain simulation.
  • Loading branch information
lxmota committed Jan 31, 2025
1 parent 1dbf557 commit 0da66dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/ics_bcs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,6 @@ function apply_bc_detail(model::SolidMechanics, bc::SMContactSchwarzBC)
else
apply_sm_schwarz_contact_neumann(model, bc)
end
if (bc.swap_bcs == true)
bc.is_dirichlet = !bc.is_dirichlet
end
end

function apply_bc_detail(model::SolidMechanics, bc::CouplingSchwarzBoundaryCondition)
Expand All @@ -392,9 +389,6 @@ function apply_bc_detail(model::SolidMechanics, bc::CouplingSchwarzBoundaryCondi
else
apply_sm_schwarz_coupling_neumann(model, bc)
end
if (bc.swap_bcs == true)
bc.is_dirichlet = !bc.is_dirichlet
end
end

function apply_bc_detail(model::LinearOpInfRom, bc::CouplingSchwarzBoundaryCondition)
Expand Down
17 changes: 17 additions & 0 deletions src/schwarz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function schwarz(sim::MultiDomainSimulation)
save_schwarz_solutions(sim)
resize_histories(sim)
set_subcycle_times(sim)
swap_swappable_bcs(sim)
is_schwarz = true
while true
println("Schwarz iteration=", iteration_number)
Expand Down Expand Up @@ -189,6 +190,22 @@ function set_subcycle_times(sim::MultiDomainSimulation)
end
end

function swap_swappable_bcs(sim::MultiDomainSimulation)
for subsim sim.subsims
swap_swappable_bcs(subsim)
end
end

function swap_swappable_bcs(sim::SingleDomainSimulation)
for bc sim.model.boundary_conditions
if typeof(bc) == ContactSchwarzBoundaryCondition || typeof(bc) == CouplingSchwarzBoundaryCondition
if (bc.swap_bcs == true)
bc.is_dirichlet = !bc.is_dirichlet
end
end
end
end

function subcycle(sim::MultiDomainSimulation, is_schwarz::Bool)
subsim_index = 1
for subsim sim.subsims
Expand Down

0 comments on commit 0da66dd

Please sign in to comment.