Skip to content

Commit d0dd10d

Browse files
committed
fix small issues, dependencies need re-evaluation after deforming the mesh because of some OF's
1 parent e50bd9a commit d0dd10d

12 files changed

Lines changed: 108 additions & 171 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,7 @@ class CConfig {
998998
Nonphys_Reconstr; /*!< \brief Current number of non-physical reconstructions for 2nd-order upwinding. */
999999
bool ParMETIS; /*!< \brief Boolean for activating ParMETIS mode (while testing). */
10001000
unsigned short DirectDiff; /*!< \brief Direct Differentation mode. */
1001-
bool DiscreteAdjoint, /*!< \brief AD-based discrete adjoint mode. */
1002-
FullTape; /*!< \brief Full tape mode for coupled discrete adjoints. */
1001+
bool DiscreteAdjoint; /*!< \brief AD-based discrete adjoint mode. */
10031002
unsigned long Wrt_Surf_Freq_DualTime; /*!< \brief Writing surface solution frequency for Dual Time. */
10041003
su2double Const_DES; /*!< \brief Detached Eddy Simulation Constant. */
10051004
unsigned short Kind_WindowFct; /*!< \brief Type of window (weight) function for objective functional. */
@@ -8437,12 +8436,6 @@ class CConfig {
84378436
*/
84388437
bool GetDiscrete_Adjoint(void) const { return DiscreteAdjoint; }
84398438

8440-
/*!
8441-
* \brief Get the indicator whether we want to use full (coupled) tapes.
8442-
* \return the full tape indicator.
8443-
*/
8444-
bool GetFull_Tape(void) const { return FullTape; }
8445-
84468439
/*!
84478440
* \brief Get the number of subiterations while a ramp is applied.
84488441
* \return Number of FSI subiters.

Common/src/CConfig.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,6 @@ void CConfig::SetConfig_Options() {
10871087
addEnumOption("MULTIZONE_SOLVER", Kind_MZSolver, Multizone_Map, MZ_BLOCK_GAUSS_SEIDEL);
10881088
/*!\brief MATH_PROBLEM \n DESCRIPTION: Mathematical problem \n Options: DIRECT, ADJOINT \ingroup Config*/
10891089
addMathProblemOption("MATH_PROBLEM", ContinuousAdjoint, false, DiscreteAdjoint, false, Restart_Flow, false);
1090-
/*!\brief FULL_TAPE \n DESCRIPTION: Use full (coupled) tapes for multiphysics discrete adjoint. \ingroup Config*/
1091-
addBoolOption("FULL_TAPE", FullTape, YES);
10921090
/*!\brief KIND_TURB_MODEL \n DESCRIPTION: Specify turbulence model \n Options: see \link Turb_Model_Map \endlink \n DEFAULT: NO_TURB_MODEL \ingroup Config*/
10931091
addEnumOption("KIND_TURB_MODEL", Kind_Turb_Model, Turb_Model_Map, NO_TURB_MODEL);
10941092
/*!\brief KIND_TRANS_MODEL \n DESCRIPTION: Specify transition model OPTIONS: see \link Trans_Model_Map \endlink \n DEFAULT: NO_TRANS_MODEL \ingroup Config*/

SU2_CFD/include/drivers/CDiscAdjMultizoneDriver.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver {
4040
solution update. */
4141
OBJECTIVE_FUNCTION_TAPE, /*!< \brief Record only the dependence of the objective function
4242
w.r.t. solver variables (from all zones). */
43-
ZONE_SPECIFIC_TAPE /*!< \brief Record only the dependence of the solution update in a
44-
specified zone w.r.t. solver variables (from all zones). */
4543
};
4644

4745
/*!
@@ -58,8 +56,7 @@ class CDiscAdjMultizoneDriver : public CMultizoneDriver {
5856
that it can be connected to a solver update evaluation. */
5957
};
6058

61-
int RecordingState; /*!< \brief The kind of recording that the tape currently holds. */
62-
bool retape; /*!< \brief Boolean whether a full tape can be kept in memory. */
59+
int RecordingState = NONE; /*!< \brief The kind of recording that the tape currently holds. */
6360

6461
su2double ObjFunc; /*!< \brief Value of the objective function. */
6562
int ObjFunc_Index; /*!< \brief Index of the value of the objective function. */

SU2_CFD/include/interfaces/fsi/CDiscAdjFlowTractionInterface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CDiscAdjFlowTractionInterface : public CFlowTractionInterface {
3838
* \param[in] config - Definition of the particular problem.
3939
*/
4040
CDiscAdjFlowTractionInterface(unsigned short val_nVar, unsigned short val_nConst,
41-
const CConfig *config, bool integrate_tractions_);
41+
const CConfig *config, bool conservative_);
4242

4343
/*!
4444
* \brief Retrieve some constants needed for the calculations.

SU2_CFD/include/interfaces/fsi/CFlowTractionInterface.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,27 @@
2929
#pragma once
3030

3131
#include "../CInterface.hpp"
32+
#include <unordered_map>
3233

3334
class CFlowTractionInterface : public CInterface {
34-
private:
35-
bool integrate_tractions;
36-
3735
protected:
36+
const bool conservative;
37+
std::unordered_map<unsigned long, su2double> vertexArea;
38+
3839
/*!
39-
* \brief Sets the dimensional factor for pressure and the consistent_interpolation flag
40+
* \brief Sets the dimensional factor for pressure and the consistent_interpolation flag.
4041
* \param[in] flow_config - Definition of the fluid (donor) problem.
4142
*/
4243
void Preprocess(const CConfig *flow_config);
4344

45+
/*!
46+
* \brief Computes vertex areas (FEA side) for when tractions need to be integrated.
47+
* \param[in] config - Definition of the structural (target) problem.
48+
* \param[in] geometry - FEA geometry.
49+
* \param[in] solution - FEA solver.
50+
*/
51+
void ComputeVertexAreas(const CConfig *config, CGeometry *geometry, CSolver *solution);
52+
4453
public:
4554
/*!
4655
* \overload

SU2_CFD/include/iteration/CFEAIteration.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,4 @@ class CFEAIteration : public CIteration {
131131
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
132132
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
133133
unsigned short val_iInst) override;
134-
135-
/*!
136-
* \brief Postprocess ???.
137-
* \param[in] solver - Container vector with all the solutions.
138-
* \param[in] geometry - Geometrical definition of the problem.
139-
* \param[in] config - Definition of the particular problem.
140-
*/
141-
void Postprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
142-
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
143-
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
144-
unsigned short val_iInst) override;
145134
};

