Skip to content

Commit

Permalink
Excute one single user object
Browse files Browse the repository at this point in the history
  • Loading branch information
fdkong committed May 17, 2019
1 parent ad5b089 commit c27b98b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions framework/include/base/Moose.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_POST_TRANSFER;

namespace Moose
{
Expand Down
7 changes: 7 additions & 0 deletions framework/include/problems/FEProblemBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,13 @@ class FEProblemBase : public SubProblem, public Restartable
*/
virtual void computeUserObjects(const ExecFlagType & type, const Moose::AuxGroup & group);

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

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

/**
* Call compute methods on AuxKernels
*/
Expand Down
2 changes: 2 additions & 0 deletions framework/src/base/Moose.C
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const ExecFlagType EXEC_SUBDOMAIN("SUBDOMAIN", 0x200); // 512
const ExecFlagType EXEC_PRE_DISPLACE("PRE_DISPLACE");
const ExecFlagType EXEC_SAME_AS_MULTIAPP("SAME_AS_MULTIAPP");
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP("PRE_MULTIAPP_SETUP");
const ExecFlagType EXEC_POST_TRANSFER("POST_TRANSFER");

void
MooseVecView(NumericVector<Number> & vector)
Expand Down Expand Up @@ -376,6 +377,7 @@ registerExecFlags(Factory & factory)
registerExecFlag(EXEC_FORCED);
registerExecFlag(EXEC_FAILED);
registerExecFlag(EXEC_CUSTOM);
registerExecFlag(EXEC_POST_TRANSFER);
registerExecFlag(EXEC_SUBDOMAIN);
registerExecFlag(EXEC_PRE_DISPLACE);
registerExecFlag(EXEC_SAME_AS_MULTIAPP);
Expand Down
14 changes: 14 additions & 0 deletions framework/src/problems/FEProblemBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -3068,11 +3068,25 @@ FEProblemBase::joinAndFinalize(TheWarehouse::Query query, bool isgen)
}
}

void
FEProblemBase::computeUserObjectByName(const ExecFlagType & type, const std::string & name)
{
TheWarehouse::Query query =
theWarehouse().query().condition<AttribSystem>("UserObject").condition<AttribExecOns>(type).condition<AttribName>(name);
computeUserObjectsInternal(type, Moose::POST_AUX, query);
}

void
FEProblemBase::computeUserObjects(const ExecFlagType & type, const Moose::AuxGroup & group)
{
TheWarehouse::Query query =
theWarehouse().query().condition<AttribSystem>("UserObject").condition<AttribExecOns>(type);
computeUserObjectsInternal(type, group, query);
}

void
FEProblemBase::computeUserObjectsInternal(const ExecFlagType & type, const Moose::AuxGroup & group, TheWarehouse::Query & query)
{
if (group == Moose::PRE_IC)
query.condition<AttribPreIC>(true);
else if (group == Moose::PRE_AUX)
Expand Down
7 changes: 6 additions & 1 deletion framework/src/transfers/MultiAppTransfer.C
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,15 @@ MultiAppTransfer::adjustTransferedSolution(FEProblemBase & from_problem, FEProbl
PostprocessorValue & from_adjuster =
from_problem.getPostprocessorValue(_from_postprocessor_to_be_preserved);
// Init problem so that to_postprocessor_to_be_preserved is set correctly
to_problem.execute(EXEC_INITIAL);
// to_problem.executeSingleUserObject(EXEC_INITIAL);
to_problem.computeUserObjectByName(EXEC_INITIAL, _to_postprocessor_to_be_preserved);
std::cout<<" to_problem.computeUserObjects "<<std::endl;
// Now we should have the right adjuster based on the transfered solution
PostprocessorValue & to_adjuster =
to_problem.getPostprocessorValue(_to_postprocessor_to_be_preserved);

std::cout<<" to_adjuster "<<to_adjuster<<std::endl;

// Scale the solution. Allow scale for selected variables???
to_problem.getNonlinearSystemBase().solution().scale(from_adjuster / to_adjuster);
// Update the local solution
Expand Down
3 changes: 2 additions & 1 deletion framework/src/utils/MooseUtils.C
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,8 @@ getDefaultExecFlagEnum()
EXEC_TIMESTEP_END,
EXEC_TIMESTEP_BEGIN,
EXEC_FINAL,
EXEC_CUSTOM);
EXEC_CUSTOM,
EXEC_POST_TRANSFER);
return exec_enum;
}

Expand Down

0 comments on commit c27b98b

Please sign in to comment.