Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction of symmetry plane implementation #2194

Merged
merged 221 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from 188 commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
21644d9
initial test
bigfooted Jan 2, 2024
a07dd6a
symmetry -do not reflect normal components
bigfooted Jan 2, 2024
0fa9438
remove unused GG code
bigfooted Jan 2, 2024
4322907
GG wall
bigfooted Jan 3, 2024
0ee6dbd
viscous sym_plane
bigfooted Jan 3, 2024
5de7c24
edge normal correction
bigfooted Jan 3, 2024
9ba8f8e
copy normal correction from nemo
bigfooted Jan 3, 2024
8bb7c2e
Merge branch 'develop' into feature_symmetry
bigfooted Jan 3, 2024
fd2fbb7
remove unused variables
bigfooted Jan 3, 2024
576919d
GG test
bigfooted Jan 4, 2024
7166b66
GG correct velocity mirroring
bigfooted Jan 4, 2024
101c10f
temp saving
bigfooted Jan 6, 2024
06f94ac
add symmetry correction for inlet, outlet, and wall
bigfooted Jan 7, 2024
2840592
code alignment
bigfooted Jan 7, 2024
7387f8c
corrected GG gradient computation on shared nodes
bigfooted Jan 8, 2024
aa4dd00
GG shared nodes mirror
bigfooted Jan 9, 2024
a3e7221
GG corner gradients
bigfooted Jan 10, 2024
48f6d3d
fixes to face normal correction on symmetry
bigfooted Jan 10, 2024
5513218
clean up
bigfooted Jan 10, 2024
77e3efd
clean up
bigfooted Jan 10, 2024
8e346b0
fig GG share nodes for 3D
bigfooted Jan 14, 2024
e9cb623
fig GG share nodes interpolation
bigfooted Jan 15, 2024
dbdbe1d
fig GG share nodes interpolation for outlet
bigfooted Jan 15, 2024
95fb743
activate edge array
bigfooted Jan 17, 2024
e8434e3
edge fluxes test
bigfooted Jan 31, 2024
44637ab
residual correction symmetry plane
bigfooted Jan 31, 2024
1071418
remove unused variable
bigfooted Jan 31, 2024
41b45d8
finalize symmetry plane correction
bigfooted Feb 2, 2024
d81fc0e
deletevalsrowi only for radial velocity
bigfooted Feb 4, 2024
4997a98
symmetry should be called before strong boundaries
bigfooted Feb 4, 2024
9a9b02b
activate edge correction
bigfooted Feb 4, 2024
95a5122
new jacobian
bigfooted Feb 6, 2024
d515946
Merge branch 'develop' into feature_symmetry
bigfooted Feb 8, 2024
b0d7a60
fix diagonal dominance of the Jacobian
pcarruscag Feb 10, 2024
f7ecaeb
clean up
bigfooted Feb 12, 2024
8316f2c
replace GG gradients with Tobi-Edwin method
bigfooted Feb 17, 2024
0c21b48
small cleanup
bigfooted Feb 17, 2024
5e3b208
symmetry instead of full reflection in GG
bigfooted Feb 17, 2024
a920524
Merge branch 'develop' into feature_symmetry
bigfooted Feb 27, 2024
39335cb
test shared symmetry
bigfooted Mar 4, 2024
eb7f217
test GG gradients for shared symmetry
bigfooted Mar 4, 2024
ed7a4a5
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted Mar 4, 2024
6e01c2c
Merge branch 'develop' into feature_symmetry
bigfooted Mar 5, 2024
7601112
Merge branch 'develop' into feature_symmetry
bigfooted Mar 25, 2024
382e896
test GG gradients with tensor implementation, not working
bigfooted Mar 26, 2024
541d7c0
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted Mar 26, 2024
b0f7a21
fix gradient conditions for symmetry plane in green-gauss
bigfooted Mar 29, 2024
85ceb0c
remove cout statements
bigfooted Mar 29, 2024
946e7e8
add comment
bigfooted Mar 29, 2024
80a7b5f
cleanup
bigfooted Mar 29, 2024
2a7f5da
move symplane bc to end of bc
bigfooted Mar 30, 2024
2407b19
fix order of BC
bigfooted Mar 31, 2024
05520c3
include EULER_WALL in consideration of symmetry planes
bigfooted Apr 1, 2024
cf36935
no modified timestep at EULER_WALL
bigfooted Apr 1, 2024
2090c7f
fix getsolution to getsolution_old
bigfooted Apr 1, 2024
e2108e7
fix getsolution to getsolution_old
bigfooted Apr 1, 2024
5b90bd0
Merge branch 'develop' into feature_symmetry
bigfooted Apr 3, 2024
4c260aa
move computation of base to geometry_toolbox
bigfooted Apr 3, 2024
26cd83e
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted Apr 3, 2024
228823d
make green-gauss gradient computations for symmetry planes more compact
bigfooted Apr 4, 2024
1013191
make green-gauss gradient computations for symmetry planes more compact
bigfooted Apr 4, 2024
960dc1f
modify restruncerror
bigfooted Apr 9, 2024
8d45f6c
modify normals in multigrid
bigfooted Apr 9, 2024
3666bcf
modify normals in multigrid - commented
bigfooted Apr 9, 2024
5bdd5fb
Merge branch 'develop' into feature_symmetry
bigfooted Apr 15, 2024
805ba34
small fix
bigfooted Apr 17, 2024
64fd52a
uncomment again
bigfooted Apr 20, 2024
48e77c5
fix GG, fix multigrid
bigfooted Apr 21, 2024
9ab4c69
Merge branch 'develop' into feature_symmetry
bigfooted Apr 21, 2024
aec5c94
Merge branch 'develop' into feature_symmetry
bigfooted Apr 21, 2024
a3c03bb
formatting...
bigfooted Apr 21, 2024
c24fd6e
boilerplate - create only one copy of normal edge correction
bigfooted Apr 21, 2024
1bcf772
rerun conv_numerics->ComputeResiduals, also modify multigrid, and do …
bigfooted Apr 22, 2024
c517767
minus sign
bigfooted Apr 23, 2024
3ef46eb
small fix
bigfooted Apr 24, 2024
61e8ce4
check nodes shared by markers
bigfooted Apr 24, 2024
625d273
fix error for compressible
bigfooted Apr 24, 2024
833100c
fix error for compressible
bigfooted Apr 24, 2024
ef214f1
fix error for compressible
bigfooted Apr 24, 2024
0bdbd22
formatting
bigfooted Apr 24, 2024
c294bfc
switch to solution_old
bigfooted Apr 25, 2024
2bc215f
cleanup
bigfooted Apr 26, 2024
752adfd
precommit alignment
bigfooted Apr 26, 2024
bb1df12
cleanup
bigfooted Apr 26, 2024
9bccbdd
cleanup
bigfooted Apr 26, 2024
8324dc7
cleanup
bigfooted Apr 26, 2024
2db7de2
fix mg for 2d meshes with mpi
bigfooted Apr 26, 2024
bde93f3
remove dependency of config in functions
bigfooted Apr 28, 2024
d3be71c
move gradient update for symmetry to toolbox template
bigfooted Apr 28, 2024
2f59364
move around stuff
bigfooted Apr 28, 2024
ce4d0f3
move gradient correction to geometry_toolbox
bigfooted Apr 28, 2024
91b8816
Merge branch 'develop' into feature_symmetry
bigfooted Apr 28, 2024
5c05ad2
remove commented code
bigfooted Apr 28, 2024
8666f0c
Euler walls can never be agglomerated
bigfooted Apr 28, 2024
707e80d
point to fix_symmetry workflow
bigfooted May 3, 2024
99e60e2
fix regressions for vandv
bigfooted May 4, 2024
f7ea1c4
fix partial regressions for tutorials
bigfooted May 4, 2024
7d3b289
fix partial regressions
bigfooted May 4, 2024
13a79b5
fix tutorial regression
bigfooted May 4, 2024
6163c81
add symmetry routine to WLS
bigfooted May 5, 2024
e5174ae
add grid movement back into symplane
bigfooted May 6, 2024
ff79f70
fix braces
bigfooted May 6, 2024
15761ea
cleanup geometry_toolbox
bigfooted May 7, 2024
a2f5c42
fix tutorials
bigfooted May 7, 2024
d5bc57a
fix regressions
bigfooted May 7, 2024
ca624c1
fix regressions
bigfooted May 8, 2024
98dfead
fix regressions
bigfooted May 8, 2024
264978d
Merge branch 'develop' into feature_symmetry
bigfooted May 8, 2024
59985b8
fix regressions parallel
bigfooted May 8, 2024
b2176ae
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted May 8, 2024
d9b9dec
fix another bunch of tests
bigfooted May 10, 2024
ba32916
make enum class of mpi_quantities
bigfooted May 11, 2024
848cacb
remove unused variables
bigfooted May 11, 2024
a429470
add idx_vel as argument to gradient functions
bigfooted May 11, 2024
33ea2dc
fix some regressions parallel
bigfooted May 12, 2024
327725d
fix some regressions parallel
bigfooted May 12, 2024
a1e4810
fix some regressions parallel
bigfooted May 12, 2024
dda969a
fix some regressions parallel
bigfooted May 12, 2024
645c824
regressions
bigfooted May 14, 2024
7e06217
merge develop
bigfooted May 14, 2024
3841862
merge develop
bigfooted May 14, 2024
a04bfbb
Merge branch 'develop' into feature_symmetry
bigfooted May 17, 2024
d61ba49
update regression
bigfooted May 17, 2024
1330821
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted May 17, 2024
233ef03
Merge branch 'develop' into feature_symmetry
bigfooted May 20, 2024
9d32bc6
update regression
bigfooted May 25, 2024
16b583b
update regression
bigfooted May 25, 2024
a554ef4
update regression
bigfooted May 25, 2024
de90bc8
update regression
bigfooted May 26, 2024
93307d3
update regression
bigfooted May 26, 2024
8a3a125
update regression
bigfooted May 26, 2024
cc7a53d
update regression
bigfooted May 26, 2024
5dcf80a
update regression
bigfooted May 26, 2024
19de368
update regression
bigfooted May 26, 2024
c2579d4
update grid velocity
bigfooted May 31, 2024
fec6872
update grid velocity
bigfooted May 31, 2024
102f9eb
update grid velocity
bigfooted May 31, 2024
67d0172
update grid velocity
bigfooted Jun 1, 2024
b71ccca
update grid velocity
bigfooted Jun 1, 2024
b927dd8
update vandv
bigfooted Jun 10, 2024
609fd2c
update tutorials
bigfooted Jun 10, 2024
7fe3866
update hybrid_regression_AD
bigfooted Jun 10, 2024
b5edc4f
Merge branch 'develop' into feature_symmetry
bigfooted Jun 10, 2024
fc8f677
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted Jun 10, 2024
080c87b
use proper index for temperature
bigfooted Jun 10, 2024
4453aea
use proper index for temperature
bigfooted Jun 10, 2024
dea340e
fix convergence of edge_PPR
bigfooted Jun 11, 2024
51c804b
not just energy
bigfooted Jun 12, 2024
1b0924f
small update
bigfooted Jun 16, 2024
fa25b76
small update
bigfooted Jun 17, 2024
d7818a1
small update
bigfooted Jun 17, 2024
50e97c8
small update
bigfooted Jun 17, 2024
4b605ca
small update
bigfooted Jun 17, 2024
737e653
small update
bigfooted Jun 17, 2024
fd61fca
small update
bigfooted Jun 17, 2024
3e060e8
small update
bigfooted Jun 17, 2024
cf0d1e9
small update
bigfooted Jun 18, 2024
ccdae54
small update
bigfooted Jun 19, 2024
e53dd26
small update
bigfooted Jun 19, 2024
dba4dba
small update
bigfooted Jun 21, 2024
3d136bc
disable OMP line for git regression testing
bigfooted Jun 21, 2024
f7f455c
enable OMP line for git regression testing
bigfooted Jun 21, 2024
48e5de1
small update
bigfooted Jun 22, 2024
4eb41cd
Update SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
bigfooted Jun 22, 2024
e568e04
Update SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
bigfooted Jun 22, 2024
5796476
Update SU2_CFD/include/gradients/computeGradientsLeastSquares.hpp
bigfooted Jun 22, 2024
d5405dd
Update SU2_CFD/include/gradients/computeGradientsSymmetry.hpp
bigfooted Jun 22, 2024
b038b3a
change idx_vel to idxVel
bigfooted Jun 22, 2024
7b9d53b
change idxVel to short
bigfooted Jun 22, 2024
7cb3cae
change streamwise regression residual
bigfooted Jun 23, 2024
531d237
pywrapper cases
bigfooted Jun 23, 2024
eadcfcc
fix edge_VW
bigfooted Jun 24, 2024
f91aeb3
fix edge_VW
bigfooted Jun 24, 2024
2d26e6b
fix edge_VW
bigfooted Jun 25, 2024
9955a4a
move normal correction for shared symmetry-nodes
bigfooted Jun 26, 2024
a3c268b
move normal correction for shared symmetry-nodes
bigfooted Jun 27, 2024
ea12523
move normal correction for shared symmetry-nodes
bigfooted Jun 27, 2024
9c4bc6d
Merge branch 'develop' into feature_symmetry
bigfooted Jul 1, 2024
d232ab8
move normal correction for shared symmetry-nodes
bigfooted Jul 1, 2024
0854bb2
clang-format
bigfooted Jul 1, 2024
81ef867
remove unused variables
bigfooted Jul 2, 2024
70154d5
do not use find when vector size zero, remove comment blocks
bigfooted Jul 3, 2024
1615bdd
clang-format
bigfooted Jul 4, 2024
e008c3a
clang-format
bigfooted Jul 4, 2024
980c2e5
correct normals for multigrid
bigfooted Jul 7, 2024
8e06ba3
add some omp statements
bigfooted Jul 7, 2024
67b3d0a
clang-format
bigfooted Jul 7, 2024
37feae6
change resize
bigfooted Jul 7, 2024
a7ecc76
change resize
bigfooted Jul 8, 2024
0045c9c
change idim
bigfooted Jul 8, 2024
47ce8e6
fix regressions again
bigfooted Jul 8, 2024
a9a088b
Merge branch 'develop' into feature_symmetry
bigfooted Jul 11, 2024
5aa4ae8
simplify gradphi
bigfooted Jul 11, 2024
b6d2bdd
simplify gradvel
bigfooted Jul 20, 2024
1120fc5
fix segfault
bigfooted Jul 21, 2024
56e865c
Merge branch 'develop' into feature_symmetry
bigfooted Jul 22, 2024
2cf8ee0
cleanup simplification
bigfooted Jul 22, 2024
d63e182
fix final regression
bigfooted Jul 22, 2024
80cd746
omp for multigrid
bigfooted Jul 23, 2024
f0d8f6a
clang-format
bigfooted Jul 23, 2024
7b4174a
clang-format
bigfooted Jul 23, 2024
2040805
fix omp line
bigfooted Jul 23, 2024
fc98ba9
update laminar sphere regression
bigfooted Jul 24, 2024
f25221b
update laminar sphere regression
bigfooted Jul 25, 2024
500b96f
avoid heap allocations
pcarruscag Jul 27, 2024
1ad2568
Update SU2_CFD/include/gradients/computeGradientsGreenGauss.hpp
pcarruscag Jul 28, 2024
6707c7f
fix order of arguments and use template nDim
pcarruscag Jul 28, 2024
505ed23
Apply suggestions from code review
pcarruscag Jul 28, 2024
6a8b03a
simplify symmetry normals
pcarruscag Jul 29, 2024
76dcbb1
Merge branch 'feature_symmetry' of https://github.com/su2code/SU2 int…
pcarruscag Jul 29, 2024
e8ba7c0
fix index
pcarruscag Jul 29, 2024
368444d
checking if surfaces are planes is no longer required
pcarruscag Jul 29, 2024
71fc627
update bunch of regressions
bigfooted Jul 29, 2024
38dd1ee
fix regression
bigfooted Jul 29, 2024
df34b2f
change to getDensity
bigfooted Jul 30, 2024
f552f2f
fix regression
bigfooted Jul 31, 2024
8215322
fix regression
bigfooted Jul 31, 2024
7321fd4
update streamwise file
bigfooted Aug 1, 2024
ddcf40b
fix regression tolerance
bigfooted Aug 2, 2024
09201c6
Merge branch 'feature_symmetry' of https://github.com/su2code/su2 int…
bigfooted Aug 2, 2024
f48d2ff
change workflow to develop
bigfooted Aug 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ jobs:
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
args: -b ${{github.ref}} -t fix_symmetry -c fix_symmetry -s ${{matrix.testscript}}
- name: Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2:240320-1536
with:
Expand Down
15 changes: 14 additions & 1 deletion Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ extern "C" {

using namespace std;

struct symNormal {
long unsigned int index;
su2double normal[3];
symNormal(long unsigned int index) : index(index){};
};

struct findSymNormalIndex : std::unary_function<symNormal, bool> {
unsigned long int index;
findSymNormalIndex(unsigned long int index) : index(index) {}
bool operator()(symNormal const& m) const { return m.index == index; }
};

/*!
* \class CGeometry
* \brief Parent class for defining the geometry of the problem (complete geometry,
Expand Down Expand Up @@ -229,6 +241,7 @@ class CGeometry {

public:
/*--- Main geometric elements of the grid. ---*/
vector<vector<symNormal>> symmetryNormals; /*!< \brief Corrected normals on nodes with shared symmetry markers */

CPrimalGrid** elem{nullptr}; /*!< \brief Element vector (primal grid information). */
CPrimalGrid*** bound{nullptr}; /*!< \brief Boundary vector (primal grid information). */
Expand Down Expand Up @@ -1012,7 +1025,7 @@ class CGeometry {
* \param[in] config - Definition of the particular problem.
* \param[in] print_on_screen - Boolean whether to print result on screen.
*/
void ComputeSurf_Straightness(CConfig* config, bool print_on_screen);
void ComputeSurf_Straightness(const CConfig* config, bool print_on_screen);

/*!
* \brief Find and store all vertices on a sharp corner in the geometry.
Expand Down
9 changes: 6 additions & 3 deletions Common/include/geometry/CPhysicalGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,13 @@ class CPhysicalGeometry final : public CGeometry {
* \brief Routine to launch non-blocking sends and recvs amongst all processors.
* \param[in] bufSend - Buffer of data to be sent.
* \param[in] nElemSend - Array containing the number of elements to send to other processors in cumulative storage
* format. \param[in] sendReq - Array of MPI send requests. \param[in] bufRecv - Buffer of data to be received.
* format.
* \param[in] sendReq - Array of MPI send requests.
* \param[in] bufRecv - Buffer of data to be received.
* \param[in] nElemSend - Array containing the number of elements to receive from other processors in cumulative
* storage format. \param[in] sendReq - Array of MPI recv requests. \param[in] countPerElem - Pieces of data per
* element communicated.
* storage format.
* \param[in] sendReq - Array of MPI recv requests.
* \param[in] countPerElem - Pieces of data per element communicated.
*/
void InitiateCommsAll(void* bufSend, const int* nElemSend, SU2_MPI::Request* sendReq, void* bufRecv,
const int* nElemRecv, SU2_MPI::Request* recvReq, unsigned short countPerElem,
Expand Down
2 changes: 1 addition & 1 deletion Common/include/geometry/dual_grid/CPoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class CPoint {
inline bool GetPhysicalBoundary(unsigned long iPoint) const { return PhysicalBoundary(iPoint); }

/*!
* \brief Set if a point belong to the boundary.
* \brief Set if a point belong to the solid wall boundary.
* \param[in] iPoint - Index of the point.
* \param[in] boundary - <code>TRUE</code> if the point belong to the physical boundary; otherwise <code>FALSE</code>.
*/
Expand Down
9 changes: 6 additions & 3 deletions Common/include/geometry/meshreader/CCGNSMeshReaderFVM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,13 @@ class CCGNSMeshReaderFVM : public CMeshReaderFVM {
* \brief Routine to launch non-blocking sends and recvs amongst all processors.
* \param[in] bufSend - Buffer of data to be sent.
* \param[in] nElemSend - Array containing the number of elements to send to other processors in cumulative storage
* format. \param[in] sendReq - Array of MPI send requests. \param[in] bufRecv - Buffer of data to be received.
* format.
* \param[in] sendReq - Array of MPI send requests.
* \param[in] bufRecv - Buffer of data to be received.
* \param[in] nElemSend - Array containing the number of elements to receive from other processors in cumulative
* storage format. \param[in] sendReq - Array of MPI recv requests. \param[in] countPerElem - Pieces of data per
* element communicated.
* storage format.
* \param[in] sendReq - Array of MPI recv requests.
* \param[in] countPerElem - Pieces of data per element communicated.
*/
void InitiateCommsAll(void* bufSend, const int* nElemSend, SU2_MPI::Request* sendReq, void* bufRecv,
const int* nElemRecv, SU2_MPI::Request* recvReq, unsigned short countPerElem,
Expand Down
2 changes: 1 addition & 1 deletion Common/src/geometry/CGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,7 @@ su2double CGeometry::GetSurfaceArea(const CConfig* config, unsigned short val_ma
return 0.0;
}

void CGeometry::ComputeSurf_Straightness(CConfig* config, bool print_on_screen) {
void CGeometry::ComputeSurf_Straightness(const CConfig* config, bool print_on_screen) {
bool RefUnitNormal_defined;
unsigned short iDim, iMarker, iMarker_Global, nMarker_Global = config->GetnMarker_CfgFile();
unsigned long iVertex;
Expand Down
137 changes: 122 additions & 15 deletions Common/src/geometry/CMultiGridGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,27 @@
This can be improved. If there is only a marker, it is a good
candidate for agglomeration ---*/

if (counter == 1) agglomerate_seed = true;
if (counter == 1) {
agglomerate_seed = true;

/*--- If there are two markers, we will aglomerate if any of the
/*--- Euler walls can be curved and agglomerating them leads to difficulties ---*/
if (config->GetMarker_All_KindBC(marker_seed) == EULER_WALL) agglomerate_seed = false;
}
/*--- If there are two markers, we will agglomerate if any of the
markers is SEND_RECEIVE ---*/

if (counter == 2) {
agglomerate_seed = (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) ||
(config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE);

/* --- Euler walls can also not be agglomerated when the point has 2 markers ---*/
if ((config->GetMarker_All_KindBC(copy_marker[0]) == EULER_WALL) ||
(config->GetMarker_All_KindBC(copy_marker[1]) == EULER_WALL)) {
agglomerate_seed = false;
}
}

/*--- If there are more than 2 markers, the aglomeration will be discarted ---*/
/*--- If there are more than 2 markers, the aglomeration will be discarded ---*/

if (counter > 2) agglomerate_seed = false;

Expand Down Expand Up @@ -220,7 +230,7 @@
const auto iPoint = MGQueue_InnerCV.NextCV();
iteration++;

/*--- If the element has not being previously agglomerated, belongs to the physical domain,
/*--- If the element has not been previously agglomerated, belongs to the physical domain,
and satisfies several geometrical criteria then the seed CV is accepted for agglomeration. ---*/

if ((!fine_grid->nodes->GetAgglomerate(iPoint)) && (fine_grid->nodes->GetDomain(iPoint)) &&
Expand Down Expand Up @@ -438,7 +448,6 @@

/*--- Be careful, it is possible that a node changes the agglomeration configuration,
the priority is always when receiving the information. ---*/

fine_grid->nodes->SetParent_CV(iPoint_Fine, iPoint_Coarse);
nodes->SetChildren_CV(iPoint_Coarse, nChildren_MPI[iPoint_Coarse], iPoint_Fine);
nChildren_MPI[iPoint_Coarse]++;
Expand Down Expand Up @@ -501,7 +510,7 @@
const CConfig* config) const {
bool agglomerate_CV = false;

/*--- Basic condition, the point has not being previously agglomerated, it belongs to the domain,
/*--- Basic condition, the point has not been previously agglomerated, it belongs to the domain,
and has passed some basic geometrical checks. ---*/

if ((!fine_grid->nodes->GetAgglomerate(CVPoint)) && (fine_grid->nodes->GetDomain(CVPoint)) &&
Expand All @@ -511,6 +520,7 @@
if (fine_grid->nodes->GetBoundary(CVPoint)) {
/*--- Identify the markers of the vertex that we want to agglomerate ---*/

// count number of markers on the agglomeration candidate
int counter = 0;
unsigned short copy_marker[3] = {};
for (auto jMarker = 0u; jMarker < fine_grid->GetnMarker() && counter < 3; jMarker++) {
Expand All @@ -526,13 +536,22 @@
/*--- Only one marker in the vertex that is going to be aglomerated ---*/

if (counter == 1) {
/*--- We agglomerate if there is only a marker and is the same marker as the seed marker ---*/

/*--- We agglomerate if there is only one marker and it is the same marker as the seed marker ---*/
// note that this should be the same marker id, not just the same marker type
if (copy_marker[0] == marker_seed) agglomerate_CV = true;

/*--- If there is only one marker, but the marker is the SEND_RECEIVE ---*/

if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) agglomerate_CV = true;
if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) {
agglomerate_CV = true;
}

if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) ||
(config->GetMarker_All_KindBC(marker_seed) == EULER_WALL)) {
if (config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) {
agglomerate_CV = false;
}
}
}

/*--- If there are two markers in the vertex that is going to be aglomerated ---*/
Expand All @@ -541,20 +560,25 @@
/*--- First we verify that the seed is a physical boundary ---*/

if (config->GetMarker_All_KindBC(marker_seed) != SEND_RECEIVE) {
/*--- Then we check that one of the marker is equal to the seed marker, and the other is send/receive ---*/
/*--- Then we check that one of the markers is equal to the seed marker, and the other is send/receive ---*/

if (((copy_marker[0] == marker_seed) && (config->GetMarker_All_KindBC(copy_marker[1]) == SEND_RECEIVE)) ||
((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) && (copy_marker[1] == marker_seed)))
((config->GetMarker_All_KindBC(copy_marker[0]) == SEND_RECEIVE) && (copy_marker[1] == marker_seed))) {
agglomerate_CV = true;
}
}
}

}

/*--- If the element belongs to the domain, it is allways aglomerated. ---*/

/*--- If the element belongs to the domain, it is always agglomerated. ---*/
else {
agglomerate_CV = true;

// actually, for symmetry (and possibly other cells) we only agglomerate cells that are on the marker
// at this point, the seed was on the boundary and the CV was not. so we check if the seed is a symmetry
if ((config->GetMarker_All_KindBC(marker_seed) == SYMMETRY_PLANE) ||
(config->GetMarker_All_KindBC(marker_seed) == EULER_WALL)) {
agglomerate_CV = false;
}
}
}

Expand Down Expand Up @@ -936,6 +960,89 @@
if (Area == 0.0)
for (iDim = 0; iDim < nDim; iDim++) NormalFace[iDim] = EPS * EPS;
}

/* Check how many symmetry planes there are and use the first (lowest ID) as the basis to orthogonalize against.
All nodes that are shared by multiple symmetries have to get a corrected normal. */
static constexpr size_t MAXNSYMS = 100;
bool Syms[MAXNSYMS] = {false};
symmetryNormals.resize(nMarker);

unsigned short nSym = 0;
for (iMarker = 0; iMarker < nMarker; ++iMarker) {
/*--- create the list with all corrected normals for all markers ---*/
// symmetryNormals.push_back({});
Fixed Show fixed Hide fixed

/*--- Note that Syms is a sorted list, so val(Syms[i]) > val[Syms[i-1]] ---*/
if (fine_grid->symmetryNormals[iMarker].size() > 0) {
Syms[iMarker] = true;
nSym++;
}
}

// /*--- Loop over all markers and find nodes on symmetry planes that are shared with other symmetries. ---*/
for (unsigned short val_marker = 0; val_marker < nMarker; val_marker++) {
if (Syms[val_marker] == false) continue;
for (iVertex = 0; iVertex < nVertex[val_marker]; iVertex++) {
iCoarsePoint = vertex[val_marker][iVertex]->GetNode();

/*--- Halo points do not need to be considered. ---*/
if (!nodes->GetDomain(iCoarsePoint)) continue;

/*--- Get the normal of the current symmetry ---*/
su2double Normal[MAXNDIM] = {0.0}, UnitNormal[MAXNDIM] = {0.0};
Fixed Show fixed Hide fixed
vertex[val_marker][iVertex]->GetNormal(Normal);
const su2double Area = GeometryToolbox::Norm(nDim, Normal);
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
for (unsigned short iDim = 0; iDim < nDim; iDim++) UnitNormal[iDim] = Normal[iDim] / Area;
Fixed Show fixed Hide fixed

/*--- At this point we find out if the node is shared with another symmetry. ---*/
/*--- We then apply a Gram-Schmidt process to compute the orthonormal basis from all
normal vectors of the shared symmetries at the node. ---*/
/*--- Step 1: do we have other symmetries? ---*/
if (nSym > 0) {
/*--- Normal of the primary symmetry plane ---*/
su2double NormalPrim[MAXNDIM] = {0.0}, UnitNormalPrim[MAXNDIM] = {0.0};
/*--- Step 2: are we on a shared node? ---*/
for (auto iMarker = 0; iMarker < nMarker; iMarker++) {
Fixed Show fixed Hide fixed
if (Syms[iMarker] == false) continue; // not on a symmetry
/*--- We do not want the current symmetry ---*/
if (val_marker != iMarker) {
/*--- Loop over all points on the other symmetry and check if current iPoint is on the symmetry ---*/
for (auto jVertex = 0ul; jVertex < nVertex[iMarker]; jVertex++) {
const auto jPoint = vertex[iMarker][jVertex]->GetNode();
if (!nodes->GetDomain(jPoint)) continue;
/*--- We are on a shared node. ---*/
if (iCoarsePoint == jPoint) {
/*--- Does the other symmetry have a lower ID? Then that is the primary symmetry ---*/
if (iMarker < val_marker) {
/*--- So we have to get the normal of that other marker ---*/
vertex[iMarker][jVertex]->GetNormal(NormalPrim);
su2double AreaPrim = GeometryToolbox::Norm(nDim, NormalPrim);
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
Fixed Show fixed Hide fixed
UnitNormalPrim[iDim] = NormalPrim[iDim] / AreaPrim;
}
/*--- Correct the current normal as n2_new = n2 - (n2.n1)n1 ---*/
su2double ProjNorm = 0.0;
for (auto iDim = 0u; iDim < nDim; iDim++) ProjNorm += UnitNormal[iDim] * UnitNormalPrim[iDim];
Fixed Show fixed Hide fixed
symNormal sn = {iCoarsePoint};

/*--- We check if the normal of the 2 planes coincide.
* We only update the normal if the normals of the symmetry planes are different. ---*/
if (fabs(1.0 - ProjNorm) > EPS) {
for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] -= ProjNorm * UnitNormalPrim[iDim];
Fixed Show fixed Hide fixed
/*--- Make normalized vector ---*/
su2double newarea = GeometryToolbox::Norm(nDim, UnitNormal);
for (auto iDim = 0u; iDim < nDim; iDim++) UnitNormal[iDim] = UnitNormal[iDim] / newarea;
Fixed Show fixed Hide fixed
}
for (auto iDim = 0u; iDim < nDim; iDim++) sn.normal[iDim] = UnitNormal[iDim];
Fixed Show fixed Hide fixed
symmetryNormals[val_marker].push_back(sn);
}
}
}
}
}
}
}
}
}
END_SU2_OMP_SAFE_GLOBAL_ACCESS
}
Expand Down
Loading