SU2_CFD/include/solvers/CFEASolver.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,6 @@ class CFEASolver : public CSolver {
449449
const CConfig *config,
450450
unsigned short val_marker) final;
451451

452-
/*!
453-
* \brief Required step for non conservative interpolation schemes where stresses are transferred instead of forces.
454-
* \param[in] geometry - Geometrical definition of the problem.
455-
* \param[in] config - Definition of the particular problem.
456-
*/
457-
void Integrate_FSI_Loads(CGeometry *geometry, const CConfig *config);
458-
459452
/*!
460453
* \brief Iterate using an implicit Newmark solver.
461454
* \param[in] geometry - Geometrical definition of the problem.

SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ CDiscAdjMultizoneDriver::CDiscAdjMultizoneDriver(char* confFile,
3939

4040
: CMultizoneDriver(confFile, val_nZone, MPICommunicator) {
4141

42-
retape = !config_container[ZONE_0]->GetFull_Tape();
43-
44-
RecordingState = NONE;
45-
4642
direct_nInst.resize(nZone,1);
4743
nInnerIter.resize(nZone);
4844

@@ -236,7 +232,7 @@ void CDiscAdjMultizoneDriver::Run() {
236232
/*--- If we want to set up zone-specific tapes (retape), we do not need to record
237233
* here. Otherwise, the whole tape of a coupled run will be created. ---*/
238234

