Skip to content

Commit 401c39b

Browse files
committed
some fixes [skip ci]
1 parent 34dbc5d commit 401c39b

4 files changed

Lines changed: 43 additions & 23 deletions

File tree

Common/include/grid_movement/CVolumetricMovement.hpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CVolumetricMovement : public CGridMovement {
4242
/*!
4343
* \brief Constructor of the class.
4444
*/
45-
CVolumetricMovement(void);
45+
CVolumetricMovement();
4646

4747
/*!
4848
* \brief Constructor of the Class.
@@ -53,7 +53,7 @@ class CVolumetricMovement : public CGridMovement {
5353
/*!
5454
* \brief Destructor of the class.
5555
*/
56-
~CVolumetricMovement(void) override;
56+
~CVolumetricMovement() override;
5757

5858
/*!
5959
* \brief Update the dual grid after the grid movement (edges and control volumes).
@@ -206,4 +206,21 @@ class CVolumetricMovement : public CGridMovement {
206206
* \param[in] config - Definition of the particular problem.
207207
*/
208208
inline virtual void Boundary_Dependencies(CGeometry** geometry, CConfig* config) {}
209+
210+
/*!
211+
* \brief Returns true if a marker should be deformed.
212+
* \param[in] config - Definition of the particular problem.
213+
* \param[in] iMarker - Index of marker in "marker all".
214+
*/
215+
inline bool IsDeformationMarker(const CConfig* config, unsigned short iMarker) {
216+
/*--- Get the SU2 module. SU2_CFD will use this routine for dynamically
217+
deforming meshes (MARKER_MOVING), while SU2_DEF will use it for deforming
218+
meshes after imposing design variable surface deformations (DV_MARKER). ---*/
219+
const auto KindSU2 = config->GetKind_SU2();
220+
const bool cfd = KindSU2 == SU2_COMPONENT::SU2_CFD;
221+
const bool defDot = KindSU2 == SU2_COMPONENT::SU2_DEF || KindSU2 == SU2_COMPONENT::SU2_DOT;
222+
const bool dvMarker = config->GetMarker_All_DV(iMarker) == YES;
223+
const bool moving = config->GetMarker_All_Moving(iMarker) == YES;
224+
return (cfd && ((config->GetDirectDiff() == D_DESIGN && dvMarker) || moving)) || (defDot && dvMarker);
225+
}
209226
};

