Permalink
Browse files

Merge pull request #12778 from vincentlaboure/fix_segfault_12618

Allow MultiAppInterpolationTransfer for block restricted sub-app variables
  • Loading branch information...
permcody committed Jan 30, 2019
2 parents fc2eb0b + 3aa4776 commit b3f6f0ae280285ce8abd6122f5b81d498b9c7ecb
@@ -134,6 +134,9 @@ MultiAppInterpolationTransfer::execute()
for (const auto & from_node : from_mesh->local_node_ptr_range())
{
// Assuming LAGRANGE!
if (from_node->n_comp(from_sys_num, from_var_num) == 0)
continue;

dof_id_type from_dof = from_node->dof_number(from_sys_num, from_var_num, 0);

src_pts.push_back(*from_node);
@@ -197,6 +200,9 @@ MultiAppInterpolationTransfer::execute()
Real value = vals.front();

// The zero only works for LAGRANGE!
if (node->n_comp(from_sys_num, from_var_num) == 0)
continue;

dof_id_type dof = node->dof_number(sys_num, var_num, 0);

solution.set(dof, value);
@@ -332,6 +338,9 @@ MultiAppInterpolationTransfer::execute()
for (const auto & from_node : from_mesh->local_node_ptr_range())
{
// Assuming LAGRANGE!
if (from_node->n_comp(from_sys_num, from_var_num) == 0)
continue;

dof_id_type from_dof = from_node->dof_number(from_sys_num, from_var_num, 0);

src_pts.push_back(*from_node + app_position);
@@ -344,6 +353,9 @@ MultiAppInterpolationTransfer::execute()
as_range(from_mesh->local_elements_begin(), from_mesh->local_elements_end()))
{
// Assuming LAGRANGE!
if (from_element->n_comp(from_sys_num, from_var_num) == 0)
continue;

dof_id_type from_dof = from_element->dof_number(from_sys_num, from_var_num, 0);

src_pts.push_back(from_element->centroid() + app_position);
@@ -0,0 +1,83 @@
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
# The MultiAppInterpolationTransfer object only works with ReplicatedMesh
parallel_type = replicated
[]

[Variables]
[u]
[]
[]

[AuxVariables]
[elemental_from_sub]
order = CONSTANT
family = MONOMIAL
[]
[nodal_from_sub]
[]
[]

[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]
type = Transient
num_steps = 1
dt = 1

petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]

[Outputs]
exodus = true
[]

[MultiApps]
[sub]
type = TransientMultiApp
app_type = MooseTestApp
positions = '0 0 0 0.6 0 0'
input_files = fromrestrictedsub_sub.i
[]
[]

[Transfers]
[elemental_fromsub]
type = MultiAppInterpolationTransfer
direction = from_multiapp
multi_app = sub
source_variable = elemental
variable = elemental_from_sub
[]
[nodal_fromsub]
type = MultiAppInterpolationTransfer
direction = from_multiapp
multi_app = sub
source_variable = nodal
variable = nodal_from_sub
[]
[]
@@ -0,0 +1,79 @@
[Mesh]
file = 2subdomains.e
[]

[MeshModifiers]
[boundary_fuel_side]
type = SubdomainBoundingBox
block_id = 2
bottom_left = '0.2 0 0'
top_right = '0.3 1 0'
[]
[]

[Variables]
[u]
[]
[]

[AuxVariables]
[elemental]
block = '2'
order = CONSTANT
family = MONOMIAL
[]
[nodal]
block = '2'
[]
[]


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

[AuxKernels]
[elemaux]
type = CoupledAux
variable = elemental
coupled = u
block = '2'
[]
[nodaux]
type = CoupledAux
variable = nodal
coupled = u
block = '2'
[]
[]

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

[Executioner]
type = Transient
num_steps = 1
dt = 1

petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]

[Outputs]
exodus = true
[]
@@ -1,15 +1,31 @@
[Tests]
[./tosub]
[tosub]
type = 'Exodiff'
input = 'tosub_master.i'
exodiff = 'tosub_master_out_sub0.e'
group = 'requirements'
[../]
design = 'transfers/MultiAppInterpolationTransfer.md'
issues = '#1879'
requirement = "The system shall allow to interpolate variables from the master app to the sub apps"
[]

[./fromsub]
[fromsub]
type = 'Exodiff'
input = 'fromsub_master.i'
exodiff = 'fromsub_master_out.e'
group = 'requirements'
[../]
design = 'transfers/MultiAppInterpolationTransfer.md'
issues = '#1879'
requirement = "The system shall allow to interpolate variables from the sub apps to the master app"
[]

[fromsub_restricted]
type = 'Exodiff'
input = 'fromrestrictedsub_master.i'
exodiff = 'fromrestrictedsub_master_out.e'
group = 'requirements'
design = 'transfers/MultiAppInterpolationTransfer.md'
issues = '#1879 #12618'
requirement = "The system shall allow to interpolate block restricted variables from the sub apps to the master app"
[]
[]

0 comments on commit b3f6f0a

Please sign in to comment.