37 #ifndef MultiscaleCoupling_H 38 #define MultiscaleCoupling_H 1
40 #include <lifev/multiscale/framework/MultiscaleDefinitions.hpp> 41 #include <lifev/multiscale/framework/MultiscaleGlobalData.hpp> 42 #include <lifev/multiscale/models/MultiscaleModel.hpp> 44 #include <lifev/multiscale/framework/MultiscaleInterface.hpp> 104 virtual void setupData (
const std::string& fileName );
162 return M_models[localModelID].get() ?
true :
false;
187 importCouplingVector ( localCouplingVariables ( 0 ), couplingVariables, Add );
196 exportCouplingVector ( couplingVariables, localCouplingVariables ( 0 ), Zero );
205 exportCouplingVector ( couplingResiduals, *M_localCouplingResiduals, Add );
276 M_models.resize ( modelsNumber );
277 M_boundaryIDs.resize ( modelsNumber );
287 M_models[localModelID] = model;
297 M_boundaryIDs[modelLocalID] = boundaryLocalID;
360 return M_models.size();
377 return M_models[localModelID];
387 return M_boundaryIDs[localModelID];
424 return *M_localCouplingResiduals;
481 return *M_localCouplingVariables[id];
485 return *M_localCouplingVariables[id];
560 UInt myModelsNumber ( 0 );
568 return myModelsNumber;
void setModelsNumber(const UInt &modelsNumber)
Set the number of models coupled by this coupling condition.
void importCouplingVariables(const multiscaleVector_Type &couplingVariables)
Import the values of the coupling variables.
Epetra_CombineMode combineMode_Type
UInt modelGlobalToLocalID(const UInt &ID) const
Get the model local ID through global ID.
virtual void setupCoupling()=0
Setup the coupling.
bool isPerturbed() const
Find if a perturbation is imposed on the coupling.
void switchErrorMessage(const multiscaleModelPtr_Type &model)
Display and error message for the specific model.
UInt myModelsNumber() const
Determine the number of models owned by this coupling.
void setID(const UInt &ID)
Set the global ID of the coupling condition.
MultiscaleCouplingFunction - The multiscale function for the couplings.
multiscaleDataPtr_Type M_globalData
UInt M_timeInterpolationOrder
std::vector< Real > timeContainer_Type
void setGlobalData(const multiscaleDataPtr_Type &globalData)
Setup the global data of the coupling.
flag_Type multiscaleID_Type
multiscaleCommPtr_Type M_comm
void showMeCouplingVariables() const
Display the local coupling variables.
Displayer::commPtr_Type multiscaleCommPtr_Type
MultiscaleCouplingFunction couplingFunction_Type
void interpolateCouplingVariables(const Real &t, multiscaleVector_Type &interpolatedCouplingVariables) const
Lagrange interpolation/extrapolation of the coupling variables at selected time.
void createLocalVectors()
Create the local vectors of the coupling.
UInt M_couplingVariablesOffset
virtual void updateCoupling()=0
Update the coupling.
std::shared_ptr< multiscaleData_Type > multiscaleDataPtr_Type
void extrapolateCouplingVariables()
Extrapolate the values of the coupling variables for the next time step.
void importCouplingVector(multiscaleVector_Type &repeatedLocalVector, const multiscaleVector_Type &uniqueGlobalVector, const combineMode_Type &combineMode=Add)
Import the content of the unique global vector into the repeated local vector.
void exportCouplingResiduals(multiscaleVector_Type &couplingResiduals)
Export the values of the coupling variables.
MultiscaleCoupling multiscaleCoupling_Type
void setBoundaryID(const UInt &modelLocalID, const multiscaleID_Type &boundaryLocalID)
Set the boundary ID of one of the coupled models.
void exportCouplingVariables(multiscaleVector_Type &couplingVariables)
Export the values of the coupling variables.
const multiscaleID_Type & boundaryID(const UInt &localModelID) const
Get the model connected by the coupling through local ID.
int32_type Int
Generic integer data.
MultiscaleCoupling()
Constructor.
void exportCouplingVector(multiscaleVector_Type &uniqueGlobalVector, const multiscaleVector_Type &repeatedLocalVector, const combineMode_Type &combineMode=Add)
Export the content of the repeated local vector into the unique global vector.
const couplingVariablesContainer_Type & couplingVariables() const
Get the container of the local coupling variables.
void updateInverseJacobian(const UInt &iQuadPt)
const multiscaleCoupling_Type * M_coupling
UInt modelsNumber() const
Get the number of models connected by the coupling.
std::shared_ptr< couplingFunction_Type > couplingFunctionPtr_Type
std::shared_ptr< multiscaleModel_Type > multiscaleModelPtr_Type
MultiscaleCouplingFunction()
Constructor.
virtual bool topologyChange()
Check if the topology is changed.
Epetra_Import const & importer()
Getter for the Epetra_Import.
void setCommunicator(const multiscaleCommPtr_Type &comm)
Set the epetra communicator for the coupling.
const UInt & ID() const
Get the global ID of the coupling.
virtual void insertJacobianConstantCoefficients(multiscaleMatrix_Type &jacobian)=0
Insert constant coefficients into the Jacobian matrix.
couplingVariablesContainer_Type M_localCouplingVariables
MultiscaleCouplingFunction(const multiscaleCoupling_Type *coupling, const UInt &id)
Constructor.
void saveSolution()
save the coupling variables information on a file
multiscaleModelsContainer_Type M_models
multiscaleVector_Type & localCouplingVariables(const UInt &id)
std::vector< couplingFunction_Type > couplingFunctionsContainer_Type
const multiscaleVector_Type & residual() const
Get the local residual.
UInt M_couplingVariablesNumber
MatrixEpetra< Real > multiscaleMatrix_Type
virtual void setupCouplingVariablesNumber()=0
Setup the coupling variables number.
std::vector< multiscaleModelPtr_Type > multiscaleModelsContainer_Type
bool isModelLeaderProcess(const UInt &localModelID) const
Determine if this is the model leader process.
MultiscaleCoupling(const MultiscaleCoupling &coupling)
void resetCouplingHistory()
Reset the history of the couplings.
const UInt & timeInterpolationOrder() const
Get the time interpolation order.
void exportJacobian(multiscaleMatrix_Type &jacobian)
Export the Jacobian matrix.
couplingFunctionsContainer_Type M_localCouplingFunctions
multiscaleVectorPtr_Type M_localCouplingResiduals
virtual ~MultiscaleCoupling()
Destructor.
const UInt & couplingVariablesNumber() const
Get the number of the coupling variables.
double Real
Generic real data.
multiscaleIDContainer_Type M_boundaryIDs
void showMeResiduals() const
Display the local residuals vector.
std::vector< multiscaleID_Type > multiscaleIDContainer_Type
virtual void exportListOfPerturbedModels(const UInt &localCouplingVariableID, multiscaleModelsContainer_Type &perturbedModelsList)=0
Build the list of models affected by the perturbation of the local coupling variable.
Real function(const Real &t, const Real &, const Real &, const Real &, const UInt &)
Evaluate the coupling quantity.
virtual ~MultiscaleCouplingFunction()
Destructor.
const Int & perturbedCoupling() const
Get the perturbed coupling.
multiscaleModelPtr_Type model(const UInt &localModelID) const
Get the model connected by the coupling through local ID.
bool myModel(const UInt &localModelID) const
Determine if the model is owned by this coupling.
void clearModelsList()
Clear the list of pointers to the models.
virtual void insertJacobianDeltaCoefficients(multiscaleMatrix_Type &jacobian, const UInt &column, const UInt &ID, bool &linearSystemSolved)=0
Insert the Jacobian coefficient(s) depending on a perturbation of the model, due to a specific variab...
std::string M_couplingName
const std::string & couplingName() const
Get the name of the coupling.
virtual void computeCouplingResiduals()=0
Compute the values of the local coupling residuals.
const couplings_Type & type() const
Get the type of the coupling.
const multiscaleVector_Type & localCouplingVariables(const UInt &id) const
Access by reference to a specific local coupling variable.
void setModel(const UInt &localModelID, const multiscaleModelPtr_Type &model)
Add a pointer to one of the models to be coupled.
void createCouplingMap(MapEpetra &couplingMap)
Build the global map for the coupling vectors.
MultiscaleCoupling - The Multiscale Physical Coupling.
std::vector< multiscaleVectorPtr_Type > couplingVariablesContainer_Type
std::shared_ptr< multiscaleVector_Type > multiscaleVectorPtr_Type
MultiscaleCoupling & operator=(const MultiscaleCoupling &coupling)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
VectorEpetra multiscaleVector_Type
data_type & operator[](const UInt row)
Access operators.
void showMe()
Display some information about the coupling.
virtual void initializeCouplingVariables()=0
Initialize the values of the coupling variables.