109 {
110 TRACE();
112
113 monopole.cellIds.clear();
114 monopole.srcTerms.clear();
115
116 if(monopole.radius < 0.0) {
117 const MInt monopoleCellId =
m_solver->getIdAtPoint(monopole.position.data());
118 if(monopoleCellId != -1) {
119 monopole.isActive = true;
120 monopole.cellIds.push_back(monopoleCellId);
121 }
122 } else {
123 const MFloat radiusSq =
POW2(monopole.radius);
124 for(
MInt i = 0; i <
m_solver->m_currentMaxNoCells; i++) {
128 radiusSq_ +=
POW2(monopole.position[d] -
m_solver->a_coordinate(cellId, d));
129 }
130 if(radiusSq_ < radiusSq) {
131 monopole.isActive = true;
132 monopole.cellIds.push_back(cellId);
133 }
134 }
135 }
136 const MInt noSrcTermCells = monopole.cellIds.size();
137 monopole.srcTerms.resize(noSrcTermCells, 0.0);
138
139 MInt noSrcTermCellsGlobal = noSrcTermCells;
140 MPI_Allreduce(MPI_IN_PLACE, &noSrcTermCellsGlobal, 1, MPI_INT, MPI_SUM,
m_solver->mpiComm(), AT_,
"MPI_IN_PLACE",
141 "noSrcTermCellsGlobal");
142 const MFloat ppw = 2 * PI * LBCS / monopole.omega;
144 std::stringstream ss;
145 ss << "INFO: LbSrcTerm_monopole " << monopole.id << ":" << std::endl;
146 ss << " amplitude :" << monopole.amplitude << std::endl;
147 ss << " rhoFluct :" << monopole.rhoFluct << std::endl;
148 ss << " radius :" << monopole.radius << std::endl;
149 ss << " strouhal :" << monopole.strouhal << std::endl;
150 ss << " omega :" << monopole.omega << std::endl;
151 ss << " phaseShift :" << monopole.phaseShift << std::endl;
152 ss << " windowing :" << monopole.windowing << std::endl;
153 ss << " noSrcTermCells :" << noSrcTermCellsGlobal << std::endl;
154 ss << " points per wave :" << ppw << std::endl;
155 ss << " timesteps per periode :" << periode << std::endl;
157 std::cout << ss.str();
158 }
160 }
161}
static constexpr MInt nDim
constexpr Real POW2(const Real x)
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce