116void FETISolver :: setUpCommunicationMaps()
118 int nnodes =
domain->giveNumberOfDofManagers();
119 int boundaryDofManNum = 0;
126 for (
int i = 1; i <= nnodes; i++ ) {
132 if (
domain->giveEngngModel()->giveRank() != 0 ) {
136#ifdef __VERBOSE_PARALLEL
137 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Sending data to partition 0 (send %d)\n",
139 "FETISolver :: setUpCommunicationMaps : send number of boundary dofMans", boundaryDofManNum);
141 commBuff.iSend(0, FETICommunicator :: NumberOfBoundaryDofManagersMsg);
143 MPI_Barrier(MPI_COMM_WORLD);
146#ifdef __VERBOSE_PARALLEL
148 this->
giveEngngModel()->giveRank(),
"FETISolver :: setUpCommunicationMaps");
154 commMap.
resize(boundaryDofManNum);
162 if (
domain->giveEngngModel()->giveRank() != 0 ) {
163 for (
int i = 1; i <= nnodes; i++ ) {
166 commMap.
at(indx++) = i;
168 domain->giveDofManager(i)->giveCompleteLocationArray(locNum, dn);
170 for (
int j = 1; j <= locNum.
giveSize(); j++ ) {
171 if ( locNum.
at(j) ) {
181 for (
int i = 1; i <= nnodes; i++ ) {
184 commMap.
at(indx++) = i;
189 if (
domain->giveEngngModel()->giveRank() != 0 ) {
192 commBuff.iSend(0, FETICommunicator :: BoundaryDofManagersRecMsg);
193#ifdef __VERBOSE_PARALLEL
195 this->
giveEngngModel()->giveRank(),
"FETISolver :: setUpCommunicationMaps");
197 MPI_Barrier(MPI_COMM_WORLD);
198#ifdef __VERBOSE_PARALLEL
200 this->
giveEngngModel()->giveRank(),
"FETISolver :: setUpCommunicationMaps");
202 MPI_Barrier(MPI_COMM_WORLD);
284 int receivedRank = processComm.
giveRank();
285 if ( receivedRank != 0 ) {
287 for (
int to : toRecvMap ) {
290 for (
int idof = 1; idof <=
masterCommunicator->giveDofManager(to)->giveNumberOfDofs(); idof++ ) {
291 for (
int irbm = 1; irbm <=
nsem.at(receivedRank + 1); irbm++ ) {
294 result &= recv_buff.
read(value);
295 if (
masterCommunicator->giveDofManager(to)->giveReferencePratition() == receivedRank ) {
300 for (
int j = 1; j <= nshared; j++ ) {
302 if ( part == processComm.
giveRank() ) {
307 l.at(eqNum,
rbmAddr.at(receivedRank + 1) + irbm - 1) = value;
310 int eqNum =
masterCommunicator->giveDofManager(to)->giveCodeNumber(receivedRank, idof);
311 l.at(eqNum,
rbmAddr.at(receivedRank + 1) + irbm - 1) = ( -1.0 ) * value;
322FETISolver :: masterMapRBM()
324 int receivedRank = 0, result;
331 for (
int irbm = 1; irbm <=
nsem.at(1); irbm++ ) {
332 for (
int i = 1; i <= size; i++ ) {
338 domain->giveDofManager(from)->giveCompleteLocationArray(locationArray, dn);
347 for (
int idof = 1; idof <=
masterCommunicator->giveDofManager(to)->giveNumberOfDofs(); idof++, locpos++ ) {
349 while ( locationArray.
at(locpos) == 0 ) {
352 if ( locpos > locationArray.
giveSize() ) {
357 double value =
rbm.at(locationArray.
at(locpos), irbm);
358 if (
masterCommunicator->giveDofManager(to)->giveReferencePratition() == receivedRank ) {
363 for (
int j = 1; j <= nshared; j++ ) {
370 l.at(eqNum,
rbmAddr.at(receivedRank + 1) + irbm - 1) = value;
373 int eqNum =
masterCommunicator->giveDofManager(to)->giveCodeNumber(receivedRank, idof);
374 l.at(eqNum,
rbmAddr.at(receivedRank + 1) + irbm - 1) = ( -1.0 ) * value;
511FETISolver :: masterMapSolution()
513 int receivedRank = 0, result;
518 for (
int i = 1; i <= size; i++ ) {
524 domain->giveDofManager(to)->giveCompleteLocationArray(locationArray, dn);
528 for (
int idof = 1; idof <=
masterCommunicator->giveDofManager(from)->giveNumberOfDofs(); idof++, locpos++ ) {
530 while ( locationArray.
at(locpos) == 0 ) {
533 if ( locpos > locationArray.
giveSize() ) {
539 if (
masterCommunicator->giveDofManager(from)->giveReferencePratition() == receivedRank ) {
543 int nshared =
masterCommunicator->giveDofManager(from)->giveNumberOfSharedPartitions();
544 for (
int j = 1; j <= nshared; j++ ) {
551 value +=
w.at(eqNum);
554 int eqNum =
masterCommunicator->giveDofManager(from)->giveCodeNumber(receivedRank, idof);
555 value = ( -1.0 ) *
w.at(eqNum);
559 dd.at( locationArray.
at(locpos) ) = value;
641FETISolver :: masterMapResiduals()
643 int receivedRank = 0, result;
648 for (
int i = 1; i <= size; i++ ) {
654 domain->giveDofManager(from)->giveCompleteLocationArray(locationArray, dn);
663 for (
int idof = 1; idof <=
masterCommunicator->giveDofManager(to)->giveNumberOfDofs(); idof++, locpos++ ) {
665 while ( locationArray.
at(locpos) == 0 ) {
668 if ( locpos > locationArray.
giveSize() ) {
673 double value =
pp.at( locationArray.
at(locpos) );
674 if (
masterCommunicator->giveDofManager(to)->giveReferencePratition() == receivedRank ) {
679 for (
int j = 1; j <= nshared; j++ ) {
686 g.at(eqNum) += value;
689 int eqNum =
masterCommunicator->giveDofManager(to)->giveCodeNumber(receivedRank, idof);
690 g.at(eqNum) += ( -1.0 ) * value;
774FETISolver :: masterMapDirectionVector()
776 int receivedRank = 0, result;
781 for (
int i = 1; i <= size; i++ ) {
787 domain->giveDofManager(to)->giveCompleteLocationArray(locationArray, dn);
791 for (
int idof = 1; idof <=
masterCommunicator->giveDofManager(from)->giveNumberOfDofs(); idof++, locpos++ ) {
793 while ( locationArray.
at(locpos) == 0 ) {
796 if ( locpos > locationArray.
giveSize() ) {
802 if (
masterCommunicator->giveDofManager(from)->giveReferencePratition() == receivedRank ) {
806 int nshared =
masterCommunicator->giveDofManager(from)->giveNumberOfSharedPartitions();
807 for (
int j = 1; j <= nshared; j++ ) {
814 value +=
d.at(eqNum);
817 int eqNum =
masterCommunicator->giveDofManager(from)->giveCodeNumber(receivedRank, idof);
818 value = ( -1.0 ) *
d.at(eqNum);
822 dd.at( locationArray.
at(locpos) ) = value;
903FETISolver :: masterMapPPVector()
905 int receivedRank = 0, result;
910 for (
int i = 1; i <= size; i++ ) {
916 domain->giveDofManager(from)->giveCompleteLocationArray(locationArray, dn);
925 for (
int idof = 1; idof <=
masterCommunicator->giveDofManager(to)->giveNumberOfDofs(); idof++, locpos++ ) {
927 while ( locationArray.
at(locpos) == 0 ) {
930 if ( locpos > locationArray.
giveSize() ) {
935 double value =
pp.at( locationArray.
at(locpos) );
936 if (
masterCommunicator->giveDofManager(to)->giveReferencePratition() == receivedRank ) {
941 for (
int j = 1; j <= nshared; j++ ) {
948 p.at(eqNum) += value;
951 int eqNum =
masterCommunicator->giveDofManager(to)->giveCodeNumber(receivedRank, idof);
952 p.at(eqNum) += ( -1.0 ) * value;
1012 int tnse = 0, rank =
domain->giveEngngModel()->giveRank();
1014 int masterLoopStatus;
1015 double nom = 0.0, denom, alpha, beta, energyNorm = 0.0;
1019 if ( !partitionStiffness ) {
1029 int size =
domain->giveEngngModel()->giveNumberOfProcesses();
1040 MPI_Barrier(MPI_COMM_WORLD);
1042#ifdef __VERBOSE_PARALLEL
1044 this->
giveEngngModel()->giveRank(),
"FETISolver :: solveYourselfAt");
1057#ifdef __VERBOSE_PARALLEL
1058 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: rbmodes computation startup, lneq is %d\n",
1059 rank,
"FETISolver :: solveYourselfAt", neq);
1064#ifdef __VERBOSE_PARALLEL
1065 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Number of Rigid body modes %3d\n",
1066 rank,
"FETISolver :: solveYourselfAt",
nse);
1082 qq.beTProductOf(
rbm, partitionLoad);
1096 for (
int i = 1; i < size; i++ ) {
1097 commBuff.iRecv(MPI_ANY_SOURCE, FETISolver :: NumberOfRBMMsg);
1098 while ( !
commBuff.testCompletion(source, tag) ) {
1103#ifdef __VERBOSE_PARALLEL
1104 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Received data from partition %3d\n",
1105 rank,
"FETICommunicator :: setUpCommunicationMaps : received number of partition rbm", source);
1109 tnse +=
nsem.at(source + 1);
1115 OOFEM_LOG_INFO(
"Number of RBM per partion\npart. rbm\n-------------------------------\n");
1116 for (
int i = 1; i <= size; i++ ) {
1125 for (
int i = 2; i <= size; i++ ) {
1129#ifdef __VERBOSE_PARALLEL
1130 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Sending number of Rigid body modes %3d\n",
1131 rank,
"FETISolver :: solveYourselfAt",
nse);
1136 commBuff.iSend(0, FETISolver :: NumberOfRBMMsg);
1139 MPI_Barrier(MPI_COMM_WORLD);
1163 MPI_Barrier(MPI_COMM_WORLD);
1164#ifdef __VERBOSE_PARALLEL
1165 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: RBMMessage Barrier finished",
1166 rank,
"FETISolver :: solveYourselfAt");
1184 MPI_Barrier(MPI_COMM_WORLD);
1193 if ( ( rank == 0 ) && ( tnse != 0 ) ) {
1229 w.beProductOf(
l, help);
1248 MPI_Barrier(MPI_COMM_WORLD);
1250#ifdef __VERBOSE_PARALLEL
1251 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Solution Approx Barrier finished\n",
1252 rank,
"FETISolver :: solveYourselfAt");
1255 dd.subtract(partitionLoad);
1266#ifdef __VERBOSE_PARALLEL
1267 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Residual contribution packing initiated\n",
1268 rank,
"FETISolver :: solveYourselfAt");
1271#ifdef __VERBOSE_PARALLEL
1272 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Residual contribution send initiated\n",
1273 rank,
"FETISolver :: solveYourselfAt");
1277 MPI_Barrier(MPI_COMM_WORLD);
1278#ifdef __VERBOSE_PARALLEL
1279 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Residual contribution Barrier finished\n",
1280 rank,
"FETISolver :: solveYourselfAt");
1299 nom =
g.computeSquaredNorm();
1304 OOFEM_LOG_DEBUG(
"iteration gradient vector norm energy norm\n=====================================================================\n");
1306 OOFEM_LOG_DEBUG(
"iteration gradient vector norm\n================================================\n");
1313 for (
int i = 0; i <
ni; i++ ) {
1334 MPI_Barrier(MPI_COMM_WORLD);
1352 MPI_Barrier(MPI_COMM_WORLD);
1357 denom =
d.dotProduct(
p);
1360 OOFEM_LOG_RELEVANT(
"FETISolver::solve : v modifikovane metode sdruzenych gradientu je nulovy jmenovatel u soucinitele alpha\n");
1371 alpha = nom / denom;
1377 w.at(j) += alpha *
d.at(j);
1378 g.at(j) += alpha *
p.at(j);
1389 OOFEM_LOG_RELEVANT(
"FETISolver::solve : v modifikovane metode sdruzenych gradientu je nulovy jmenovatel u soucinitele beta\n");
1397 nom =
g.computeSquaredNorm();
1417 d.at(j) = beta *
d.at(j) -
g.at(j);
1433#ifdef __VERBOSE_PARALLEL
1434 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Received Loop break signal from master\n",
1435 rank,
"FETISolver :: solveYourselfAt");
1461 MPI_Barrier(MPI_COMM_WORLD);
1478 MPI_Barrier(MPI_COMM_WORLD);
1482 energyNorm =
p.dotProduct(
w);
1496#ifdef __VERBOSE_PARALLEL
1498 OOFEM_LOG_DEBUG(
"Konec metody sdruzenych gradientu, nite %d, err %e\n", i, nom);
1513#ifdef __VERBOSE_PARALLEL
1538 MPI_Barrier(MPI_COMM_WORLD);
1541#ifdef __VERBOSE_PARALLEL
1548#ifdef __VERBOSE_PARALLEL
1554 pp = partitionSolution;
1556#ifdef __VERBOSE_PARALLEL
1569#ifdef __VERBOSE_PARALLEL
1570 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Received residuals from slaves\n",
1571 rank,
"FETISolver :: solveYourselfAt");
1578#ifdef __VERBOSE_PARALLEL
1579 OOFEM_LOG_DEBUG(
"[process rank %3d]: %-30s: Sending residuals to master\n",
1580 rank,
"FETISolver :: solveYourselfAt");
1585 MPI_Barrier(MPI_COMM_WORLD);
1588#ifdef __VERBOSE_PARALLEL
1602 gamma.beProductOf(l1, help1);
1621 MPI_Barrier(MPI_COMM_WORLD);
1627 partitionSolution.
add(help);