Skip to content

Commit

Permalink
Merge pull request #12482 from vincentlaboure/failed_multiapp_12477
Browse files Browse the repository at this point in the history
Properly restore MultiApps when only some failed
  • Loading branch information
permcody committed Nov 15, 2018
2 parents bf8b5cf + a50ace9 commit cadf49b
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 1 deletion.
7 changes: 6 additions & 1 deletion framework/src/problems/FEProblemBase.C
Expand Up @@ -3543,12 +3543,17 @@ FEProblemBase::execMultiApps(ExecFlagType type, bool auto_advance)
bool success = true;

for (const auto & multi_app : multi_apps)
{
success = multi_app->solveStep(_dt, _time, auto_advance);
// no need to finish executing the subapps if one fails
if (!success)
break;
}

_console << "Waiting For Other Processors To Finish" << '\n';
MooseUtils::parallelBarrierNotify(_communicator, _parallel_barrier_messaging);

_communicator.max(success);
_communicator.min(success);

if (!success)
return false;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions test/tests/multiapps/picard_failure/picard_master.i
Expand Up @@ -71,12 +71,19 @@
[]

[MultiApps]
active = 'sub' # will be modified by CLI overrides
[./sub]
type = TransientMultiApp
app_type = MooseTestApp
positions = '0 0 0'
input_files = picard_sub.i
[../]
[./sub_no_fail]
type = TransientMultiApp
app_type = MooseTestApp
positions = '0 0 0'
input_files = picard_sub_no_fail.i
[../]
[]

[Transfers]
Expand Down
65 changes: 65 additions & 0 deletions test/tests/multiapps/picard_failure/picard_sub_no_fail.i
@@ -0,0 +1,65 @@
[Mesh]
type = GeneratedMesh
dim = 2
nx = 2
ny = 2
[]

[Variables]
[./v]
[../]
[]

[AuxVariables]
[./u]
[../]
[]

[Kernels]
[./diff_v]
type = Diffusion
variable = v
[../]
[./force_v]
type = CoupledForce
variable = v
v = u
[../]
[]

[BCs]
[./left_v]
type = DirichletBC
variable = v
boundary = left
value = 1
[../]
[./right_v]
type = DirichletBC
variable = v
boundary = right
value = 0
[../]
[]

[Postprocessors]
[./elem_average_value]
type = ElementAverageValue
variable = v
execute_on = 'initial timestep_end'
[../]
[]

[Executioner]
type = Transient
num_steps = 2
dt = 0.1
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
nl_abs_tol = 1e-10
[]

[Outputs]
exodus = true
[]
19 changes: 19 additions & 0 deletions test/tests/multiapps/picard_failure/tests
Expand Up @@ -35,4 +35,23 @@
requirement = 'CSV file writing should remain unaffected when a subapp encounters a solve failure.'
issues = '#11178'
[../]

[./test_2subapps]
type = 'Exodiff'
input = 'picard_master.i'
exodiff = 'picard_master_2subapps_out_sub.e picard_master_2subapps_out_sub_no_fail.e picard_master_2subapps_out.e'
max_parallel = 1 # This is here because we're counting residual evaluations
max_threads = 1 # NanAtCountKernel changes behavior with threads
recover = false
petsc_version = '>=3.6.1'
allow_warnings = true
petsc_version_release = true
compiler = '!INTEL'

cli_args = 'MultiApps/active="sub sub_no_fail" Outputs/file_base=picard_master_2subapps_out sub:Outputs/file_base=picard_master_2subapps_out_sub sub_no_fail:Outputs/file_base=picard_master_2subapps_out_sub_no_fail'

design = '/MultiApps/index.md'
requirement = 'Multiapps shall be able to cut the master app time step when any subapp encounters a solve failure.'
issues = '#12477'
[../]
[]

0 comments on commit cadf49b

Please sign in to comment.