37 #include <lifev/multiscale/couplings/MultiscaleCouplingMeanNormalStressValve.hpp> 54 #ifdef HAVE_LIFEV_DEBUG 55 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::MultiscaleCouplingMeanNormalStressValve() \n";
68 #ifdef HAVE_LIFEV_DEBUG 69 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::setupCoupling() \n";
72 super_Type::setupCoupling();
75 if ( myModelsNumber() > 0 )
77 if ( modelsNumber() > 2 )
79 std::cout <<
"!!! WARNING: MultiscaleCouplingMeanNormalStressValve does not work with more than two models !!!" << std::endl;
81 if ( M_flowRateInterfaces !=
static_cast<Int>(modelsNumber()) )
83 std::cout <<
"!!! WARNING: MultiscaleCouplingMeanNormalStressValve does not work with stress boundary data !!!" << std::endl;
92 #ifdef HAVE_LIFEV_DEBUG 93 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::initializeCouplingVariables() \n";
96 super_Type::initializeCouplingVariables();
101 Int localValvePosition ( 0 );
102 Int globalValvePosition ( 0 );
104 if ( isModelLeaderProcess ( 0 ) )
106 if ( localCouplingVariables ( 0 ) [M_flowRateInterfaces] <= 1e-10 )
108 std::cout <<
" MS- Valve closed at coupling " << M_ID << std::endl;
109 localValvePosition = 0;
113 std::cout <<
" MS- Valve open at coupling " << M_ID << std::endl;
114 localValvePosition = 1;
119 M_comm->SumAll ( &localValvePosition, &globalValvePosition, 1 );
122 if ( globalValvePosition == 0 )
125 if ( myModelsNumber() > 0 )
128 localCouplingVariables ( 0 ) [i] = 0;
141 #ifdef HAVE_LIFEV_DEBUG 142 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::updateCoupling() \n";
145 super_Type::updateCoupling();
149 Int localTopology ( 0 );
150 Int globalTopology ( 0 );
155 Real myValue = multiscaleDynamicCast< MultiscaleInterface > ( M_models[0] )->boundaryFlowRate ( M_boundaryIDs[0] );
156 if ( isModelLeaderProcess ( 0 ) && myValue < 0 )
158 std::cout <<
" MS- Closing the valve at coupling " << M_ID << std::endl;
165 Real globalSum ( 0 );
170 Real myValue = multiscaleDynamicCast< MultiscaleInterface > ( M_models[1] )->boundaryMeanNormalStress ( M_boundaryIDs[1] );
171 if ( isModelLeaderProcess ( 1 ) )
178 M_comm->SumAll ( &localSum, &globalSum, 1 );
182 Real myValue = globalSum - multiscaleDynamicCast< MultiscaleInterface > ( M_models[0] )->boundaryMeanNormalStress ( M_boundaryIDs[0] );
183 if ( isModelLeaderProcess ( 0 ) && myValue > 0 )
185 std::cout <<
" MS- Opening the valve at coupling " << M_ID << std::endl;
192 M_comm->SumAll ( &localTopology, &globalTopology, 1 );
194 if ( globalTopology > 0 )
200 resetCouplingHistory();
212 #ifdef HAVE_LIFEV_DEBUG 213 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::computeCouplingResiduals() \n";
218 super_Type::computeCouplingResiduals();
222 *M_localCouplingResiduals = 0.;
233 #ifdef HAVE_LIFEV_DEBUG 234 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::insertJacobianConstantCoefficients( jacobian ) \n";
239 super_Type::insertJacobianConstantCoefficients ( jacobian );
245 if ( isModelLeaderProcess ( 0 ) )
252 jacobian.addToCoefficient ( row + i, column + i, 1 );
262 #ifdef HAVE_LIFEV_DEBUG 263 debugStream ( 8240 ) <<
"MultiscaleCouplingMeanNormalStressValve::insertJacobianDeltaCoefficients( jacobian, column, ID, solveLinearSystem ) \n";
268 super_Type::insertJacobianDeltaCoefficients ( jacobian, column, ID, solveLinearSystem );
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...
MultiscaleCouplingMeanNormalStress super_Type
MultiscaleCouplingMeanNormalStress()
Constructor.
UInt M_couplingVariablesOffset
void updateCoupling()
Update the coupling.
MultiscaleCoupling multiscaleCoupling_Type
int32_type Int
Generic integer data.
MultiscaleCoupling()
Constructor.
void updateInverseJacobian(const UInt &iQuadPt)
MultiscaleCouplingMeanNormalStressValve()
Constructor.
MatrixEpetra< Real > multiscaleMatrix_Type
double Real
Generic real data.
void setupCoupling()
Setup the coupling.
void computeCouplingResiduals()
Compute the local coupling residuals vector.
void initializeCouplingVariables()
Initialize the values of the coupling variables.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
MultiscaleCouplingMeanNormalStressValve - Mean normal stress coupling condition with simple valve...
void insertJacobianConstantCoefficients(multiscaleMatrix_Type &jacobian)
Insert constant coefficients into the Jacobian matrix.