Skip to content

Commit

Permalink
Merge pull request #1 from friedmud/mesh_function_transfer_displaced_…
Browse files Browse the repository at this point in the history
…mesh_3372

Adding tests for displaced mesh with MeshFunctionTransfer
  • Loading branch information
hereiam-at-mit-dot-edu committed Jun 24, 2014
2 parents 9227c6d + 3838179 commit ef7ed11
Show file tree
Hide file tree
Showing 13 changed files with 243 additions and 10 deletions.
26 changes: 24 additions & 2 deletions framework/src/transfers/MultiAppMeshFunctionTransfer.C
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ MultiAppMeshFunctionTransfer::execute()
{
case TO_MULTIAPP:
{
// TODO: This doesn't work with the master app being displaced see #3424
if (_displaced_source_mesh)
mooseError("displaced_source_mesh is not yet implemented for transferring 'to_multiapp'");

FEProblem & from_problem = *_multi_app->problem();
MooseVariable & from_var = from_problem.getVariable(0, _from_var_name);

Expand All @@ -83,7 +87,14 @@ MultiAppMeshFunctionTransfer::execute()

unsigned int from_var_num = from_sys.variable_number(from_var.name());

EquationSystems & from_es = from_sys.get_equation_systems();
EquationSystems * tmp_es = NULL;

if (_displaced_source_mesh && from_problem.getDisplacedProblem())
tmp_es = &from_problem.getDisplacedProblem()->es();
else
tmp_es = &from_problem.es();

EquationSystems & from_es = *tmp_es;

//Create a serialized version of the solution vector
NumericVector<Number> * serialized_solution = NumericVector<Number>::build(from_sys.comm()).release();
Expand Down Expand Up @@ -194,6 +205,10 @@ MultiAppMeshFunctionTransfer::execute()
}
case FROM_MULTIAPP:
{
// TODO: This doesn't work with the master app being displaced see #3424
if (_displaced_target_mesh)
mooseError("displaced_target_mesh is not yet implemented for transferring 'from_multiapp'");

FEProblem & to_problem = *_multi_app->problem();
MooseVariable & to_var = to_problem.getVariable(0, _to_var_name);
SystemBase & to_system_base = to_var.sys();
Expand Down Expand Up @@ -239,7 +254,14 @@ MultiAppMeshFunctionTransfer::execute()

unsigned int from_var_num = from_sys.variable_number(from_var.name());

EquationSystems & from_es = from_sys.get_equation_systems();
EquationSystems * tmp_es = NULL;

if (_displaced_source_mesh && from_problem.getDisplacedProblem())
tmp_es = &from_problem.getDisplacedProblem()->es();
else
tmp_es = &from_problem.es();

EquationSystems & from_es = *tmp_es;

//Create a serialized version of the solution vector
NumericVector<Number> * serialized_from_solution = NumericVector<Number>::build(from_sys.comm()).release();
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
[Mesh]
# The MultiAppMeshFunctionTransfer doesn't work with ParallelMesh.
# 2145 for more information.
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
distribution = serial
[]

[Variables]
[./u]
[../]
[]

[AuxVariables]
[./transferred_u]
[../]
[./elemental_transferred_u]
order = CONSTANT
family = MONOMIAL
[../]
[]

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

[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]

[Executioner]
# Preconditioned JFNK (default)
type = Transient
num_steps = 1
dt = 1
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]

[Outputs]
output_initial = true
exodus = true
[./console]
type = Console
perf_log = true
linear_residuals = true
[../]
[]

[MultiApps]
[./sub]
positions = '.099 .099 0 .599 .599 0 0.599 0.099 0'
type = TransientMultiApp
app_type = MooseTestApp
input_files = sub.i
[../]
[]

[Transfers]
[./from_sub]
source_variable = sub_u
direction = from_multiapp
variable = transferred_u
type = MultiAppMeshFunctionTransfer
multi_app = sub
displaced_source_mesh = true
[../]
[./elemental_from_sub]
source_variable = sub_u
direction = from_multiapp
variable = elemental_transferred_u
type = MultiAppMeshFunctionTransfer
multi_app = sub
displaced_source_mesh = true
[../]
[]
15 changes: 11 additions & 4 deletions test/tests/transfers/multiapp_mesh_function_transfer/sub.i
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,22 @@
xmax = 0.21
ymin = -.01
ymax = 0.21
displacements = 'x_disp y_disp'
[]

[Variables]
[./sub_u]
[../]
[]

[AuxVariables]
[./x_disp]
initial_condition = 0.2
[../]
[./y_disp]
[../]
[]

[Kernels]
[./diff]
type = Diffusion
Expand All @@ -37,13 +46,11 @@
[]

[Executioner]
# Preconditioned JFNK (default)
type = Transient
num_steps = 1
dt = 1

# Preconditioned JFNK (default)
solve_type = 'PJFNK'

solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
Expand Down
14 changes: 14 additions & 0 deletions test/tests/transfers/multiapp_mesh_function_transfer/tests
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
recover = false
[../]

[./tosub_target_displaced]
type = 'Exodiff'
input = 'tosub_master_target_displaced.i'
exodiff = 'tosub_master_target_displaced_out_sub0.e tosub_master_target_displaced_out_sub1.e tosub_master_target_displaced_out_sub2.e'
recover = false
[../]


[./fromsub]
type = 'Exodiff'
Expand All @@ -14,6 +21,13 @@
recover = false
[../]

[./fromsub_source_displaced]
type = 'Exodiff'
input = 'master_source_displaced.i'
exodiff = 'master_source_displaced_out.e'
recover = false
[../]

[./missed_point]
type = 'RunException'
input = 'missing_master.i'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[Mesh]
# The MultiAppMeshFunctionTransfer doesn't work with ParallelMesh.
# To start debugging this issue, you can add 'error_on_miss = true'
# to the 'to_sub' and 'elemental_to_sub' blocks below, and you should
# get an error message like:
# Point not found! (x,y,z)=( 0.62, 0.6, 0)
# 2145.
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
distribution = serial
[]

[Variables]
[./u]
[../]
[]

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

[BCs]
[./left]
type = DirichletBC
variable = u
boundary = left
value = 0
[../]
[./right]
type = DirichletBC
variable = u
boundary = right
value = 1
[../]
[]

[Executioner]
# Preconditioned JFNK (default)
type = Transient
num_steps = 1
dt = 1
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]

