37 #include <lifev/multiscale/couplings/MultiscaleCouplingMeanNormalStressArea.hpp> 51 #ifdef HAVE_LIFEV_DEBUG 52 debugStream ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::MultiscaleCouplingMeanNormalStressArea() \n";
65 #ifdef HAVE_LIFEV_DEBUG 66 debugStream ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::setupCouplingVariablesNumber() \n";
76 #ifdef HAVE_LIFEV_DEBUG 77 debugStream ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::setupCoupling() \n";
80 super_Type::setupCoupling();
83 if ( myModelsNumber() > 0 )
85 if ( modelsNumber() > 2 )
87 std::cerr <<
"!!! ERROR: MultiscaleCouplingMeanNormalStressArea 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, M_flowRateInterfaces + 1 ) );
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 ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::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 ) [M_flowRateInterfaces + 1] = globalSum / 2;
144 #ifdef HAVE_LIFEV_DEBUG 145 debugStream ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::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 ) [M_flowRateInterfaces + 1] = myValueArea - localCouplingVariables ( 0 ) [M_flowRateInterfaces + 1];
173 #ifdef HAVE_LIFEV_DEBUG 174 debugStream ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::exportListOfPerturbedModels( localCouplingVariableID ) \n";
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 ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::insertJacobianConstantCoefficients( jacobian ) \n";
200 super_Type::insertJacobianConstantCoefficients ( jacobian );
204 if ( isModelLeaderProcess ( 0 ) )
206 jacobian.addToCoefficient ( M_couplingVariablesOffset + M_flowRateInterfaces + 1, M_couplingVariablesOffset + M_flowRateInterfaces + 1, -1 );
214 #ifdef HAVE_LIFEV_DEBUG 215 debugStream ( 8230 ) <<
"MultiscaleCouplingMeanNormalStressArea::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 ( 8230 ) <<
"J(" << row <<
"," << column <<
") = " << coefficient <<
"\n";
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...
UInt M_couplingVariablesOffset
MultiscaleCoupling multiscaleCoupling_Type
int32_type Int
Generic integer data.
MultiscaleCoupling()
Constructor.
void updateInverseJacobian(const UInt &iQuadPt)
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 setupCoupling()
Setup the coupling.
MultiscaleCouplingMeanNormalStressArea - Mean normal stress with area coupling condition.
double Real
Generic real data.
void computeCouplingResiduals()
Compute the local coupling residuals vector.
void setupCouplingVariablesNumber()
Setup the coupling variables number.
MultiscaleCouplingMeanNormalStressArea()
Constructor.
void insertJacobianConstantCoefficients(multiscaleMatrix_Type &jacobian)
Insert constant coefficients into the Jacobian matrix.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void initializeCouplingVariables()
Initialize the values of the coupling variables.