Skip to content
Permalink
Browse files

Merge pull request #13060 from fdkong/conservative_transfers

Conservative transfers
  • Loading branch information...
permcody committed May 20, 2019
2 parents 8820cb9 + 0ec04f7 commit d2867097c94818d9d6c6468076b5aefcbafefbbd
Showing with 1,620 additions and 156 deletions.
  1. +15 −0 framework/doc/content/source/userobject/NearestPointIntegralVariablePostprocessor.md
  2. +15 −0 framework/doc/content/source/userobject/NearestPointLayeredSideAverage.md
  3. +1 −0 framework/include/base/Moose.h
  4. +1 −0 framework/include/postprocessors/ElementIntegralPostprocessor.h
  5. +1 −0 framework/include/postprocessors/SideIntegralPostprocessor.h
  6. +9 −0 framework/include/problems/FEProblemBase.h
  7. +2 −5 framework/include/transfers/MultiAppDTKInterpolationTransfer.h
  8. +64 −0 framework/include/transfers/MultiAppFieldTransfer.h
  9. +2 −7 framework/include/transfers/MultiAppInterpolationTransfer.h
  10. +2 −8 framework/include/transfers/MultiAppMeshFunctionTransfer.h
  11. +2 −7 framework/include/transfers/MultiAppNearestNodeTransfer.h
  12. +2 −5 framework/include/transfers/MultiAppProjectionTransfer.h
  13. +1 −1 framework/include/userobject/ElementIntegralUserObject.h
  14. +31 −25 framework/include/userobject/NearestPointBase.h
  15. +43 −0 framework/include/userobject/NearestPointIntegralVariablePostprocessor.h
  16. +2 −1 framework/include/userobject/NearestPointLayeredAverage.h
  17. +35 −0 framework/include/userobject/NearestPointLayeredSideAverage.h
  18. +1 −1 framework/include/userobject/SideIntegralUserObject.h
  19. +2 −0 framework/src/base/Moose.C
  20. +6 −1 framework/src/postprocessors/ElementIntegralPostprocessor.C
  21. +3 −0 framework/src/postprocessors/Postprocessor.C
  22. +6 −1 framework/src/postprocessors/SideIntegralPostprocessor.C
  23. +19 −0 framework/src/problems/FEProblemBase.C
  24. +14 −15 framework/src/transfers/MultiAppDTKInterpolationTransfer.C
  25. +461 −0 framework/src/transfers/MultiAppFieldTransfer.C
  26. +6 −16 framework/src/transfers/MultiAppInterpolationTransfer.C
  27. +17 −28 framework/src/transfers/MultiAppMeshFunctionTransfer.C
  28. +6 −16 framework/src/transfers/MultiAppNearestNodeTransfer.C
  29. +8 −7 framework/src/transfers/MultiAppProjectionTransfer.C
  30. +0 −1 framework/src/transfers/MultiAppTransfer.C
  31. +6 −1 framework/src/userobject/ElementIntegralUserObject.C
  32. +85 −0 framework/src/userobject/NearestPointIntegralVariablePostprocessor.C
  33. +3 −2 framework/src/userobject/NearestPointLayeredAverage.C
  34. +31 −0 framework/src/userobject/NearestPointLayeredSideAverage.C
  35. +6 −1 framework/src/userobject/SideIntegralUserObject.C
  36. +6 −6 modules/phase_field/src/action/CHPFCRFFSplitVariablesAction.C
  37. +1 −1 test/tests/outputs/format/tests
  38. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_conservative_transfer_out.e
  39. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_conservative_transfer_out_sub0.e
  40. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_nearest_point_out.e
  41. +3 −0 ...ransfers/multiapp_conservative_transfer/gold/master_nearest_point_out_from_nearest_point_0001.csv
  42. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_nearest_point_out_sub0.e
  43. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_nearest_point_out_sub1.e
  44. +3 −0 .../transfers/multiapp_conservative_transfer/gold/master_nearest_point_out_to_nearest_point_0001.csv
  45. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_power_density_out.e
  46. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_power_density_out_sub0.e
  47. BIN test/tests/transfers/multiapp_conservative_transfer/gold/master_power_density_out_sub1.e
  48. +76 −0 test/tests/transfers/multiapp_conservative_transfer/master_conservative_transfer.i
  49. +133 −0 test/tests/transfers/multiapp_conservative_transfer/master_nearest_point.i
  50. +141 −0 test/tests/transfers/multiapp_conservative_transfer/master_power_density.i
  51. +74 −0 test/tests/transfers/multiapp_conservative_transfer/sub_conservative_transfer.i
  52. +77 −0 test/tests/transfers/multiapp_conservative_transfer/sub_nearest_point.i
  53. +77 −0 test/tests/transfers/multiapp_conservative_transfer/sub_power_density.i
  54. +33 −0 test/tests/transfers/multiapp_conservative_transfer/tests
  55. BIN ...ests/userobjects/nearest_point_layered_side_average/gold/nearest_point_layered_side_average_out.e
  56. +78 −0 test/tests/userobjects/nearest_point_layered_side_average/nearest_point_layered_side_average.i
  57. +10 −0 test/tests/userobjects/nearest_point_layered_side_average/tests
