Skip to content
Permalink
Browse files

Merge pull request #13447 from fdkong/fixed_trillions_conservative_tr…

…ansfer

Revert changes in MultiAppDTKInterpolationTransfer for Trilinos
  • Loading branch information...
permcody committed May 20, 2019
2 parents 77c5b83 + f3e6976 commit 3063c66c494d2a0d8e6d2f237ce3a7d76b6deafd
@@ -13,7 +13,7 @@

#ifdef LIBMESH_TRILINOS_HAVE_DTK

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

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

virtual void execute() override;

protected:
VariableName _from_var_name;
AuxVariableName _to_var_name;

DTKInterpolationHelper _helper;
Point _master_position;
};
@@ -24,16 +24,19 @@ template <>
InputParameters
validParams<MultiAppDTKInterpolationTransfer>()
{
InputParameters params = validParams<MultiAppFieldTransfer>();
InputParameters params = validParams<MultiAppTransfer>();
params.addRequiredParam<AuxVariableName>(
"variable", "The auxiliary variable to store the transferred values in.");
params.addRequiredParam<VariableName>("source_variable", "The variable to transfer from.");
return params;
}

MultiAppDTKInterpolationTransfer::MultiAppDTKInterpolationTransfer(
const InputParameters & parameters)
: MultiAppFieldTransfer(parameters)
: MultiAppTransfer(parameters),
_from_var_name(getParam<VariableName>("source_variable")),
_to_var_name(getParam<AuxVariableName>("variable"))
{
if (_to_var_name.size() != 1 && _from_var_name.size() != 1)
mooseError(" Support single variable only ");
}

void
@@ -50,17 +53,17 @@ MultiAppDTKInterpolationTransfer::execute()
{
case TO_MULTIAPP:
{
System * from_sys = find_sys(_multi_app->problemBase().es(), _from_var_name[0]);
System * from_sys = find_sys(_multi_app->problemBase().es(), _from_var_name);
System * to_sys = NULL;

if (_multi_app->hasLocalApp(i))
to_sys = find_sys(_multi_app->appProblemBase(i).es(), _to_var_name[0]);
to_sys = find_sys(_multi_app->appProblemBase(i).es(), _to_var_name);

_helper.transferWithOffset(
0,
i,
&from_sys->variable(from_sys->variable_number(_from_var_name[0])),
to_sys ? &to_sys->variable(to_sys->variable_number(_to_var_name[0])) : NULL,
&from_sys->variable(from_sys->variable_number(_from_var_name)),
to_sys ? &to_sys->variable(to_sys->variable_number(_to_var_name)) : NULL,
_master_position,
_multi_app->position(i),
const_cast<libMesh::Parallel::communicator *>(&_communicator.get()),
@@ -71,16 +74,16 @@ MultiAppDTKInterpolationTransfer::execute()
case FROM_MULTIAPP:
{
System * from_sys = NULL;
System * to_sys = find_sys(_multi_app->problemBase().es(), _to_var_name[0]);
System * to_sys = find_sys(_multi_app->problemBase().es(), _to_var_name);

if (_multi_app->hasLocalApp(i))
from_sys = find_sys(_multi_app->appProblemBase(i).es(), _from_var_name[0]);
from_sys = find_sys(_multi_app->appProblemBase(i).es(), _from_var_name);

_helper.transferWithOffset(
i,
0,
from_sys ? &from_sys->variable(from_sys->variable_number(_from_var_name[0])) : NULL,
&to_sys->variable(to_sys->variable_number(_to_var_name[0])),
from_sys ? &from_sys->variable(from_sys->variable_number(_from_var_name)) : NULL,
&to_sys->variable(to_sys->variable_number(_to_var_name)),
_multi_app->position(i),
_master_position,
from_sys ? &_multi_app->comm() : NULL,
@@ -94,8 +97,6 @@ MultiAppDTKInterpolationTransfer::execute()
_multi_app->appProblemBase(i).es().update();
}
}

postExecute();
}

#endif // LIBMESH_TRILINOS_HAVE_DTK

0 comments on commit 3063c66

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