Skip to content

Commit

Permalink
Added NearestPointLayeredSideAverage
Browse files Browse the repository at this point in the history
It works now

Refs idaholab#13252
  • Loading branch information
fdkong committed May 1, 2019
1 parent c49061a commit edfc09f
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 1 deletion.
38 changes: 38 additions & 0 deletions framework/include/userobject/NearestPointLayeredSideAverage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#ifndef NEARESTPOINTLAYEREDSIDEAVERAGE_H
#define NEARESTPOINTLAYEREDSIDEAVERAGE_H

// MOOSE includes
#include "SideIntegralVariableUserObject.h"
#include "NearestPointBase.h"
#include "LayeredSideAverage.h"

// Forward Declarations
class NearestPointLayeredSideAverage;

template <>
InputParameters validParams<NearestPointLayeredSideAverage>();

/**
* This UserObject computes averages of a variable storing partial
* sums for the specified number of intervals in a direction (x,y,z).
*
* Given a list of points this object computes the layered average
* closest to each one of those points.
*/
class NearestPointLayeredSideAverage
: public NearestPointBase<LayeredSideAverage, SideIntegralVariableUserObject>
{
public:
NearestPointLayeredSideAverage(const InputParameters & parameters);
};

#endif
2 changes: 1 addition & 1 deletion framework/src/transfers/MultiAppFieldTransferInterface.C
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ MultiAppFieldTransferInterface::adjustTransferedSolutionNearestPoint(
}

dof_id_type dof = elem->dof_number(sys_num, var_num, 0);
to_solution.set(dof, (from_adjuster / to_adjuster) * to_solution(dof));
to_solution.set(dof, scale * to_solution(dof));
}
}

Expand Down
29 changes: 29 additions & 0 deletions framework/src/userobject/NearestPointLayeredSideAverage.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

// MOOSE includes
#include "NearestPointLayeredSideAverage.h"
#include "LayeredSideAverage.h"

registerMooseObject("MooseApp", NearestPointLayeredSideAverage);

template <>
InputParameters
validParams<NearestPointLayeredSideAverage>()
{
InputParameters params =
nearestPointBaseValidParams<LayeredSideAverage, SideIntegralVariableUserObject>();

return params;
}

NearestPointLayeredSideAverage::NearestPointLayeredSideAverage(const InputParameters & parameters)
: NearestPointBase<LayeredSideAverage, SideIntegralVariableUserObject>(parameters)
{
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[Mesh]
type = GeneratedMesh
dim = 3
nx = 40
ny = 10
nz = 10
[]

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

[AuxVariables]
[./np_layered_average]
order = CONSTANT
family = MONOMIAL
[../]
[]

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

[AuxKernels]
[./np_layered_average]
type = SpatialUserObjectAux
variable = np_layered_average
execute_on = timestep_end
user_object = npla
boundary = 'bottom top'
[../]
[]

[UserObjects]
[./npla]
type = NearestPointLayeredSideAverage
direction = x
points='0.25 0 0.25 0.75 0 0.25 0.25 0 0.75 0.75 0 0.75'
num_layers = 10
variable = u
execute_on = linear
boundary = 'bottom top'
[../]
[]

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



[Executioner]
type = Steady

solve_type = 'PJFNK'

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

[Outputs]
exodus = true
[]
10 changes: 10 additions & 0 deletions test/tests/userobjects/nearest_point_layered_side_average/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Tests]
[./test]
type = 'Exodiff'
input = 'nearest_point_layered_side_average.i'
exodiff = 'nearest_point_layered_side_average_out.e'
requirement = 'The system shall compute layered side averages that computed from the closest values for a list of points'
design = 'NearestPointLayeredSideAverage.md'
issues = '#13252'
[../]
[]

0 comments on commit edfc09f

Please sign in to comment.