[Outputs]
output_initial = true
exodus = true
[./console]
type = Console
perf_log = true
linear_residuals = true
[../]
[]

[MultiApps]
[./sub]
positions = '.1 .1 0 0.6 0.6 0 0.6 0.1 0'
type = TransientMultiApp
app_type = MooseTestApp
input_files = tosub_sub.i
execute_on = timestep
[../]
[]

[Transfers]
[./to_sub]
source_variable = u
direction = to_multiapp
variable = transferred_u
execute_on = timestep
type = MultiAppMeshFunctionTransfer
multi_app = sub
displaced_target_mesh = true
[../]
[./elemental_to_sub]
source_variable = u
direction = to_multiapp
variable = elemental_transferred_u
execute_on = timestep
type = MultiAppMeshFunctionTransfer
multi_app = sub
displaced_target_mesh = true
[../]
[]

13 changes: 9 additions & 4 deletions test/tests/transfers/multiapp_mesh_function_transfer/tosub_sub.i
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ny = 10
xmax = 0.2
ymax = 0.2
displacements = 'x_disp y_disp'
[]

[Variables]
Expand All @@ -19,6 +20,11 @@
order = CONSTANT
family = MONOMIAL
[../]
[./x_disp]
initial_condition = .2
[../]
[./y_disp]
[../]
[]

[Kernels]
Expand All @@ -44,13 +50,11 @@
[]

[Executioner]
# Preconditioned JFNK (default)
type = Transient
num_steps = 1
dt = 1

# Preconditioned JFNK (default)
solve_type = 'PJFNK'

solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
Expand All @@ -64,3 +68,4 @@
linear_residuals = true
[../]
[]

0 comments on commit ef7ed11

Please sign in to comment.