Skip to content

Commit 947e807

Browse files
committed
update summation in FVM solver
1 parent fe10797 commit 947e807

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ class CFVMFlowSolverBase : public CSolver {
211211
* coloring does not allow "enough" parallelism. ---*/
212212

213213
CSysVector<su2double> EdgeFluxes; /*!< \brief Flux across each edge. */
214+
CSysVector<su2double> EdgeFluxes_ij; /*!< \brief Flux across each edge ij (non-conservative). */
215+
CSysVector<su2double> EdgeFluxes_ji; /*!< \brief Flux across each edge ji (non-conservative). */
214216

215217
CNumericsSIMD* edgeNumerics = nullptr; /*!< \brief Object for edge flux computation. */
216218

@@ -292,7 +294,20 @@ class CFVMFlowSolverBase : public CSolver {
292294
if (!ReducerStrategy) AD::EndNoSharedReading();
293295

294296
if (ReducerStrategy) {
295-
SumEdgeFluxes(geometry);
297+
if (config->GetKind_Solver() == MAIN_SOLVER::RANS) {
298+
for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) {
299+
300+
LinSysRes.SetBlock_Zero(iPoint);
301+
302+
for (auto iEdge : geometry->nodes->GetEdges(iPoint)) {
303+
if (iPoint == geometry->edges->GetNode(iEdge,0))
304+
LinSysRes.AddBlock(iPoint, EdgeFluxes_ij.GetBlock(iEdge));
305+
else
306+
LinSysRes.SubtractBlock(iPoint, EdgeFluxes_ji.GetBlock(iEdge));
307+
}
308+
}
309+
}
310+
else SumEdgeFluxes(geometry);
296311
if (config->GetKind_TimeIntScheme() == EULER_IMPLICIT) {
297312
Jacobian.SetDiagonalAsColumnSum();
298313
}

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,11 @@ void CFVMFlowSolverBase<V, R>::HybridParallelInitialization(const CConfig& confi
359359
}
360360
}
361361

362-
if (ReducerStrategy) EdgeFluxes.Initialize(geometry.GetnEdge(), geometry.GetnEdge(), nVar, nullptr);
362+
if (ReducerStrategy) {
363+
EdgeFluxes.Initialize(geometry.GetnEdge(), geometry.GetnEdge(), nVar, nullptr);
364+
EdgeFluxes_ij.Initialize(geometry.GetnEdge(), geometry.GetnEdge(), nVar, nullptr); //initializing only when solver=rans, has no effect
365+
EdgeFluxes_ji.Initialize(geometry.GetnEdge(), geometry.GetnEdge(), nVar, nullptr);
366+
}
363367

364368
omp_chunk_size = computeStaticChunkSize(nPoint, omp_get_max_threads(), OMP_MAX_SIZE);
365369
#else

0 commit comments

Comments
 (0)