239-
if (!retape && (RecordingState != SOLUTION_VARIABLES)) {
235+
if (RecordingState != SOLUTION_VARIABLES) {
240236
SetRecording(NONE, Kind_Tape::FULL_TAPE, ZONE_0);
241237
SetRecording(SOLUTION_VARIABLES, Kind_Tape::FULL_TAPE, ZONE_0);
242238
}
@@ -247,11 +243,6 @@ void CDiscAdjMultizoneDriver::Run() {
247243

248244
config_container[iZone]->Set_StartTime(SU2_MPI::Wtime());
249245

250-
if (retape) {
251-
SetRecording(NONE, Kind_Tape::FULL_TAPE, ZONE_0);
252-
SetRecording(SOLUTION_VARIABLES, Kind_Tape::ZONE_SPECIFIC_TAPE, iZone);
253-
}
254-
255246
/*--- Start inner iterations from where we stopped in previous outer iteration. ---*/
256247

257248
Set_Solution_To_BGSSolution_k(iZone);
@@ -502,7 +493,6 @@ void CDiscAdjMultizoneDriver::SetRecording(unsigned short kind_recording, Kind_T
502493
AD::Push_TapePosition(); /// REGISTERED
503494

504495
for (iZone = 0; iZone < nZone; iZone++) {
505-
506496
iteration_container[iZone][INST_0]->SetDependencies(solver_container, geometry_container, numerics_container,
507497
config_container, iZone, INST_0, kind_recording);
508498
}
@@ -515,10 +505,15 @@ void CDiscAdjMultizoneDriver::SetRecording(unsigned short kind_recording, Kind_T
515505

516506
if ((tape_type == Kind_Tape::OBJECTIVE_FUNCTION_TAPE) || (kind_recording == MESH_COORDS)) {
517507
HandleDataTransfer();
508+
for (iZone = 0; iZone < nZone; iZone++) {
509+
if (Has_Deformation(iZone)) {
510+
iteration_container[iZone][INST_0]->SetDependencies(solver_container, geometry_container, numerics_container,
511+
config_container, iZone, INST_0, kind_recording);
512+
}
513+
}
514+
SetObjFunction(kind_recording);
518515
}
519516

520-
SetObjFunction(kind_recording);
521-
522517
AD::Push_TapePosition(); /// OBJECTIVE_FUNCTION
523518

524519
if (tape_type != Kind_Tape::OBJECTIVE_FUNCTION_TAPE) {
@@ -537,18 +532,10 @@ void CDiscAdjMultizoneDriver::SetRecording(unsigned short kind_recording, Kind_T
537532

538533
AD::Push_TapePosition(); /// enter_zone
539534

540-
if (tape_type == Kind_Tape::ZONE_SPECIFIC_TAPE) {
541-
if (iZone == record_zone) {
542-
DirectIteration(iZone, kind_recording);
543-
}
544-
}
545-
else {
546-
DirectIteration(iZone, kind_recording);
547-
}
535+
DirectIteration(iZone, kind_recording);
548536

549537
iteration_container[iZone][INST_0]->RegisterOutput(solver_container, geometry_container,
550538
config_container, output_container[iZone], iZone, INST_0);
551-
552539
AD::Push_TapePosition(); /// leave_zone
553540
}
554541
}
@@ -788,7 +775,6 @@ void CDiscAdjMultizoneDriver::SetObjFunction(unsigned short kind_recording) {
788775
ObjFunc += solvers[FEA_SOL]->GetTotal_OFRefGeom()*Weight_ObjFunc;
789776
break;
790777
case TOPOL_COMPLIANCE:
791-
static_cast<CFEASolver*>(solvers[FEA_SOL])->Integrate_FSI_Loads(geometry, config);
792778
solvers[FEA_SOL]->Compute_OFCompliance(geometry, config);
793779
ObjFunc += solvers[FEA_SOL]->GetTotal_OFCompliance()*Weight_ObjFunc;
794780
break;

SU2_CFD/src/interfaces/fsi/CDiscAdjFlowTractionInterface.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
#include "../../../include/solvers/CSolver.hpp"
3333

3434
CDiscAdjFlowTractionInterface::CDiscAdjFlowTractionInterface(unsigned short val_nVar, unsigned short val_nConst,
35-
const CConfig *config, bool integrate_tractions_) :
36-
CFlowTractionInterface(val_nVar, val_nConst, config, integrate_tractions_) {
35+
const CConfig *config, bool conservative_) :
36+
CFlowTractionInterface(val_nVar, val_nConst, config, conservative_) {
3737
}
3838

3939
void CDiscAdjFlowTractionInterface::GetPhysical_Constants(CSolver *flow_solution, CSolver *struct_solution,
@@ -46,6 +46,8 @@ void CDiscAdjFlowTractionInterface::GetPhysical_Constants(CSolver *flow_solution
4646

4747
Preprocess(flow_config);
4848

49+
if (!conservative) ComputeVertexAreas(struct_config, struct_geometry, struct_solution);
50+
4951
/*--- No ramp applied ---*/
5052
Physical_Constants[1] = 1.0;
5153
}

0 commit comments

Comments
 (0)