41 const int mysleeptime = 300;
65 ReqV(MPI::REQUEST_NULL),
78 if (MPI::Is_initialized()) {
80 IndVelComm = MBDynComm.Dup();
84 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
85 pthread_mutex_init(&induced_velocity_mutex, NULL);
86 pthread_cond_init(&induced_velocity_cond, NULL);
87 pthread_mutex_init(&forces_mutex, NULL);
98 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
99 pthread_mutex_destroy(&induced_velocity_mutex);
100 pthread_cond_destroy(&induced_velocity_cond);
101 pthread_mutex_destroy(&forces_mutex);
121 unsigned int idx = 0;
124 if (s[0] ==
'\0' || s[1] ==
'\0' || s[2] !=
'\0' ) {
173 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
176 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
186 DEBUGCOUT(
"Entering InducedVelocity::AssJac()" << std::endl);
194 InducedVelocity::ExchangeLoads(
flag fWhat)
197 MPE_Log_event(33, 0,
"start Induced Velocity Loads Exchange ");
200 if (is_parallel && IndVelComm.Get_size() > 1) {
206 ppRes[i]->pRes->Force().PutTo(&pTmpVecS[6 + 6*i]);
207 ppRes[i]->pRes->Moment().PutTo(&pTmpVecS[9 + 6*i]);
209 IndVelComm.Allreduce(pTmpVecS, pTmpVecR, iForcesVecDim, MPI::DOUBLE, MPI::SUM);
211 for (
int i = 0; ppRes && ppRes[i]; i++) {
212 ppRes[i]->pRes->PutForces(
Vec3(&pTmpVecR[6 + 6*i]),
Vec3(&pTmpVecR[9 + 6*i]));
216 IndVelComm.Allreduce(
Res.
Force().
pGetVec(), pTmpVecR, 3, MPI::DOUBLE, MPI::SUM);
221 MPE_Log_event(34, 0,
"end Induced Velocity Loads Exchange ");
226 InducedVelocity::InitializeIndVelComm(MPI::Intracomm* iv)
233 InducedVelocity::ExchangeVelocity(
void)
235 #define ROTDATATYPELABEL 100
236 if (is_parallel && IndVelComm.Get_size() > 1) {
237 if (IndVelComm.Get_rank() == 0) {
238 for (
int i = 1; i < IndVelComm.Get_size(); i++) {
239 IndVelComm.Send(MPI::BOTTOM, 1, *pIndVelDataType,
240 i, ROTDATATYPELABEL);
243 ReqV = IndVelComm.Irecv((
void *)MPI::BOTTOM, 1,
244 *pIndVelDataType, 0, ROTDATATYPELABEL);
255 for (
int i = 0; ppRes && ppRes[i]; i++) {
256 if (ppRes[i]->is_in(pEl->
GetLabel())) {
257 ppRes[i]->pRes->AddForces(F, M, X);
266 const Elem *pEl,
unsigned uPnt,
279 for (
int i = 0; ppRes && ppRes[i]; i++) {
280 ppRes[i]->pRes->Reset();
284 #if defined(USE_MULTITHREAD) && defined(MBDYN_X_MT_ASSRES)
286 InducedVelocity::Wait(
void)
const
288 pthread_mutex_lock(&induced_velocity_mutex);
290 pthread_cond_wait(&induced_velocity_cond,
291 &induced_velocity_mutex);
293 pthread_mutex_unlock(&induced_velocity_mutex);
297 InducedVelocity::Done(
void)
const
299 pthread_mutex_lock(&induced_velocity_mutex);
302 pthread_cond_broadcast(&induced_velocity_cond);
303 pthread_mutex_unlock(&induced_velocity_mutex);
305 #endif // USE_MULTITHREAD && MBDYN_X_MT_ASSRES
void PutForces(const Vec3 &f, const Vec3 &c)
virtual void AfterConvergence(const VectorHandler &X, const VectorHandler &XP)
virtual Elem::Type GetElemType(void) const
virtual void ResetForce(void)
#define MBDYN_EXCEPT_ARGS
virtual ~InducedVelocity(void)
virtual doublereal dGetPrivData(unsigned int i) const
virtual const Vec3 & Force(void) const
#define SAFEDELETEARR(pnt)
virtual AerodynamicElem::Type GetAerodynamicElemType(void) const
virtual const Vec3 & Moment(void) const
virtual unsigned int iGetNumPrivData(void) const
virtual void AddSectionalForce(Elem::Type type, const Elem *pEl, unsigned uPnt, const Vec3 &F, const Vec3 &M, doublereal dW, const Vec3 &X, const Mat3x3 &R, const Vec3 &V, const Vec3 &W)
virtual ~InducedVelocityElem(void)
virtual bool bSectionalForces(void) const
virtual void AddForce(const Elem *pEl, const StructNode *pNode, const Vec3 &F, const Vec3 &M, const Vec3 &X)
InducedVelocityElem(unsigned int uL, const DofOwner *pDO, const StructNode *pCraft, ResForceSet **ppres, flag fOut)
InducedVelocity(unsigned int uL, const StructNode *pCraft, ResForceSet **ppres, flag fOut)
void PutTo(doublereal *pd) const
#define ASSERT(expression)
virtual const Vec3 & GetXCurr(void) const
const doublereal * pGetVec(void) const
void PutForce(const Vec3 &f)
#define SAFENEWARR(pnt, item, sz)
virtual unsigned int iGetPrivDataIdx(const char *s) const
unsigned int GetLabel(void) const
virtual VariableSubMatrixHandler & AssJac(VariableSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr)
const StructNode * pCraft