Common/src/grid_movement/CLinearElasticity.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,12 +1291,6 @@ void CLinearElasticity::SetBoundaryDisplacements(CGeometry* geometry, CConfig* c
12911291
unsigned long iPoint, total_index, iVertex;
12921292
su2double *VarCoord, MeanCoord[3] = {0.0, 0.0, 0.0}, VarIncrement = 1.0;
12931293

1294-
/*--- Get the SU2 module. SU2_CFD will use this routine for dynamically
1295-
deforming meshes (MARKER_MOVING), while SU2_DEF will use it for deforming
1296-
meshes after imposing design variable surface deformations (DV_MARKER). ---*/
1297-
1298-
SU2_COMPONENT Kind_SU2 = config->GetKind_SU2();
1299-
13001294
/*--- If requested (no by default) impose the surface deflections in
13011295
increments and solve the grid deformation equations iteratively with
13021296
successive small deformations. ---*/
@@ -1326,11 +1320,7 @@ void CLinearElasticity::SetBoundaryDisplacements(CGeometry* geometry, CConfig* c
13261320
could be on on the symmetry plane, we should specify DeleteValsRowi again (just in case) ---*/
13271321

13281322
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
1329-
if (((config->GetMarker_All_Moving(iMarker) == YES) && (Kind_SU2 == SU2_COMPONENT::SU2_CFD)) ||
1330-
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_COMPONENT::SU2_DEF)) ||
1331-
((config->GetDirectDiff() == D_DESIGN) && (Kind_SU2 == SU2_COMPONENT::SU2_CFD) &&
1332-
(config->GetMarker_All_DV(iMarker) == YES)) ||
1333-
((config->GetMarker_All_DV(iMarker) == YES) && (Kind_SU2 == SU2_COMPONENT::SU2_DOT))) {
1323+
if (IsDeformationMarker(config, iMarker)) {
13341324
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
13351325
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
13361326

@@ -1404,7 +1394,7 @@ void CLinearElasticity::SetBoundaryDisplacements(CGeometry* geometry, CConfig* c
14041394
/*--- Move the FSI interfaces ---*/
14051395

14061396
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
1407-
if ((config->GetMarker_All_ZoneInterface(iMarker) == YES) && (Kind_SU2 == SU2_COMPONENT::SU2_CFD)) {
1397+
if ((config->GetMarker_All_ZoneInterface(iMarker) == YES) && (config->GetKind_SU2() == SU2_COMPONENT::SU2_CFD)) {
14081398
for (iVertex = 0; iVertex < geometry->nVertex[iMarker]; iVertex++) {
14091399
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();
14101400
VarCoord = geometry->vertex[iMarker][iVertex]->GetVarCoord();

Common/src/grid_movement/CRadialBasisFunctionInterpolation.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CRadialBasisFunctionInterpolation::~CRadialBasisFunctionInterpolation() {
3939
delete ptr;
4040
ptr = nullptr;
4141
}
42-
};
42+
}
4343

4444
void CRadialBasisFunctionInterpolation::SetVolume_Deformation(CGeometry* geometry, CConfig* config, bool UpdateGeo,
4545
bool Derivative, bool ForwardProjectionDerivative) {
@@ -269,17 +269,16 @@ void CRadialBasisFunctionInterpolation::SetDeformation(CGeometry* geometry, CCon
269269

270270
/*--- Loop over the control nodes ---*/
271271
for (auto iNode = 0ul; iNode < ControlNodes->size(); iNode++) {
272-
/*--- Setting nonzero displacement of the moving markers, else setting zero displacement for static markers---*/
273-
if (config->GetMarker_All_Moving((*ControlNodes)[iNode]->GetMarker())) {
272+
const auto iMarker = (*ControlNodes)[iNode]->GetMarker();
273+
274+
/*--- Setting nonzero displacement of the deformation markers, else setting zero displacement for static markers
275+
* ---*/
276+
if (IsDeformationMarker(config, iMarker)) {
274277
for (auto iDim = 0u; iDim < nDim; iDim++) {
275278
CtrlNodeDeformation[iNode * nDim + iDim] = SU2_TYPE::GetValue(
276-
geometry->vertex[(*ControlNodes)[iNode]->GetMarker()][(*ControlNodes)[iNode]->GetVertex()]
277-
->GetVarCoord()[iDim] *
278-
VarIncrement);
279+
geometry->vertex[iMarker][(*ControlNodes)[iNode]->GetVertex()]->GetVarCoord()[iDim] * VarIncrement);
279280
}
280-
}
281-
282-
else {
281+
} else {
283282
for (auto iDim = 0u; iDim < nDim; iDim++) {
284283
CtrlNodeDeformation[iNode * nDim + iDim] = 0.0;
285284
}
@@ -522,6 +521,7 @@ void CRadialBasisFunctionInterpolation::SetCtrlNodeCoords(CGeometry* geometry) {
522521
/*--- The coordinates of all control nodes are made available on all processes ---*/
523522

524523
/*--- resizing the matrix containing the global control node coordinates ---*/
524+
std::cout << nCtrlNodesGlobal << std::endl;
525525
CtrlCoords.resize(nCtrlNodesGlobal * nDim);
526526

527527
/*--- Array containing the local control node coordinates ---*/

TestCases/parallel_regression.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,19 @@ def main():
17151715
pass_list.append(naca0012_def.run_def())
17161716
test_list.append(naca0012_def)
17171717

1718+
# Inviscid NACA0012 (triangles) RBF
1719+
naca0012_rbf_def = TestCase('naca0012_def')
1720+
naca0012_rbf_def.cfg_dir = "deformation/naca0012"
1721+
naca0012_rbf_def.cfg_file = "def_NACA0012_rbf.cfg"
1722+
naca0012_rbf_def.test_iter = 10
1723+
naca0012_rbf_def.test_vals = [0.00352488] #residual
1724+
naca0012_rbf_def.command = TestCase.Command("mpirun -n 2", "SU2_DEF")
1725+
naca0012_rbf_def.timeout = 1600
1726+
naca0012_rbf_def.tol = 1e-8
1727+
1728+
pass_list.append(naca0012_def.run_def())
1729+
test_list.append(naca0012_def)
1730+
17181731
# Inviscid NACA0012 based on SURFACE_FILE input (surface_bump.dat)
17191732
naca0012_def_file = TestCase('naca0012_def_file')
17201733
naca0012_def_file.cfg_dir = "deformation/naca0012"

0 commit comments

Comments
 (0)