Skip to content

Commit

Permalink
Issue idaholab#17471 test
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad committed Apr 7, 2021
1 parent 0dbb68a commit a601aa8
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 1 deletion.
Expand Up @@ -27,7 +27,13 @@ supports reading and writing a large number of formats and could be extended to
| .cpr | Checkpoint file |

When reading a mesh file in Sandia's ExodusII format, users can use parameter `exodus_extra_element_integers` to load elemental variables for setting extra element integers of the mesh.
The names of the extra element integers will be the same as the names of the element variables in the mesh file.
The names of the extra element integers will be the same as the names of the
element variables in the mesh file. This generator can also be used for
restarting variables from the Exodus file format. In order to indicate that the
mesh file can be used to restart variables, simply set the parameter
`use_for_exodus_restart = true`. The `initial_from_file_var` parameter must also
be set in the variables sub-block as described in [MooseVariableBase.md#restart]
in order to perform variable restart.

## Further FileMeshGenerator Documentation

Expand Down
9 changes: 9 additions & 0 deletions framework/doc/content/source/variables/MooseVariableBase.md
Expand Up @@ -73,6 +73,15 @@ similar methods of `MooseVariableFE<Real>`.
There are a myriad of ways to access Moose variables from user interfaces. We'll
outline a few below.

## Restart

Variables can be restarted/initialized from variable values in a file on disk by
setting the parameter `initial_from_file_var = source_var_name` in the variable
sub-block, where `source_var_name` is the name of the source variable in the
file. Note that the user will also have to set parameters in the `[Mesh]` block
in order for this to work, as described for example in the documentation of the
[FileMeshGenerator.md].

### SystemBase

It's common for interface objects (`Kernel` objects for example) to have a `_sys`
Expand Down
Binary file added test/tests/restart/scalar-var/gold/part1_out.e
Binary file not shown.
1 change: 1 addition & 0 deletions test/tests/restart/scalar-var/gold/part2_out.e
50 changes: 50 additions & 0 deletions test/tests/restart/scalar-var/part1.i
@@ -0,0 +1,50 @@
[Mesh]
type = GeneratedMesh
dim = 1
nx = 21
[]

[Variables]
[v]
family = MONOMIAL
order = CONSTANT
fv = true
[]
[lambda]
family = SCALAR
order = FIRST
[]
[]

[FVKernels]
[advection]
type = FVElementalAdvection
variable = v
velocity = '1 0 0'
[]
[lambda]
type = FVScalarLagrangeMultiplier
variable = v
lambda = lambda
phi0 = 1
[]
[]

[Problem]
kernel_coverage_check = off
[]

[Executioner]
type = Steady
petsc_options_iname = '-pc_type -pc_factor_shift_type'
petsc_options_value = 'lu NONZERO'
nl_rel_tol = 1e-12
solve_type = NEWTON
[]

[Outputs]
[out]
type = Exodus
execute_on = 'final'
[]
[]
53 changes: 53 additions & 0 deletions test/tests/restart/scalar-var/part2.i
@@ -0,0 +1,53 @@
[Mesh]
[fmg]
type = FileMeshGenerator
file = part1_out.e
use_for_exodus_restart = true
[]
[]

[Variables]
[v]
family = MONOMIAL
order = CONSTANT
fv = true
initial_from_file_var = v
[]
[lambda]
family = SCALAR
order = FIRST
initial_from_file_var = lambda
[]
[]

[FVKernels]
[advection]
type = FVElementalAdvection
variable = v
velocity = '1 0 0'
[]
[lambda]
type = FVScalarLagrangeMultiplier
variable = v
lambda = lambda
phi0 = 1
[]
[]

[Problem]
kernel_coverage_check = off
[]

[Executioner]
type = Steady
petsc_options_iname = '-snes_max_it'
petsc_options_value = '0'
nl_abs_tol = 1e-10
[]

[Outputs]
[out]
type = Exodus
execute_on = 'final'
[]
[]
19 changes: 19 additions & 0 deletions test/tests/restart/scalar-var/tests
@@ -0,0 +1,19 @@
[Tests]
design = 'MooseVariableBase.md'
issues = '#17471'
[restarting]
requirement = 'The system shall be able to restart a scalar variable in the presence of other variables with the standard sequence of:'
[part1]
type = Exodiff
input = part1.i
exodiff = part1_out.e
detail = 'run initial input'
[]
[part2]
type = Exodiff
input = part2.i
exodiff = part2_out.e
detail = 'run restart input'
[]
[]
[]

0 comments on commit a601aa8

Please sign in to comment.