Skip to content

Commit

Permalink
An example of restarting the subapp but not the master (idaholab#6297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Schunert committed Mar 2, 2016
1 parent df2dc81 commit d43798c
Show file tree
Hide file tree
Showing 7 changed files with 385 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = -1
xmax = 1
ymin = -1
ymax = 1
nx = 2
ny = 2
elem_type = QUAD9
[]

[Functions]
[./exact_fn]
type = ParsedFunction
value = t*t*(x*x+y*y)
[../]

[./forcing_fn]
type = ParsedFunction
value = 2*t*(x*x+y*y)-4*t*t
[../]
[]

[Variables]
[./u]
family = LAGRANGE
order = SECOND
[../]
[]

[ICs]
[./u_var]
type = FunctionIC
variable = u
function = exact_fn
[../]
[]

[Kernels]
[./td]
type = TimeDerivative
variable = u
[../]

[./diff]
type = Diffusion
variable = u
[../]

[./ffn]
type = UserForcingFunction
variable = u
function = forcing_fn
[../]
[]

[BCs]
[./all]
type = FunctionDirichletBC
variable = u
boundary = 'left right top bottom'
function = exact_fn
[../]
[]

[Postprocessors]
[./average]
type = ElementAverageValue
variable = u
[../]
[]

[Executioner]
type = Transient
start_time = 0.0
end_time = 4.0
dt = 1.0
[]

[Outputs]
file_base = complete_solve_no_subapp
exodus = true
[]
Binary file not shown.
Binary file not shown.
28 changes: 28 additions & 0 deletions test/tests/restart/restart_subapp_not_master/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[Tests]
# only master, 0 <= t <= 4
[./complete_solve_no_subapp]
type = 'Exodiff'
input = 'complete_solve_no_subapp.i'
exodiff = 'complete_solve_no_subapp.e'
[../]
# split into sub solve 0 <= t <= 2 && master 2 <= t <= 4
# also write cp files for restart case
[./two_step_solve_master]
type = 'Exodiff'
input = 'two_step_solve_master.i'
exodiff = 'two_step_solve_master.e'
cli_args = 'Outputs/file_base=two_step_solve_master
MultiApps/full_solve/input_files=two_step_solve_sub.i'
[../]
# split into sub solve 0 <= t <= 2 && master 2 <= t <= 4
# this time restart the sub but _not_ the master
[./two_step_solve_master_restart]
type = 'Exodiff'
input = 'two_step_solve_master.i'
exodiff = 'two_step_solve_master_restart.e'
cli_args = 'Outputs/file_base=two_step_solve_master_restart
MultiApps/full_solve/input_files=two_step_solve_sub_restart.i'
prereq = two_step_solve_master
skip = 'Segfault #6297'
[../]
[]
105 changes: 105 additions & 0 deletions test/tests/restart/restart_subapp_not_master/two_step_solve_master.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = -1
xmax = 1
ymin = -1
ymax = 1
nx = 2
ny = 2
elem_type = QUAD9
[]

[Functions]
[./exact_fn]
type = ParsedFunction
value = t*t*(x*x+y*y)
[../]

[./forcing_fn]
type = ParsedFunction
value = 2*t*(x*x+y*y)-4*t*t
[../]
[]

[Variables]
[./u]
family = LAGRANGE
order = SECOND
[../]
[]

[ICs]
active = ''
[./u_var]
type = FunctionIC
variable = u
function = exact_fn
[../]
[]

[Kernels]
[./td]
type = TimeDerivative
variable = u
[../]

[./diff]
type = Diffusion
variable = u
[../]

[./ffn]
type = UserForcingFunction
variable = u
function = forcing_fn
[../]
[]

[BCs]
[./all]
type = FunctionDirichletBC
variable = u
boundary = 'left right top bottom'
function = exact_fn
[../]
[]

[Postprocessors]
[./average]
type = ElementAverageValue
variable = u
execute_on = 'initial timestep_end'
[../]
[]

[Executioner]
type = Transient
start_time = 2.0
end_time = 4.0
dt = 1.0
[]

[MultiApps]
[./full_solve]
type = FullSolveMultiApp
execute_on = initial
positions = '0 0 0'
##input_files = two_step_solve_sub.i
[../]
[]

[Transfers]
[./transfer_u]
type = MultiAppProjectionTransfer
multi_app = full_solve
direction = FROM_MULTIAPP
variable = u
source_variable = u
[../]
[]

[Outputs]
##file_base = two_step_solve_master
exodus = true
[]
86 changes: 86 additions & 0 deletions test/tests/restart/restart_subapp_not_master/two_step_solve_sub.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[Mesh]
type = GeneratedMesh
dim = 2
xmin = -1
xmax = 1
ymin = -1
ymax = 1
nx = 2
ny = 2
elem_type = QUAD9
[]

[Functions]
[./exact_fn]
type = ParsedFunction
value = t*t*(x*x+y*y)
[../]

[./forcing_fn]
type = ParsedFunction
value = 2*t*(x*x+y*y)-4*t*t
[../]
[]

[Variables]
[./u]
family = LAGRANGE
order = SECOND
[../]
[]

[ICs]
[./u_var]
type = FunctionIC
variable = u
function = exact_fn
[../]
[]

[Kernels]
[./td]
type = TimeDerivative
variable = u
[../]

[./diff]
type = Diffusion
variable = u
[../]

[./ffn]
type = UserForcingFunction
variable = u
function = forcing_fn
[../]
[]

[BCs]
[./all]
type = FunctionDirichletBC
variable = u
boundary = 'left right top bottom'
function = exact_fn
[../]
[]

[Postprocessors]
[./average]
type = ElementAverageValue
variable = u
[../]
[]

[Executioner]
type = Transient
start_time = 0.0
end_time = 2.0
dt = 1.0
[]

[Outputs]
[./checkpoint]
type = Checkpoint
num_files = 3
[../]
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[Mesh]
file = two_step_solve_master_out_full_solve0_cp/0002_mesh.cpr
[]

[Problem]
restart_file_base = two_step_solve_master_out_full_solve0_cp/0002
[]

[Functions]
[./exact_fn]
type = ParsedFunction
value = t*t*(x*x+y*y)
[../]

[./forcing_fn]
type = ParsedFunction
value = 2*t*(x*x+y*y)-4*t*t
[../]
[]

[Variables]
[./u]
family = LAGRANGE
order = SECOND
[../]
[]

[ICs]
[./u_var]
type = FunctionIC
variable = u
function = exact_fn
[../]
[]

[Kernels]
[./td]
type = TimeDerivative
variable = u
[../]

[./diff]
type = Diffusion
variable = u
[../]

[./ffn]
type = UserForcingFunction
variable = u
function = forcing_fn
[../]
[]

[BCs]
[./all]
type = FunctionDirichletBC
variable = u
boundary = 'left right top bottom'
function = exact_fn
[../]
[]

[Postprocessors]
[./average]
type = ElementAverageValue
variable = u
[../]
[]

[Executioner]
type = Transient
start_time = 0.0
end_time = 2.0
dt = 1.0
[]

[Outputs]
[./checkpoint]
type = Checkpoint
num_files = 3
[../]
[]

0 comments on commit d43798c

Please sign in to comment.