Skip to content

Commit

Permalink
Fix high-order shape functions in Proj.Transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
smharper committed Aug 14, 2015
1 parent 1b6df63 commit ffd2ff3
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 7 deletions.
12 changes: 6 additions & 6 deletions framework/src/transfers/MultiAppProjectionTransfer.C
Expand Up @@ -484,10 +484,10 @@ MultiAppProjectionTransfer::projectSolution(unsigned int i_to)
for ( ; it != end_it; ++it)
{
const Node * node = *it;
if (node->n_comp(to_sys.number(), to_var.number()) > 0)
for (unsigned int comp = 0; comp < node->n_comp(to_sys.number(), to_var.number()); comp++)
{
const dof_id_type proj_index = node->dof_number(ls.number(), _proj_var_num, 0);
const dof_id_type to_index = node->dof_number(to_sys.number(), to_var.number(), 0);
const dof_id_type proj_index = node->dof_number(ls.number(), _proj_var_num, comp);
const dof_id_type to_index = node->dof_number(to_sys.number(), to_var.number(), comp);
to_solution->set(to_index, (*ls.solution)(proj_index));
}
}
Expand All @@ -498,10 +498,10 @@ MultiAppProjectionTransfer::projectSolution(unsigned int i_to)
for ( ; it != end_it; ++it)
{
const Elem * elem = *it;
if (elem->n_comp(to_sys.number(), to_var.number()) > 0)
for (unsigned int comp = 0; comp < elem->n_comp(to_sys.number(), to_var.number()); comp++)
{
const dof_id_type proj_index = elem->dof_number(ls.number(), _proj_var_num, 0);
const dof_id_type to_index = elem->dof_number(to_sys.number(), to_var.number(), 0);
const dof_id_type proj_index = elem->dof_number(ls.number(), _proj_var_num, comp);
const dof_id_type to_index = elem->dof_number(to_sys.number(), to_var.number(), comp);
to_solution->set(to_index, (*ls.solution)(proj_index));
}
}
Expand Down
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,95 @@
[Mesh]
type = GeneratedMesh
dim = 2
nx = 4
ny = 4
[]

[Functions]
[./test_function]
type = ParsedFunction
value = '2.5*x^2 + 0.75*y^2 + 0.15*x*y'
[../]
[]

[AuxVariables]
[./from_sub]
family = monomial
order = first
[../]
[./test_var]
family = monomial
order = first
[./InitialCondition]
type = FunctionIC
function = test_function
[../]
[../]
[]

[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]
type = Steady
solve_type = PJFNK
[]

[Outputs]
exodus = true
print_linear_residuals = true
[]

[MultiApps]
[./sub]
type = FullSolveMultiApp
app_type = MooseTestApp
execute_on = initial
positions = '0.0 0.0 0.0'
input_files = high_order_sub.i
[../]
[]

[Transfers]
[./from]
type = MultiAppProjectionTransfer
direction = from_multiapp
execute_on = same_as_multiapp
multi_app = sub
source_variable = test_var
variable = from_sub
[../]
[./to]
type = MultiAppProjectionTransfer
direction = to_multiapp
execute_on = same_as_multiapp
multi_app = sub
source_variable = test_var
variable = from_master
[../]
[]

66 changes: 66 additions & 0 deletions test/tests/transfers/multiapp_projection_transfer/high_order_sub.i
@@ -0,0 +1,66 @@
[Mesh]
type = GeneratedMesh
dim = 2
nx = 4
ny = 4
[]

[Functions]
[./test_function]
type = ParsedFunction
value = '2.5*x^2 + 0.75*y^2 + 0.15*x*y'
[../]
[]

[AuxVariables]
[./from_master]
family = monomial
order = first
[../]
[./test_var]
family = monomial
order = first
[./InitialCondition]
type = FunctionIC
function = test_function
[../]
[../]
[]

[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]
type = Steady
solve_type = PJFNK
[]

[Outputs]
exodus = true
print_linear_residuals = true
[]

7 changes: 6 additions & 1 deletion test/tests/transfers/multiapp_projection_transfer/tests
Expand Up @@ -3,12 +3,17 @@
type = 'Exodiff'
input = 'tosub_master.i'
exodiff = 'tosub_master_out_sub0.e tosub_master_out_sub1.e'
#deleted = 'Need to finish implementaiton - refs #1913'
[../]

[./fromsub]
type = 'Exodiff'
input = 'fromsub_master.i'
exodiff = 'fromsub_master_out.e'
[../]

[./high_order]
type = 'Exodiff'
input = 'high_order_master.i'
exodiff = 'high_order_master_out.e high_order_master_out_sub0.e'
[../]
[]

0 comments on commit ffd2ff3

Please sign in to comment.