@@ -0,0 +1,15 @@
# NearestPointIntegralVariablePostprocessor

The domain is virtually divided into a number of subdomains according to the
nearest points provided by users. And then the variable integral is taken over
each individual subdomain separately.

!syntax description /VectorPostprocessors/NearestPointIntegralVariablePostprocessor

!syntax parameters /VectorPostprocessors/NearestPointIntegralVariablePostprocessor

!syntax inputs /VectorPostprocessors/NearestPointIntegralVariablePostprocessor

!syntax children /VectorPostprocessors/NearestPointIntegralVariablePostprocessor

!bibtex bibliography
@@ -0,0 +1,15 @@
# NearestPointLayeredSideAverage

The domain is virtually divided into a number of subdomains according to the
nearest points provided by users. And then the layered side average
is computed for the sides on each individual subdomain separately.

!syntax description /UserObjects/NearestPointLayeredSideAverage

!syntax parameters /UserObjects/NearestPointLayeredSideAverage

!syntax inputs /UserObjects/NearestPointLayeredSideAverage

!syntax children /UserObjects/NearestPointLayeredSideAverage

!bibtex bibliography
@@ -107,6 +107,7 @@ extern const ExecFlagType EXEC_SUBDOMAIN;
extern const ExecFlagType EXEC_PRE_DISPLACE;
extern const ExecFlagType EXEC_SAME_AS_MULTIAPP;
extern const ExecFlagType EXEC_PRE_MULTIAPP_SETUP;
extern const ExecFlagType EXEC_TRANSFER;

