37 #include <lifev/multiscale/couplings/MultiscaleCouplingMeanTotalNormalStressArea.hpp> 51 #ifdef HAVE_LIFEV_DEBUG 52 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::MultiscaleCouplingMeanTotalNormalStressArea() \n";
65 #ifdef HAVE_LIFEV_DEBUG 66 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::setupCouplingVariablesNumber() \n";
76 #ifdef HAVE_LIFEV_DEBUG 77 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::setupCoupling() \n";
80 super_Type::setupCoupling();
83 if ( myModelsNumber() > 0 )
85 if ( modelsNumber() > 2 )
87 std::cerr <<
"!!! ERROR: MultiscaleCouplingMeanTotalNormalStressArea does not work with more than two models !!!" << std::endl;
93 if ( myModelsNumber() > 0 )
96 for (
UInt i ( 0 ); i < 2; ++i )
98 if ( M_models[i]->type() == FSI3D )
100 M_localCouplingFunctions.push_back ( MultiscaleCouplingFunction (
this, 3 ) );
101 multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->imposeBoundaryArea ( M_boundaryIDs[i], std::bind ( &MultiscaleCouplingFunction::function, M_localCouplingFunctions.back(), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 ) );
112 #ifdef HAVE_LIFEV_DEBUG 113 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::initializeCouplingVariables() \n";
116 super_Type::initializeCouplingVariables();
120 Real globalSum ( 0 );
123 for (
UInt i ( 0 ); i < 2; ++i )
126 Real myValue = multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->boundaryArea ( M_boundaryIDs[i] );
127 if ( isModelLeaderProcess ( i ) )
133 M_comm->SumAll ( &localSum, &globalSum, 1 );
134 if ( myModelsNumber() > 0 )
136 localCouplingVariables ( 0 ) [3] = globalSum / 2;
144 #ifdef HAVE_LIFEV_DEBUG 145 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::computeCouplingResiduals() \n";
148 super_Type::computeCouplingResiduals();
150 if ( myModelsNumber() > 0 )
153 for (
UInt i ( 0 ); i < 2; ++i )
155 if ( M_models[i]->type() == FSI1D )
157 Real myValueArea = multiscaleDynamicCast< MultiscaleInterface > ( M_models[i] )->boundaryArea ( M_boundaryIDs[i] );
158 if ( isModelLeaderProcess ( i ) )
160 ( *M_localCouplingResiduals ) [3] = myValueArea - localCouplingVariables ( 0 ) [3];
173 #ifdef HAVE_LIFEV_DEBUG 174 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::exportListOfPerturbedModels( localCouplingVariableID ) \n";
177 if ( localCouplingVariableID == 3 )
179 for (
UInt i ( 0 ); i < 2; ++i )
181 if ( M_models[i]->type() == FSI3D )
183 perturbedModelsList.push_back ( M_models[i] );
188 super_Type::exportListOfPerturbedModels ( localCouplingVariableID, perturbedModelsList );
196 #ifdef HAVE_LIFEV_DEBUG 197 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::insertJacobianConstantCoefficients( jacobian ) \n";
200 super_Type::insertJacobianConstantCoefficients ( jacobian );
204 if ( isModelLeaderProcess ( 0 ) )
206 jacobian.addToCoefficient ( M_couplingVariablesOffset + 3, M_couplingVariablesOffset + 3, -1 );
214 #ifdef HAVE_LIFEV_DEBUG 215 debugStream ( 8260 ) <<
"MultiscaleCouplingMeanTotalNormalStressArea::insertJacobianDeltaCoefficients( jacobian, column, ID, solveLinearSystem ) \n";
218 super_Type::insertJacobianDeltaCoefficients ( jacobian, column, ID, solveLinearSystem );
221 UInt modelLocalID = modelGlobalToLocalID ( ID );
222 if ( myModel ( modelLocalID ) )
223 if ( M_models[modelLocalID]->type() == FSI1D )
226 Real coefficient ( 0 );
229 coefficient = multiscaleDynamicCast< MultiscaleInterface > ( M_models[modelLocalID] )->boundaryDeltaArea ( M_boundaryIDs[modelLocalID], solveLinearSystem );
232 if ( isModelLeaderProcess ( modelLocalID ) )
234 jacobian.addToCoefficient ( row, column, coefficient );
236 #ifdef HAVE_LIFEV_DEBUG 237 debugStream ( 8260 ) <<
"J(" << row <<
"," << column <<
") = " << coefficient <<
"\n";
void computeCouplingResiduals()
Compute the local coupling residuals vector.
void insertJacobianDeltaCoefficients(multiscaleMatrix_Type &jacobian, const UInt &column, const UInt &ID, bool &solveLinearSystem)
Insert the Jacobian coefficient(s) depending on a perturbation of the model, due to a specific variab...
void setupCoupling()
Setup the coupling.
void insertJacobianConstantCoefficients(multiscaleMatrix_Type &jacobian)
Insert constant coefficients into the Jacobian matrix.
UInt M_couplingVariablesOffset
MultiscaleCoupling multiscaleCoupling_Type
MultiscaleCoupling()
Constructor.
void updateInverseJacobian(const UInt &iQuadPt)
MultiscaleCouplingMeanTotalNormalStressArea - Mean normal stress with area coupling condition...
MultiscaleCouplingMeanTotalNormalStressArea()
Constructor.
void initializeCouplingVariables()
Initialize the values of the coupling variables.
void exportListOfPerturbedModels(const UInt &localCouplingVariableID, multiscaleModelsContainer_Type &perturbedModelsList)
Build the list of models affected by the perturbation of a local coupling variable.
UInt M_couplingVariablesNumber
MatrixEpetra< Real > multiscaleMatrix_Type
std::vector< multiscaleModelPtr_Type > multiscaleModelsContainer_Type
void setupCouplingVariablesNumber()
Setup the coupling variables number.
double Real
Generic real data.
uint32_type UInt
generic unsigned integer (used mainly for addressing)