135 {
136 TRACE();
139
141 std::array<MFloat, 2 * nDim> domainBoundaries{};
142 {
143 const MFloat halfCellWidth = F1B2 *
m_solver->grid().cellLengthAtCell(0);
145 domainBoundaries[2 * i + 0] =
m_solver->a_coordinate(0, i) - halfCellWidth;
146 domainBoundaries[2 * i + 1] =
m_solver->a_coordinate(0, i) + halfCellWidth;
147 }
148 }
149
151 if(!
m_solver->c_isLeafCell(cellId))
continue;
152 const MFloat halfCellWidth = F1B2 *
m_solver->grid().cellLengthAtCell(cellId);
154 domainBoundaries[2 * i + 0] =
155 std::min(domainBoundaries[2 * i + 0],
m_solver->a_coordinate(cellId, i) - halfCellWidth);
156 domainBoundaries[2 * i + 1] =
157 std::max(domainBoundaries[2 * i + 1],
m_solver->a_coordinate(cellId, i) + halfCellWidth);
158 }
159 }
160
161 std::array<MFloat, nDim> tmpMin{};
162 std::array<MFloat, nDim> tmpMax{};
164 tmpMin[i] = domainBoundaries[2 * i + 0];
165 tmpMax[i] = domainBoundaries[2 * i + 1];
166 }
168 AT_, "MPI_IN_PLACE", "tmpMin");
170 AT_, "MPI_IN_PLACE", "tmpMax");
172 domainBoundaries[2 * i + 0] = tmpMin[i];
173 domainBoundaries[2 * i + 1] = tmpMax[i];
174 }
175
176
177 std::array<MFloat, 2 * nDim> spongeCoord{};
181 }
182 std::array<MFloat, 2 * nDim> F1BspongeCoord{};
186 }
187
188
190 if(
m_solver->a_isHalo(cellId))
continue;
191
192 std::array<MFloat, nDim>
dist{};
194 const MUint distIdNegSide = 2 * i + 0;
195 const MUint distIdPosSide = 2 * i + 1;
196 const MFloat distNegSide =
197 (spongeCoord[distIdNegSide] -
m_solver->a_coordinate(cellId, i)) * F1BspongeCoord[distIdNegSide];
198 const MFloat distPosSide =
199 (
m_solver->a_coordinate(cellId, i) - spongeCoord[distIdPosSide]) * F1BspongeCoord[distIdPosSide];
200 dist[i] = std::max(distNegSide, distPosSide);
201 }
202
203
204 const MFloat relDist = *std::max_element(
dist.begin(),
dist.end());
205
206 if(relDist <= 0.0) continue;
207
210
211 constexpr MFloat epsSpongeFactor = 1e-15;
212 if(spongeFactor > epsSpongeFactor) {
215 cell.spongeFactor = spongeFactor;
216 }
217 }
218
220}
std::array< MFloat, 2 *nDim > m_spongeThicknessFactor
void updateMapCellId2PmlCellId()
Update m_mapCellIds2PmlCellId.
MFloat m_spongeLayerThickness
std::vector< SpongeCell > m_spongeCells
static constexpr MInt nDim
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
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)