namespace Moose
{
@@ -32,6 +32,7 @@ class ElementIntegralPostprocessor : public ElementPostprocessor
virtual void execute() override;
virtual void threadJoin(const UserObject & y) override;
virtual Real getValue() override;
virtual void finalize() override;

protected:
virtual Real computeQpIntegral() = 0;
@@ -32,6 +32,7 @@ class SideIntegralPostprocessor : public SidePostprocessor
virtual void execute() override;
virtual Real getValue() override;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override;

protected:
virtual Real computeQpIntegral() = 0;
@@ -1478,6 +1478,11 @@ class FEProblemBase : public SubProblem, public Restartable
*/
virtual void computeUserObjects(const ExecFlagType & type, const Moose::AuxGroup & group);

/**
* Compute an user object with the given name
*/
virtual void computeUserObjectByName(const ExecFlagType & type, const std::string & name);

/**
* Call compute methods on AuxKernels
*/
@@ -1784,6 +1789,10 @@ class FEProblemBase : public SubProblem, public Restartable
/// Helper to check for duplicate variable names across systems or within a single system
bool duplicateVariableCheck(const std::string & var_name, const FEType & type, bool is_aux);

void computeUserObjectsInternal(const ExecFlagType & type,
const Moose::AuxGroup & group,
TheWarehouse::Query & query);

/// Verify that SECOND order mesh uses SECOND order displacements.
void checkDisplacementOrders();

@@ -13,7 +13,7 @@

#ifdef LIBMESH_TRILINOS_HAVE_DTK

#include "MultiAppTransfer.h"
#include "MultiAppFieldTransfer.h"
#include "DTKInterpolationHelper.h"

// Forward declarations
@@ -25,17 +25,14 @@ InputParameters validParams<MultiAppDTKInterpolationTransfer>();
/**
* Transfers from spatially varying Interpolations in a MultiApp to the "master" system.
*/
class MultiAppDTKInterpolationTransfer : public MultiAppTransfer
class MultiAppDTKInterpolationTransfer : public MultiAppFieldTransfer
{
public:
MultiAppDTKInterpolationTransfer(const InputParameters & parameters);

virtual void execute() override;

protected:
VariableName _from_var_name;
AuxVariableName _to_var_name;

DTKInterpolationHelper _helper;
Point _master_position;
};
@@ -0,0 +1,64 @@
//* 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

#pragma once

#include "MultiAppTransfer.h"

// Forward declarations
class MultiAppFieldTransfer;

template <>
InputParameters validParams<MultiAppFieldTransfer>();

/**
* This serves an interface for MultiAppInterpolationTransfer, MultiAppNearestNodeTransfer and so
* on.
*/
class MultiAppFieldTransfer : public MultiAppTransfer
{
public:
MultiAppFieldTransfer(const InputParameters & parameters);

virtual void initialSetup();

/**
* Add some extra work if necessary after execute(). For example, adjust the solution
* to preserve some physics quality of interest.
*/
virtual void postExecute();

protected:
std::vector<VariableName> _from_var_names;
std::vector<AuxVariableName> _to_var_names;

VariableName _from_var_name;
AuxVariableName _to_var_name;

// If this transfer is going to conserve the physics
bool _preserve_transfer;
// Postprocessor evaluates an adjuster for the source physics
std::vector<PostprocessorName> _from_postprocessors_to_be_preserved;
// Postprocessor evaluates an adjuster for the target physics
std::vector<PostprocessorName> _to_postprocessors_to_be_preserved;

private:
void adjustTransferedSolution(FEProblemBase * from_problem,
PostprocessorName & from_postprocessor,
FEProblemBase & to_problem,
PostprocessorName & to_postprocessor);

void adjustTransferedSolutionNearestPoint(unsigned int i,
FEProblemBase * from_problem,
PostprocessorName & from_postprocessor,
FEProblemBase & to_problem,
PostprocessorName & to_postprocessor);

bool _use_nearestpoint_pps;
};
@@ -10,7 +10,7 @@
#pragma once

// MOOSE includes
#include "MultiAppTransfer.h"
#include "MultiAppFieldTransfer.h"

#include "libmesh/mesh_base.h"

@@ -23,13 +23,11 @@ InputParameters validParams<MultiAppInterpolationTransfer>();
/**
* Copy the value to the target domain from the nearest node in the source domain.
*/
class MultiAppInterpolationTransfer : public MultiAppTransfer
class MultiAppInterpolationTransfer : public MultiAppFieldTransfer
{
public:
MultiAppInterpolationTransfer(const InputParameters & parameters);

virtual void initialSetup() override;

virtual void execute() override;

protected:
@@ -46,9 +44,6 @@ class MultiAppInterpolationTransfer : public MultiAppTransfer
const MeshBase::const_node_iterator & nodes_begin,
const MeshBase::const_node_iterator & nodes_end);

AuxVariableName _to_var_name;
VariableName _from_var_name;

unsigned int _num_points;
Real _power;
MooseEnum _interp_type;
@@ -9,7 +9,7 @@

#pragma once

#include "MultiAppTransfer.h"
#include "MultiAppFieldTransfer.h"

// Forward declarations
class MultiAppMeshFunctionTransfer;
@@ -23,20 +23,14 @@ InputParameters validParams<MultiAppMeshFunctionTransfer>();
* the MultiApp is. Copies that value into a postprocessor in the MultiApp.
* The source and destination vectors (of variables) should be ordered consistently.
*/
class MultiAppMeshFunctionTransfer : public MultiAppTransfer
class MultiAppMeshFunctionTransfer : public MultiAppFieldTransfer
{
public:
MultiAppMeshFunctionTransfer(const InputParameters & parameters);

virtual void initialSetup() override;

virtual void execute() override;

protected:
/// The vector of variables to transfer to
std::vector<AuxVariableName> _to_var_name;
/// The vector of variables to transfer from
std::vector<VariableName> _from_var_name;
/// The number of variables to transfer
unsigned int _var_size;
bool _error_on_miss;
@@ -10,7 +10,7 @@
#pragma once

// MOOSE includes
#include "MultiAppTransfer.h"
#include "MultiAppFieldTransfer.h"

// Forward declarations
class MultiAppNearestNodeTransfer;
@@ -25,13 +25,11 @@ InputParameters validParams<MultiAppNearestNodeTransfer>();
/**
* Copy the value to the target domain from the nearest node in the source domain.
*/
class MultiAppNearestNodeTransfer : public MultiAppTransfer
class MultiAppNearestNodeTransfer : public MultiAppFieldTransfer
{
public:
MultiAppNearestNodeTransfer(const InputParameters & parameters);

virtual void initialSetup() override;

virtual void execute() override;

protected:
@@ -69,9 +67,6 @@ class MultiAppNearestNodeTransfer : public MultiAppTransfer
std::vector<std::pair<Point, DofObject *>> & local_entities,
bool nodal);

AuxVariableName _to_var_name;
VariableName _from_var_name;

/// If true then node connections will be cached
bool _fixed_meshes;

@@ -9,7 +9,7 @@

#pragma once

#include "MultiAppTransfer.h"
#include "MultiAppFieldTransfer.h"

// Forward declarations
namespace libMesh
@@ -25,7 +25,7 @@ InputParameters validParams<MultiAppProjectionTransfer>();
/**
* Project values from one domain to another
*/
class MultiAppProjectionTransfer : public MultiAppTransfer
class MultiAppProjectionTransfer : public MultiAppFieldTransfer
{
public:
MultiAppProjectionTransfer(const InputParameters & parameters);
@@ -42,9 +42,6 @@ class MultiAppProjectionTransfer : public MultiAppTransfer

void projectSolution(unsigned int to_problem);

AuxVariableName _to_var_name;
VariableName _from_var_name;

MooseEnum _proj_type;

/// True, if we need to recompute the projection matrix
@@ -33,7 +33,7 @@ class ElementIntegralUserObject : public ElementUserObject
virtual void initialize() override;
virtual void execute() override;
virtual void threadJoin(const UserObject & y) override;
virtual void finalize() override {}
virtual void finalize() override;

/// Returns the integral value
virtual Real getValue();

0 comments on commit d286709

Please sign in to comment.
You can’t perform that action at this time.