www.mooseframework.org
MultiAppDTKUserObjectTransfer.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "libmesh/libmesh_config.h"
11 
12 #ifdef LIBMESH_TRILINOS_HAVE_DTK
13 
16 #include "MultiApp.h"
17 
18 // Moose Includes
19 #include "MooseTypes.h"
20 #include "FEProblem.h"
21 #include "MooseVariableFE.h"
22 
24 
25 template <>
28 {
30  params.addRequiredParam<AuxVariableName>(
31  "variable", "The auxiliary variable to store the transferred values in.");
32  params.addRequiredParam<UserObjectName>(
33  "user_object",
34  "The UserObject you want to transfer values from. Note: This might be a "
35  "UserObject from your MultiApp's input file!");
36  return params;
37 }
38 
40  : MultiAppTransfer(parameters),
41  MooseVariableInterface<Real>(this,
42  true,
43  "variable",
46  _user_object_name(getParam<UserObjectName>("user_object")),
47  _setup(false)
48 {
49 }
50 
51 void
53 {
54  if (!_setup)
55  {
56  _setup = true;
57 
58  _comm_default = Teuchos::rcp(new Teuchos::MpiComm<int>(
59  Teuchos::rcp(new Teuchos::OpaqueWrapper<MPI_Comm>(_communicator.get()))));
60 
63 
65 
67 
68  _to_adapter =
69  new DTKInterpolationAdapter(_comm_default, _multi_app->problemBase().es(), Point(), 3);
70 
72  new DataTransferKit::VolumeSourceMap<DataTransferKit::Box,
74  DataTransferKit::MeshContainer<GlobalOrdinal>>(
75  _comm_default, 3, true);
76 
77  _console << "--Setting Up Transfer--" << std::endl;
78  if (_variable->isNodal())
80  else
82 
83  _console << "--Transfer Setup Complete--" << std::endl;
84 
86  }
87 
88  _console << "--Mapping Values--" << std::endl;
90  _console << "--Finished Mapping--" << std::endl;
91 
92  _to_adapter->update_variable_values(_variable->name(), _src_to_tgt_map->getMissedTargetPoints());
93  _multi_app->problemBase().es().update();
94 }
95 
96 #endif // LIBMESH_TRILINOS_HAVE_DTK
VarFieldType
Definition: MooseTypes.h:488
void update_variable_values(std::string var_name, Teuchos::ArrayView< GlobalOrdinal > missed_points)
After computing values for a variable in this EquationSystems we need to take those values and put th...
Evaluates the specified UserObject and returns the result in a DTK FieldContainer.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
registerMooseObject("MooseApp", MultiAppDTKUserObjectTransfer)
Transfers from spatially varying UserObjects in a MultiApp to the "master" system.
std::shared_ptr< MultiApp > _multi_app
The MultiApp this Transfer is transferring data to or from.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Teuchos::RCP< const Teuchos::MpiComm< int > > _comm_default
MultiAppDTKUserObjectTransfer(const InputParameters &parameters)
VarKindType
Framework-wide stuff.
Definition: MooseTypes.h:481
virtual void execute() override
Execute the transfer.
Teuchos::RCP< DataTransferKit::FieldManager< DTKAdapter::FieldContainerType > > _to_values
DataTransferKit::VolumeSourceMap< DataTransferKit::Box, GlobalOrdinal, DataTransferKit::MeshContainer< GlobalOrdinal > > * _src_to_tgt_map
InputParameters validParams< MultiAppDTKUserObjectTransfer >()
MooseVariableFE< Real > * _variable
The variable this object is acting on.
bool isNodal() const override
Is this variable nodal.
Teuchos::RCP< MultiAppDTKUserObjectEvaluator > _multi_app_user_object_evaluator
Teuchos::RCP< DataTransferKit::FieldManager< MeshContainerType > > get_elem_target_coords()
Used to get the centroids for the receiving elements.
InputParameters validParams< MultiAppTransfer >()
Teuchos::RCP< DataTransferKit::GeometryManager< DataTransferKit::Box, GlobalOrdinal > > _multi_app_geom
Base class for all MultiAppTransfer objects.
const std::string & name() const
Get the variable name.
Interface for objects that need to get values of MooseVariables.
Definition: Moose.h:112
Teuchos::RCP< DataTransferKit::FieldEvaluator< GlobalOrdinal, DataTransferKit::FieldContainer< double > > > _field_evaluator
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
Teuchos::RCP< DataTransferKit::FieldManager< FieldContainerType > > get_values_to_fill(std::string var_name)
Teuchos::RCP< DataTransferKit::FieldManager< MeshContainerType > > get_target_coords()