Skip to content
Permalink
Browse files

Merge pull request #13332 from permcody/multiapp_fixup

Multiapp multilevel backup/restore fixup
  • Loading branch information...
lindsayad committed May 1, 2019
2 parents dc0513c + 3cbda81 commit dad4461045884852d303e5e7ca590566f2dcc9a4
@@ -358,15 +358,14 @@ void
dataLoad(std::istream & stream, std::stringstream & s, void * /* context */)
{
size_t s_size = 0;

stream.read((char *)&s_size, sizeof(s_size));

char * s_s = new char[s_size];

stream.read(s_s, s_size);
std::unique_ptr<char[]> s_s(new char[s_size]);
stream.read(s_s.get(), s_size);

s.write(s_s, s_size);
delete[] s_s;
// Clear the stringstream before loading new data into it.
s.str(std::string());
s.write(s_s.get(), s_size);
}

template <>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,110 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
[]

[Variables]
[u]
[]
[]

[AuxVariables]
[v]
initial_condition = 50
[]
[]

[Kernels]
[diffusion]
type = Diffusion
variable = u
[]
[source]
type = CoupledForce
variable = u
v = v
[]
[]

[BCs]
[dirichlet0]
type = DirichletBC
variable = u
boundary = '3'
value = 0
[]
[dirichlet]
type = DirichletBC
variable = u
boundary = '1'
value = 100
[]
[]

[Postprocessors]
[avg_u]
type = ElementAverageValue
variable = u
execute_on = 'initial linear'
[]
[avg_v]
type = ElementAverageValue
variable = v
execute_on = 'initial linear'
[]
[]


[Executioner]
type = Steady
petsc_options_iname = '-pc_type -pc_hypre_type -ksp_gmres_restart '
petsc_options_value = 'hypre boomeramg 100'

picard_rel_tol = 1E-3
picard_abs_tol = 1.0e-05
picard_max_its = 12
[]

[MultiApps]
[level1-]
type = FullSolveMultiApp
app_type = MooseTestApp
positions = '0 0 0'
input_files = sub_level1.i
execute_on = 'timestep_end'

# We have to make backups of the full tree in order to do a proper restore for the Picard iteration.
no_backup_and_restore = false
[]
[]

[Transfers]
[u_to_sub]
type = MultiAppMeshFunctionTransfer
direction = to_multiapp
source_variable = u
variable = u
multi_app = level1-
execute_on = 'timestep_end'
[]
[v_from_sub]
type = MultiAppMeshFunctionTransfer
direction = from_multiapp
source_variable = v
variable = v
multi_app = level1-
execute_on = 'timestep_end'
[]
[]

[Outputs]
exodus = true
csv = true
perf_graph = true
[]
@@ -0,0 +1,125 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
[]

[Variables]
[v]
[]
[]

[AuxVariables]
[u]
[]
[w]
[]
[]

[Kernels]
[time_derivative]
type = TimeDerivative
variable = v
[]
[diffusion]
type = Diffusion
variable = v
[]
[source]
type = CoupledForce
variable = v
v = u
[]
[]

[BCs]
[dirichlet0]
type = DirichletBC
variable = v
boundary = '0'
value = 0
[]
[dirichlet]
type = DirichletBC
variable = v
boundary = '2'
value = 100
[]
[]

[Postprocessors]
[avg_u]
type = ElementAverageValue
variable = u
execute_on = 'initial linear'
[]
[avg_v]
type = ElementAverageValue
variable = v
execute_on = 'initial linear'
[]
[avg_w]
type = ElementAverageValue
variable = w
execute_on = 'initial linear'
[]
[]

[Executioner]
type = Transient

petsc_options_iname = '-pc_type -pc_hypre_type -ksp_gmres_restart '
petsc_options_value = 'hypre boomeramg 100'

end_time = 0.1
dt = 0.02
# picard_max_its = 5
# accept_on_max_picard_iteration = true
# nl_rel_tol = 1e-8
# nl_abs_tol = 1e-9
# picard_rel_tol = 1e-3
# picard_abs_tol = 1e-7
[]


[MultiApps]
[level2-]
type = TransientMultiApp
app_type = MooseTestApp
positions = '0 0 0'
input_files = sub_level2.i
execute_on = 'timestep_end'
# sub_cycling = true
[]
[]

[Transfers]
[v_to_sub]
type = MultiAppMeshFunctionTransfer
direction = to_multiapp
source_variable = v
variable = v
multi_app = level2-
execute_on = 'timestep_end'
[]
[w_from_sub]
type = MultiAppMeshFunctionTransfer
direction = from_multiapp
source_variable = w
variable = w
multi_app = level2-
execute_on = 'timestep_end'
[]
[]

[Outputs]
exodus = true
csv = true
perf_graph = true
# print_linear_residuals = false
[]
@@ -0,0 +1,76 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
[]

[Variables]
[w]
[]
[]

[AuxVariables]
[v]
[]
[]

[Kernels]
[time_derivative]
type = TimeDerivative
variable = w
[]
[diffusion]
type = Diffusion
variable = w
[]
[source]
type = CoupledForce
variable = w
v = v
[]
[]

[BCs]
[dirichlet]
type = DirichletBC
variable = w
boundary = '0'
value = 0
[]
[]

[Postprocessors]
[avg_v]
type = ElementAverageValue
variable = v
execute_on = 'initial linear'
[]
[avg_w]
type = ElementAverageValue
variable = w
execute_on = 'initial linear'
[]
[]

[Executioner]
type = Transient

petsc_options_iname = '-pc_type -pc_hypre_type -ksp_gmres_restart '
petsc_options_value = 'hypre boomeramg 100'

end_time = 0.1
dt = 0.02
# steady_state_detection = true
[]


[Outputs]
exodus = true
csv = true
# print_linear_residuals = false
[]
@@ -0,0 +1,12 @@
[Tests]
design = 'multiapps/FullSolveMultiApp.md'
[./test]
type = 'Exodiff'
input = 'master.i'
exodiff = 'master_out.e master_out_level1-0.e master_out_level1-0_level2-0.e'

issues = '#13310'
requirement = 'The system shall support Picard iteration with a FullSolveMultiApp at the root with multiple multiapp levels.'
recover = False #Steady
[../]
[]

0 comments on commit dad4461

Please sign in to comment.
You can’t perform that action at this time.