Skip to content

Commit

Permalink
Allow general field transfers to do siblings
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Jan 31, 2024
1 parent c581c9a commit 9aa6ce3
Show file tree
Hide file tree
Showing 58 changed files with 21 additions and 7 deletions.
Expand Up @@ -64,7 +64,6 @@ The following features cannot be supported by general field transfers, as a limi
the `MultiAppGeneralFieldTransfer` base class.

- bi-directional transfer, a single transfer that send data to an app and from that same application
- transfers between two sibling `MultiApps` with different numbers of child applications
- reduction operations, sum/average/min/max, on data transferred from multiple child apps
- transfers between vector variables

Expand All @@ -73,6 +72,13 @@ These features are currently unsupported, but could be enabled if necessary with

- caching optimizations for when both the target and origin mesh are constant

## Siblings transfer behavior

This transfer supports sending data from a MultiApp to a MultiApp with an arbitrary number
of source subapps in the source MultiApp and an arbitrary, possibly non-matching, number
of target subapps in the target MultiApp. It is the user's responsibility to ensure the
transfer is well defined, for example by avoiding overlaps between source multiapps which cause
multiple valid values for a target point.

## Use of bounding boxes

Expand Down
3 changes: 3 additions & 0 deletions framework/include/transfers/MultiAppGeneralFieldTransfer.h
Expand Up @@ -52,6 +52,9 @@ class MultiAppGeneralFieldTransfer : public MultiAppConservativeTransfer
VariableName getToVarName(unsigned int var_index);

protected:
/// Siblings transfers fully supported
virtual void checkSiblingsTransferSupported() const override {}

/*
* Prepare evaluation of interpolation values
* @param var_index index of the variable & component to prepare for. This routine is called once
Expand Down
7 changes: 7 additions & 0 deletions framework/include/transfers/MultiAppTransfer.h
Expand Up @@ -205,6 +205,13 @@ class MultiAppTransfer : public Transfer
/// We use the fact that global app indexes are consecutive on a given rank
unsigned int getLocalSourceAppIndex(unsigned int i_from) const;

/// Whether the transfer supports siblings transfer
virtual void checkSiblingsTransferSupported() const
{
mooseError("Siblings transfer not supported. You cannot transfer both from a multiapp to "
"another multiapp");
};

/**
* Get the target app point from a point in the reference frame
* @param p the point in the reference frame
Expand Down
10 changes: 4 additions & 6 deletions framework/src/transfers/MultiAppTransfer.C
Expand Up @@ -140,12 +140,6 @@ MultiAppTransfer::MultiAppTransfer(const InputParameters & parameters)
_current_direction = _directions[0];
}

// Check for different number of subapps
if (_to_multi_app && _from_multi_app &&
_from_multi_app->numGlobalApps() != _to_multi_app->numGlobalApps())
mooseError(
"Between multiapp transfer is only supported with the same number of subapps per MultiApp");

// Handle deprecated parameters
if (parameters.isParamSetByUser("direction"))
{
Expand Down Expand Up @@ -217,6 +211,10 @@ MultiAppTransfer::variableIntegrityCheck(const AuxVariableName & var_name) const
void
MultiAppTransfer::initialSetup()
{
// Check for siblings transfer support
if (_to_multi_app && _from_multi_app)
checkSiblingsTransferSupported();

getAppInfo();

if (_from_multi_app)
Expand Down

0 comments on commit 9aa6ce3

Please sign in to comment.