Documentation 6b54b78464
Loading...
Searching...
No Matches
CDiscAdjMultizoneDriver Class Reference

Block Gauss-Seidel driver for multizone / multiphysics discrete adjoint problems. More...

#include <CDiscAdjMultizoneDriver.hpp>

Inheritance diagram for CDiscAdjMultizoneDriver:
[legend]

Public Member Functions

 CDiscAdjMultizoneDriver (char *confFile, unsigned short val_nZone, SU2_Comm MPICommunicator)
 Constructor of the class.
 
 ~CDiscAdjMultizoneDriver (void) override
 Destructor of the class.
 
void StartSolver () override
 [Overload] Launch the computation for discrete adjoint multizone problems.
 
void Preprocess (unsigned long TimeIter) override
 Preprocess the multizone iteration.
 
void Run () override
 [Overload] Run an discrete adjoint update of all solvers within multiple zones.
 
bool Iterate (unsigned short iZone, unsigned long iInnerIter, bool KrylovMode=false)
 Run one inner iteration for a given zone.
 
- Public Member Functions inherited from CMultizoneDriver
 CMultizoneDriver (char *confFile, unsigned short val_nZone, SU2_Comm MPICommunicator)
 Constructor of the class.
 
 ~CMultizoneDriver () override
 Destructor of the class.
 
void StartSolver () override
 [Overload] Launch the computation for multizone problems.
 
void Preprocess (unsigned long TimeIter) override
 Preprocess the multizone iteration.
 
void Run () override
 Solves one time iteration.
 
void Postprocess ()
 Placeholder for post processing operations to make the interface of this driver identical to CSinglezoneDriver.
 
void Update () override
 Update the dual-time solution within multiple zones.
 
void Output (unsigned long TimeIter) override
 Output the solution in solution file.
 
void DynamicMeshUpdate (unsigned long TimeIter) override
 Perform a dynamic mesh deformation, included grid velocity computation and the update of the multigrid structure (multiple zone).
 
bool Monitor (unsigned long TimeIter) override
 Check if simulation converged and return appropriate boolean.
 
- Public Member Functions inherited from CDriver
 CDriver (char *confFile, unsigned short val_nZone, SU2_Comm MPICommunicator, bool dummy_geo)
 Constructor of the class.
 
 ~CDriver (void) override
 Destructor of the class.
 
template<class Container , bool Old = false>
void SetAllSolutions (unsigned short iZone, bool adjoint, const Container &solution)
 Set the solution of all solvers (adjoint or primal) in a zone.
 
template<class Container >
void SetAllSolutionsOld (unsigned short iZone, bool adjoint, const Container &solution)
 Set the "old solution" of all solvers (adjoint or primal) in a zone.
 
template<class Container >
void GetAllSolutions (unsigned short iZone, bool adjoint, Container &solution) const
 Get the solution of all solvers (adjoint or primal) in a zone.
 
unsigned short GetTotalNumberOfVariables (unsigned short iZone, bool adjoint) const
 Sum the number of primal or adjoint variables for all solvers in a given zone.
 
void Finalize () override
 Deallocation routine.
 
virtual void SetInitialMesh ()
 Perform a mesh deformation as initial condition.
 
void BoundaryConditionsUpdate ()
 Process the boundary conditions and update the multi-grid structure.
 
unsigned long GetNumberTimeIter () const
 Get the number of time iterations.
 
unsigned long GetTimeIter () const
 Get the current time iteration.
 
passivedouble GetUnsteadyTimeStep () const
 Get the unsteady time step.
 
string GetSurfaceFileName () const
 Get the name of the output file for the surface.
 
void SetHeatSourcePosition (passivedouble alpha, passivedouble pos_x, passivedouble pos_y, passivedouble pos_z)
 Set the position of the heat source.
 
void SetInletAngle (unsigned short iMarker, passivedouble alpha)
 Set the direction of the inlet.
 
void SetFarFieldAoA (passivedouble alpha)
 Set the angle of attack of the farfield.
 
void SetFarFieldAoS (passivedouble beta)
 Set the angle of sideslip of the farfield.
 
void SetTranslationRate (passivedouble xDot, passivedouble yDot, passivedouble zDot)
 Set the dynamic mesh translation rates.
 
void SetRotationRate (passivedouble rot_x, passivedouble rot_y, passivedouble rot_z)
 Set the dynamic mesh rotation rates.
 
void SetMarkerRotationRate (unsigned short iMarker, passivedouble rot_x, passivedouble rot_y, passivedouble rot_z)
 Set the moving wall marker rotation rates.
 
void SetMarkerTranslationRate (unsigned short iMarker, passivedouble vel_x, passivedouble vel_y, passivedouble vel_z)
 Set the moving wall marker translation rates.
 
passivedouble GetDensityFreeStreamND () const
 Get the Freestream Density for nondimensionalization.
 
passivedouble GetForceRef () const
 Get the reference Body force for nondimensionalization.
 
- Public Member Functions inherited from CDriverBase
 CDriverBase (char *confFile, unsigned short val_nZone, SU2_Comm MPICommunicator)
 Constructor of the class.
 
virtual ~CDriverBase (void)
 Destructor of the class.
 
vector< string > GetOutputNames () const
 Get the list of available outputs.
 
passivedouble GetOutputValue (const std::string &output_name) const
 Get the value of one of the available history outputs.
 
vector< string > GetMarkerOutputNames () const
 Get the list of available surface outputs on both MARKER_MONITORING and MARKER_ANALYZE.
 
passivedouble GetMarkerMonitoringOutputValue (const std::string &output_name, const std::string &marker_monitoring) const
 Get the value of one of the available surface outputs at a given MARKER_MONITORING.
 
passivedouble GetMarkerAnalyzeOutputValue (const std::string &output_name, const std::string &marker_analyze) const
 Get the value of one of the available surface outputs at a given MARKER_ANALYZE.
 
unsigned short GetNumberDesignVariables () const
 Get the number of design variables.
 
unsigned short GetNumberFFDBoxes () const
 Get the number of FFD boxes.
 
unsigned long GetNumberDimensions () const
 Get the number of dimensions of the mesh.
 
unsigned long GetNumberElements () const
 Get the number of elements in the mesh.
 
unsigned long GetElementGlobalIndex (unsigned long iElem) const
 Get the global index of a mesh element.
 
vector< unsigned long > GetElementNodes (unsigned long iElem) const
 Get the node indices of a mesh element.
 
unsigned long GetNumberNodes () const
 Get the number of nodes in the mesh (including halos).
 
unsigned long GetNumberHaloNodes () const
 Get the number of halo nodes in the mesh.
 
unsigned long GetNodeGlobalIndex (unsigned long iPoint) const
 Get the global node index.
 
bool GetNodeDomain (unsigned long iPoint) const
 Get the halo flag of a mesh node.
 
CPyWrapperMatrixView InitialCoordinates () const
 Get a read-only view of the initial (undeformed) coordinates of all mesh nodes.
 
CPyWrapperMarkerMatrixView MarkerInitialCoordinates (unsigned short iMarker) const
 Get a read-only view of the initial (undeformed) coordinates of the mesh nodes of a marker.
 
CPyWrapperMatrixView Coordinates ()
 Get a read/write view of the current coordinates of all mesh nodes.
 
CPyWrapperMarkerMatrixView MarkerCoordinates (unsigned short iMarker)
 Get a read/write view of the current coordinates of the mesh nodes of a marker.
 
unsigned short GetNumberMarkers () const
 Get the number of markers in the mesh.
 
map< string, unsigned short > GetMarkerIndices () const
 Get all the boundary markers tags with their associated indices.
 
map< string, string > GetMarkerTypes () const
 Get all the boundary markers tags with their associated types.
 
vector< string > GetMarkerTags () const
 Get all the boundary marker tags.
 
vector< string > GetDeformableMarkerTags () const
 Get all the deformable boundary marker tags.
 
vector< string > GetCHTMarkerTags () const
 Get all the CHT boundary marker tags.
 
vector< string > GetInletMarkerTags () const
 Get all the inlet boundary marker tags.
 
unsigned long GetNumberMarkerElements (unsigned short iMarker) const
 Get the number of elements in the marker.
 
unsigned long GetMarkerElementGlobalIndex (unsigned short iMarker, unsigned long iElem) const
 Get the global index of a marker element.
 
vector< unsigned long > GetMarkerElementNodes (unsigned short iMarker, unsigned long iElem) const
 Get the node indices of a marker element.
 
unsigned long GetNumberMarkerNodes (unsigned short iMarker) const
 Get the number of nodes in the marker.
 
unsigned long GetMarkerNode (unsigned short iMarker, unsigned long iVertex) const
 Get the node index of a marker.
 
vector< passivedouble > GetMarkerVertexNormals (unsigned short iMarker, unsigned long iVertex, bool normalize=false) const
 Get the normal vector of a marker vertex.
 
vector< passivedouble > GetMarkerDisplacement (unsigned short iMarker, unsigned long iVertex) const
 Get the displacements currently imposed of a marker vertex.
 
void SetMarkerCustomDisplacement (unsigned short iMarker, unsigned long iVertex, vector< passivedouble > values)
 Set the mesh displacements of a marker vertex.
 
vector< passivedouble > GetMarkerMeshVelocity (unsigned short iMarker, unsigned long iVertex) const
 Get the mesh velocities currently imposed on a marker vertex.
 
void SetMarkerCustomMeshVelocity (unsigned short iMarker, unsigned long iVertex, vector< passivedouble > values)
 Set the velocities of a marker vertex.
 
void CommunicateMeshDisplacements (void)
 Communicate the boundary mesh displacements.
 
map< string, unsigned short > GetSolverIndices () const
 Get all the active solver names with their associated indices (which can be used to access their data).
 
map< string, unsigned short > GetFEASolutionIndices () const
 Get the structural solver solution variable names with their associated indices. These correspond to the column indices in the matrix returned by e.g. Solution().
 
CPyWrapperMatrixView Solution (unsigned short iSolver)
 Get a read/write view of the current solution on all mesh nodes of a solver.
 
CPyWrapper3DMatrixView Gradient (unsigned short iSolver)
 Get read/write view of the gradients of a solver variable in a point.
 
CPyWrapperMatrixView UserDefinedSource (unsigned short iSolver)
 Get a read/write view of the user defined source on all mesh nodes of a solver.
 
CPyWrapperMarkerMatrixView MarkerSolution (unsigned short iSolver, unsigned short iMarker)
 Get a read/write view of the current solution on the mesh nodes of a marker.
 
CPyWrapperMatrixView SolutionTimeN (unsigned short iSolver)
 Get a read/write view of the solution at time N on all mesh nodes of a solver.
 
CPyWrapperMarkerMatrixView MarkerSolutionTimeN (unsigned short iSolver, unsigned short iMarker)
 Get a read/write view of the solution at time N on the mesh nodes of a marker.
 
CPyWrapperMatrixView SolutionTimeN1 (unsigned short iSolver)
 Get a read/write view of the solution at time N-1 on all mesh nodes of a solver.
 
CPyWrapperMarkerMatrixView MarkerSolutionTimeN1 (unsigned short iSolver, unsigned short iMarker)
 Get a read/write view of the solution at time N-1 on the mesh nodes of a marker.
 
map< string, unsigned short > GetPrimitiveIndices () const
 Get the flow solver primitive variable names with their associated indices. These correspond to the column indices in the matrix returned by Primitives.
 
CPyWrapperMatrixView Primitives ()
 Get a read/write view of the current primitive variables on all mesh nodes of the flow solver.
 
CPyWrapperMarkerMatrixView MarkerPrimitives (unsigned short iMarker)
 Get a read/write view of the current primitive variables on the mesh nodes of a marker.
 
CPyWrapperMatrixView Sensitivity (unsigned short iSolver)
 Get a read-only view of the geometry sensitivity of a discrete adjoint solver.
 
void SetMarkerCustomTemperature (unsigned short iMarker, unsigned long iVertex, passivedouble WallTemp)
 Set the temperature of a vertex on a specified marker (MARKER_PYTHON_CUSTOM).
 
void SetMarkerCustomNormalHeatFlux (unsigned short iMarker, unsigned long iVertex, passivedouble WallHeatFlux)
 Set the wall normal heat flux at a vertex on a specified marker (MARKER_PYTHON_CUSTOM).
 
void SetMarkerCustomScalar (unsigned short iMarker, unsigned long iVertex, vector< passivedouble > WallScalar)
 Set the wall normal scalar values at a vertex on a specified marker (MARKER_PYTHON_CUSTOM).
 
void SelectZone (unsigned short iZone)
 Selects zone to be used for python driver operations.
 
unsigned short SelectedZone () const
 Returns the index of the zone selected for python driver operations.
 
passivedouble GetMarkerNormalHeatFlux (unsigned short iSolver, unsigned short iMarker, unsigned long iVertex) const
 Get the wall normal heat flux at a vertex on a specified marker of the flow or heat solver.
 
void SetMarkerCustomFEALoad (unsigned short iMarker, unsigned long iVertex, std::vector< passivedouble > force)
 Sets the nodal force for the structural solver at a vertex of a marker.
 
vector< passivedouble > GetMarkerFlowLoad (unsigned short iMarker, unsigned long iVertex) const
 Get the fluid force at a vertex of a solid wall marker of the flow solver.
 
void SetMarkerCustomFlowLoadAdjoint (unsigned short iMarker, unsigned long iVertex, vector< passivedouble > adjointLoad)
 Set the adjoint of the flow tractions of the flow solver.
 
vector< passivedouble > GetMarkerDisplacementSensitivity (unsigned short iMarker, unsigned long iVertex) const
 Get the sensitivities of the displacements of the mesh boundary vertices.
 
vector< passivedouble > GetMarkerFEALoadSensitivity (unsigned short iMarker, unsigned long iVertex) const
 Get the sensitivity of the FEA loads of the structural solver (via the adjoint structural solver).
 
void SetMarkerCustomFEADisplacementAdjoint (unsigned short iMarker, unsigned long iVertex, vector< passivedouble > adjointDisplacement)
 Set the adjoint of the structural displacements.
 
void SetMarkerCustomFEAVelocityAdjoint (unsigned short iMarker, unsigned long iVertex, vector< passivedouble > adjointVelocity)
 Set the adjoint of the structural velocities.
 
void SetMarkerCustomInletFlowVar0 (unsigned short iMarker, unsigned long iVertex, passivedouble value)
 Set the first variable in MARKER_INLET (usually temperature).
 
void SetMarkerCustomInletFlowVar1 (unsigned short iMarker, unsigned long iVertex, passivedouble value)
 Set the second variable in MARKER_INLET (usually total pressure).
 
void SetMarkerCustomInletFlowDirection (unsigned short iMarker, unsigned long iVertex, std::vector< passivedouble > values)
 Set the flow direction vector (does not need to be a unit vector).
 

Protected Types

enum class  Kind_Tape { FULL_SOLVER_TAPE , OBJECTIVE_FUNCTION_TAPE }
 Kinds of recordings. More...
 
enum  Tape_Positions {
  START = 0 , REGISTERED = 1 , DEPENDENCIES = 2 , OBJECTIVE_FUNCTION = 3 ,
  TRANSFER = 4 , ITERATION_READY = 5
}
 Position markers within a tape. More...
 
using Scalar = passivedouble
 

Protected Member Functions

void KrylovInnerIters (unsigned short iZone)
 Run inner iterations using a Krylov method (GMRES atm).
 
bool EvaluateObjectiveFunctionGradient ()
 Evaluate the gradient of the objective function and add to "External".
 
void EvaluateSensitivities (unsigned long Iter, bool force_writing)
 Evaluate sensitivites for the current adjoint solution and output files.
 
void InitializeCrossTerms ()
 Setup the matrix of cross-terms. Allocate necessary memory and initialize to zero.
 
void SetRecording (RECORDING kind_recording, Kind_Tape tape_type, unsigned short record_zone)
 Record one iteration of the primal problem within each zone.
 
void HandleDataTransfer ()
 Transfer data between zones and update grids when required.
 
void DirectIteration (unsigned short iZone, RECORDING kind_recording)
 Run one direct iteration in a zone.
 
void SetObjFunction (RECORDING kind_recording)
 Set the objective function.
 
void SetAdjObjFunction ()
 Initialize the adjoint value of the objective function.
 
void ComputeAdjoints (unsigned short iZone, bool eval_transfer=true)
 Summary of all routines to evaluate the adjoints in iZone.
 
void Set_Solution_To_BGSSolution_k (unsigned short iZone)
 Puts BGSSolution_k back into Solution.
 
void Set_BGSSolution_k_To_Solution (unsigned short iZone)
 Puts Solution into BGSSolution_k.
 
void AddSolutionToExternal (unsigned short iZone)
 Add Solution vector to External.
 
void SetExternalToDualTimeDer ()
 Puts dual time derivative vector to External.
 
void AddExternalToSolution (unsigned short iZone)
 Add External_Old vector to Solution.
 
void SetSolutionOldToSolution (unsigned short iZone)
 Puts Solution into SolutionOld.
 
void UpdateCrossTerm (unsigned short iZone, unsigned short jZone)
 Extract contribution of iZone to jZone with BGS relaxation.
 
void SetResidual_BGS (unsigned short iZone)
 Compute BGS residuals.
 
bool GetTimeConvergence () const override
 gets Convergence on physical time scale, (deactivated in adjoint case)
 
template<class Container >
void GetAdjointRHS (unsigned short iZone, Container &rhs) const
 Get the external of all adjoint solvers in a zone.
 
void TapeTest ()
 Launch the tape test run of the discrete adjoint multizone solver.
 
int TapeTestGatherErrors (AD::DebugControl &debug_control) const
 Get the total error count after a tape test run of the discrete adjoint multizone solver.
 
- Protected Member Functions inherited from CMultizoneDriver
void DynamicMeshUpdate (unsigned short val_iZone, unsigned long TimeIter)
 Perform a dynamic mesh deformation, including grid velocity computation and update of the multigrid structure.
 
void Corrector (unsigned short val_iZone)
 Use a corrector step to prevent convergence issues.
 
void RunGaussSeidel ()
 Run a Block Gauss-Seidel iteration in all physical zones.
 
void RunJacobi ()
 Run a Block-Jacobi iteration in all physical zones.
 
bool TransferData (unsigned short donorZone, unsigned short targetZone)
 Routine to provide all the desired physical transfers between the different zones during one iteration.
 
bool OuterConvergence (unsigned long OuterIter)
 Check the convergence at the outer level.
 
- Protected Member Functions inherited from CDriver
void InitializeContainers ()
 Initialize containers.
 
void PreprocessInput (CConfig **&config, CConfig *&driver_config)
 Read in the config and mesh files.
 
void InitializeGeometry (CConfig *config, CGeometry **&geometry, bool dummy)
 Construction of the edge-based data structure and the multi-grid structure.
 
void InitializeGeometryDGFEM (CConfig *config, CGeometry **&geometry)
 Do the geometrical preprocessing for the DG FEM solver.
 
void InitializeGeometryFVM (CConfig *config, CGeometry **&geometry)
 InitializeGeometryFVM.
 
void PreprocessIteration (CConfig *config, CIteration *&iteration) const
 Definition of the physics iteration class or within a single zone.
 
void InitializeSolver (CConfig *config, CGeometry **geometry, CSolver ***&solver)
 Definition and allocation of all solution classes.
 
void PreprocessInlet (CSolver ***solver, CGeometry **geometry, CConfig *config) const
 Preprocess the inlets via file input for all solvers.
 
void RestartSolver (CSolver ***solver, CGeometry **geometry, CConfig *config, bool update_geo)
 Restart of the solvers from the restart files.
 
void FinalizeSolver (CSolver ****solver, CGeometry **geometry, CConfig *config, unsigned short val_iInst)
 Definition and allocation of all solution classes.
 
void InitializeIntegration (CConfig *config, CSolver **solver, CIntegration **&integration) const
 Definition and allocation of all integration classes.
 
void FinalizeIntegration (CIntegration ***integration, CGeometry **geometry, CConfig *config, unsigned short val_iInst)
 Definition and allocation of all integration classes.
 
void InitializeInterface (CConfig **config, CSolver *****solver, CGeometry ****geometry, unsigned short **interface_types, CInterface ***interface, vector< vector< unique_ptr< CInterpolator > > > &interpolation)
 Definition and allocation of all interface classes.
 
void InitializeNumerics (CConfig *config, CGeometry **geometry, CSolver ***solver, CNumerics ****&numerics) const
 Definition and allocation of all solver classes.
 
template<class FlowIndices >
void InstantiateTurbulentNumerics (unsigned short nVar_Turb, int offset, const CConfig *config, const CSolver *turb_solver, CNumerics ****&numerics) const
 Helper to instantiate turbulence numerics specialized for different flow solvers.
 
template<class FlowIndices >
void InstantiateTransitionNumerics (unsigned short nVar_Trans, int offset, const CConfig *config, const CSolver *trans_solver, CNumerics ****&numerics) const
 Helper to instantiate transition numerics specialized for different flow solvers.
 
template<class FlowIndices >
void InstantiateSpeciesNumerics (unsigned short nVar_Species, int offset, const CConfig *config, const CSolver *species_solver, CNumerics ****&numerics) const
 Helper to instantiate species transport numerics specialized for different flow solvers.
 
void FinalizeNumerics (CNumerics *****numerics, CSolver ***solver, CGeometry **geometry, CConfig *config, unsigned short val_iInst)
 Definition and allocation of all solver classes.
 
void PreprocessDynamicMesh (CConfig *config, CGeometry **geometry, CSolver ***solver, CIteration *iteration, CVolumetricMovement *&grid_movement, CSurfaceMovement *&surface_movement) const
 GridMovement_Preprocessing.
 
void PreprocessPythonInterface (CConfig **config, CGeometry ****geometry, CSolver *****solver)
 Initialize Python interface functionalities. When using multigrid, it is important to call this after modifying custom boundary values.
 
void PreprocessOutput (CConfig **config, CConfig *driver_config, COutput **&output_container, COutput *&driver_output)
 Preprocess the output container.
 
void PreprocessStaticMesh (const CConfig *config, CGeometry **geometry)
 Initiate value for static mesh movement such as the gridVel for the ROTATING frame.
 
void PreprocessTurbomachinery (CConfig **config, CGeometry ****geometry, CSolver *****solver, CInterface ***interface, CIteration ***iteration, bool dummy)
 Initiate value for static mesh movement such as the gridVel for the ROTATING frame.
 
void PreprocessTurboVertex (CConfig **config, CGeometry ****geometry, CSolver *****solver, CInterface ***interface, CIteration ***iteration, bool dummy)
 
virtual void PredictDisplacements (unsigned short donorZone, unsigned short targetZone)
 A virtual member.
 
virtual void PredictTractions (unsigned short donorZone, unsigned short targetZone)
 A virtual member.
 
virtual void TransferDisplacements (unsigned short donorZone, unsigned short targetZone)
 A virtual member.
 
virtual void TransferTractions (unsigned short donorZone, unsigned short targetZone)
 A virtual member.
 
virtual void RelaxationDisplacements (unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter)
 A virtual member.
 
virtual void RelaxationTractions (unsigned short donorZone, unsigned short targetZone, unsigned long iOuterIter)
 A virtual member.
 
void PrintDirectResidual (RECORDING kind_recording)
 Print out the direct residuals.
 
- Protected Member Functions inherited from CDriverBase
CSolver * GetSolverAndCheckMarker (unsigned short iSolver, unsigned short iMarker=std::numeric_limits< unsigned short >::max()) const
 Automates some boilerplate of accessing solution fields for the python wrapper.
 
void InitializeContainers ()
 Initialize containers.
 
void CommonFinalize ()
 Delete containers.
 
void InputPreprocessing (CConfig **&config, CConfig *&driver_config)
 Read in the config and mesh files.
 
void InitializeGeometry (CConfig *config, CGeometry **&geometry, bool dummy)
 Construction of the edge-based data structure and the multi-grid structure.
 
void InitializeSolver (CConfig *config, CGeometry **geometry, CSolver ***&solver)
 Definition and allocation of all solution classes.
 
void InitializeNumerics (CConfig *config, CGeometry **geometry, CSolver ***solver, CNumerics ****&numerics) const
 Definition and allocation of all solver classes.
 
void OutputPreprocessing (CConfig **config, CConfig *driver_config, COutput **&output_container, COutput *&driver_output)
 Preprocess the output container.
 

Protected Attributes

RECORDING RecordingState = RECORDING::CLEAR_INDICES
 The kind of recording that the tape currently holds.
 
bool eval_transfer = false
 Evaluate the transfer section of the tape.
 
su2double ObjFunc
 Value of the objective function.
 
AD::Identifier ObjFunc_Index
 Index of the value of the objective function.
 
CIteration *** direct_iteration
 Array of pointers to the direct iterations.
 
COutput ** direct_output
 Array of pointers to the direct outputs.
 
vector< unsigned short > direct_nInst
 Total number of instances in the direct problem.
 
vector< unsigned long > nInnerIter
 Number of inner iterations for each zone.
 
unsigned long wrt_sol_freq = std::numeric_limits<unsigned long>::max()
 File output frequency.
 
su2vector< bool > Has_Deformation
 True if iZone has mesh deformation (used for lazy evaluation of TRANSFER tape section).
 
vector< vector< vector< su2passivematrix > > > Cross_Terms
 Fixed-Point corrector that can be applied to inner iterations.
 
vector< CQuasiNewtonInvLeastSquares< passivedouble > > FixPtCorrector
 Members to use GMRES to drive inner iterations (alternative to quasi-Newton).
 
const Scalar KrylovTol = 0.01
 
vector< CSysSolve< Scalar > > LinSolver
 
vector< CSysVector< Scalar > > AdjRHS
 
vector< CSysVector< Scalar > > AdjSol
 
- Protected Attributes inherited from CMultizoneDriver
bool fsi
 
bool cht
 
unsigned long TimeIter
 
unsigned short * nVarZone
 
su2double ** init_res
 Stores the initial residual.
 
su2double ** residual
 Stores the current residual.
 
su2double ** residual_rel
 Stores the residual relative to the initial.
 
su2double flow_criteria
 
su2double flow_criteria_rel
 
su2double structure_criteria
 
su2double structure_criteria_rel
 
bool * prefixed_motion
 Determines if a fixed motion is imposed in the config file.
 
- Protected Attributes inherited from CDriver
su2double UsedTimeOutput
 Elapsed time between Start and Stop point of the timer for tracking output phase.
 
su2double BandwidthSum
 Aggregate value of the bandwidth for writing restarts (to be average later).
 
unsigned long IterCount
 Iteration count stored for performance benchmarking.
 
unsigned long OutputCount
 Output count stored for performance benchmarking.
 
unsigned long DOFsPerPoint
 Number of unknowns at each vertex, i.e., number of equations solved.
 
su2double Mpoints
 Total number of grid points in millions in the calculation (including ghost points).
 
su2double MpointsDomain
 Total number of grid points in millions in the calculation (excluding ghost points).
 
su2double MDOFs
 Total number of DOFs in millions in the calculation (including ghost points).
 
su2double MDOFsDomain
 Total number of DOFs in millions in the calculation (excluding ghost points).
 
bool StopCalc
 Stop computation flag.
 
bool mixingplane
 mixing-plane simulation flag.
 
bool fsi
 FSI simulation flag.
 
bool fem_solver
 FEM fluid solver simulation flag.
 
CFreeFormDefBox *** FFDBox
 FFD FFDBoxes of the problem.
 
CIteration *** iteration_container
 Container vector with all the iteration methods.
 
CIntegration **** integration_container
 Container vector with all the integration methods.
 
vector< vector< unique_ptr< CInterpolator > > > interpolator_container
 Definition of the interpolation method between non-matching discretizations of the interface.
 
CInterface *** interface_container
 Definition of the interface of information and physics.
 
unsigned short ** interface_types
 Type of coupling between the distinct (physical) zones.
 
bool dry_run
 Flag if SU2_CFD was started as dry-run via "SU2_CFD -d <config>.cfg".
 
- Protected Attributes inherited from CDriverBase
int rank
 MPI Rank.
 
int size
 MPI Size.
 
char * config_file_name
 Configuration file name of the problem.
 
su2double StartTime
 Start point of the timer for performance benchmarking.
 
su2double StopTime
 Stop point of the timer for performance benchmarking.
 
su2double UsedTimePreproc
 Elapsed time between Start and Stop point of the timer for tracking preprocessing phase.
 
su2double UsedTimeCompute
 Elapsed time between Start and Stop point of the timer for tracking compute phase.
 
su2double UsedTime
 Elapsed time between Start and Stop point of the timer.
 
unsigned long TimeIter
 
unsigned short selected_zone = ZONE_0
 Selected zone for the driver. Defaults to ZONE_0.
 
unsigned short iMesh
 Iterator on mesh levels.
 
unsigned short iZone
 Iterator on zones.
 
unsigned short nZone
 Total number of zones in the problem.
 
unsigned short nDim
 Number of dimensions.
 
unsigned short iInst
 Iterator on instance levels.
 
unsigned short * nInst
 Total number of instances in the problem (per zone).
 
CConfig * driver_config = nullptr
 Definition of the driver configuration.
 
COutput * driver_output = nullptr
 Definition of the driver output.
 
CConfig ** config_container
 Definition of the particular problem.
 
COutput ** output_container
 Pointer to the COutput class.
 
CGeometry **** geometry_container
 Geometrical definition of the problem.
 
CSolver ***** solver_container
 Container vector with all the solutions.
 
CNumerics ****** numerics_container
 Description of the numerical method (the way in which the equations are solved).
 
CSurfaceMovement ** surface_movement
 Surface movement classes of the problem.
 
CVolumetricMovement *** grid_movement
 Volume grid movement classes of the problem.
 
CConfig * main_config = nullptr
 Reference to base (i.e. ZONE 0) configuration (used in driver API).
 
CGeometry * main_geometry = nullptr
 Reference to base (i.e. ZONE, INST, MESH 0) geometry (used in driver API).
 

Static Protected Attributes

static constexpr unsigned long KrylovMinIters = 3
 

Detailed Description

Block Gauss-Seidel driver for multizone / multiphysics discrete adjoint problems.

Member Typedef Documentation

◆ Scalar

Member Enumeration Documentation

◆ Kind_Tape

enum class CDiscAdjMultizoneDriver::Kind_Tape
strongprotected

Kinds of recordings.

Enumerator
FULL_SOLVER_TAPE 

Entire derivative information for a coupled adjoint solution update.

OBJECTIVE_FUNCTION_TAPE 

Record only the dependence of the objective function w.r.t. solver variables (from all zones).

◆ Tape_Positions

Position markers within a tape.

Enumerator
START 

Beginning of the tape.

REGISTERED 

Solver variables are registered on the tape.

DEPENDENCIES 

Derived values (e.g. gradients) are set.

OBJECTIVE_FUNCTION 

Objective function is set.

TRANSFER 

Solution data is transferred between coupled solvers of different physical zones (giving cross contributions).

ITERATION_READY 

Until here, all derivative information is gathered so that it can be connected to a solver update evaluation.

Constructor & Destructor Documentation

◆ CDiscAdjMultizoneDriver()

CDiscAdjMultizoneDriver::CDiscAdjMultizoneDriver ( char *  confFile,
unsigned short  val_nZone,
SU2_Comm  MPICommunicator 
)

Constructor of the class.

Parameters
[in]confFile- Configuration file name.
[in]val_nZone- Total number of zones.
[in]MPICommunicator- MPI communicator for SU2.

◆ ~CDiscAdjMultizoneDriver()

CDiscAdjMultizoneDriver::~CDiscAdjMultizoneDriver ( void  )
override

Destructor of the class.

Member Function Documentation

◆ AddExternalToSolution()

void CDiscAdjMultizoneDriver::AddExternalToSolution ( unsigned short  iZone)
protected

Add External_Old vector to Solution.

Parameters
[in]iZone- Zone index.

◆ AddSolutionToExternal()

void CDiscAdjMultizoneDriver::AddSolutionToExternal ( unsigned short  iZone)
protected

Add Solution vector to External.

Parameters
[in]iZone- Zone index.

◆ ComputeAdjoints()

void CDiscAdjMultizoneDriver::ComputeAdjoints ( unsigned short  iZone,
bool  eval_transfer = true 
)
protected

Summary of all routines to evaluate the adjoints in iZone.

Parameters
[in]iZone- Zone in which adjoints are evaluated depending on their (preceding) seeding.
[in]eval_transfer- Evaluate adjoints of transfer and mesh deformation routines.

◆ DirectIteration()

void CDiscAdjMultizoneDriver::DirectIteration ( unsigned short  iZone,
RECORDING  kind_recording 
)
protected

Run one direct iteration in a zone.

Parameters
[in]iZone- Zone in which we run an iteration.
[in]kind_recording- Kind of variables with respect to which we are recording.

◆ EvaluateObjectiveFunctionGradient()

bool CDiscAdjMultizoneDriver::EvaluateObjectiveFunctionGradient ( )
protected

Evaluate the gradient of the objective function and add to "External".

Returns
"True" if the gradient is numerically 0.

◆ EvaluateSensitivities()

void CDiscAdjMultizoneDriver::EvaluateSensitivities ( unsigned long  Iter,
bool  force_writing 
)
protected

Evaluate sensitivites for the current adjoint solution and output files.

Parameters
[in]Iter- Current outer or time iteration.
[in]force_writing- Force file output.

◆ GetAdjointRHS()

template<class Container >
void CDiscAdjMultizoneDriver::GetAdjointRHS ( unsigned short  iZone,
Container &  rhs 
) const
inlineprotected

Get the external of all adjoint solvers in a zone.

Parameters
[in]iZone- Index of the zone.
[out]rhs- Object with interface (iPoint,iVar), set to -external.

◆ GetTimeConvergence()

bool CDiscAdjMultizoneDriver::GetTimeConvergence ( ) const
inlineoverrideprotectedvirtual

gets Convergence on physical time scale, (deactivated in adjoint case)

Returns
false

Reimplemented from CMultizoneDriver.

◆ HandleDataTransfer()

void CDiscAdjMultizoneDriver::HandleDataTransfer ( )
protected

Transfer data between zones and update grids when required.

◆ InitializeCrossTerms()

void CDiscAdjMultizoneDriver::InitializeCrossTerms ( )
protected

Setup the matrix of cross-terms. Allocate necessary memory and initialize to zero.

◆ Iterate()

bool CDiscAdjMultizoneDriver::Iterate ( unsigned short  iZone,
unsigned long  iInnerIter,
bool  KrylovMode = false 
)

Run one inner iteration for a given zone.

Returns
The result of "monitor".

◆ KrylovInnerIters()

void CDiscAdjMultizoneDriver::KrylovInnerIters ( unsigned short  iZone)
protected

Run inner iterations using a Krylov method (GMRES atm).

◆ Preprocess()

void CDiscAdjMultizoneDriver::Preprocess ( unsigned long  TimeIter)
overridevirtual

Preprocess the multizone iteration.

Reimplemented from CDriver.

◆ Run()

void CDiscAdjMultizoneDriver::Run ( void  )
overridevirtual

[Overload] Run an discrete adjoint update of all solvers within multiple zones.

Reimplemented from CDriverBase.

◆ Set_BGSSolution_k_To_Solution()

void CDiscAdjMultizoneDriver::Set_BGSSolution_k_To_Solution ( unsigned short  iZone)
protected

Puts Solution into BGSSolution_k.

Parameters
[in]iZone- Zone index.

◆ Set_Solution_To_BGSSolution_k()

void CDiscAdjMultizoneDriver::Set_Solution_To_BGSSolution_k ( unsigned short  iZone)
protected

Puts BGSSolution_k back into Solution.

Parameters
[in]iZone- Zone index.

◆ SetAdjObjFunction()

void CDiscAdjMultizoneDriver::SetAdjObjFunction ( )
protected

Initialize the adjoint value of the objective function.

◆ SetExternalToDualTimeDer()

void CDiscAdjMultizoneDriver::SetExternalToDualTimeDer ( )
protected

Puts dual time derivative vector to External.

◆ SetObjFunction()

void CDiscAdjMultizoneDriver::SetObjFunction ( RECORDING  kind_recording)
protected

Set the objective function.

Parameters
[in]kind_recording- Kind of variables with respect to which we are recording.

◆ SetRecording()

void CDiscAdjMultizoneDriver::SetRecording ( RECORDING  kind_recording,
Kind_Tape  tape_type,
unsigned short  record_zone 
)
protected

Record one iteration of the primal problem within each zone.

Parameters
[in]kind_recording- Kind of variables with respect to which we are recording.
[in]tape_type- indicator which part of a solution update will be recorded.
[in]record_zone- zone where solution update will be recorded.

START

REGISTERED

DEPENDENCIES

OBJECTIVE_FUNCTION

TRANSFER

enter_zone

leave_zone

◆ SetResidual_BGS()

void CDiscAdjMultizoneDriver::SetResidual_BGS ( unsigned short  iZone)
protected

Compute BGS residuals.

Parameters
[in]iZone- Zone where solver residuals are computed.

◆ SetSolutionOldToSolution()

void CDiscAdjMultizoneDriver::SetSolutionOldToSolution ( unsigned short  iZone)
protected

Puts Solution into SolutionOld.

Parameters
[in]iZone- Zone index.

◆ StartSolver()

void CDiscAdjMultizoneDriver::StartSolver ( )
overridevirtual

[Overload] Launch the computation for discrete adjoint multizone problems.

Reimplemented from CDriver.

◆ TapeTest()

void CDiscAdjMultizoneDriver::TapeTest ( )
protected

Launch the tape test run of the discrete adjoint multizone solver.

◆ TapeTestGatherErrors()

int CDiscAdjMultizoneDriver::TapeTestGatherErrors ( AD::DebugControl &  debug_control) const
protected

Get the total error count after a tape test run of the discrete adjoint multizone solver.

Parameters
[in]debug_control- DebugControl from which this rank's contribution to the total error count is read.
Returns
The total error count across all ranks.

◆ UpdateCrossTerm()

void CDiscAdjMultizoneDriver::UpdateCrossTerm ( unsigned short  iZone,
unsigned short  jZone 
)
protected

Extract contribution of iZone to jZone with BGS relaxation.

Parameters
[in]iZone- Source zone (the one that was initialized).
[in]jZone- Target zone (the one that transfers to iZone in the primal problem).

Member Data Documentation

◆ AdjRHS

vector<CSysVector<Scalar> > CDiscAdjMultizoneDriver::AdjRHS
protected

◆ AdjSol

vector<CSysVector<Scalar> > CDiscAdjMultizoneDriver::AdjSol
protected

◆ Cross_Terms

vector<vector<vector<su2passivematrix> > > CDiscAdjMultizoneDriver::Cross_Terms
protected

Fixed-Point corrector that can be applied to inner iterations.

◆ direct_iteration

CIteration*** CDiscAdjMultizoneDriver::direct_iteration
protected

Array of pointers to the direct iterations.

◆ direct_nInst

vector<unsigned short> CDiscAdjMultizoneDriver::direct_nInst
protected

Total number of instances in the direct problem.

◆ direct_output

COutput** CDiscAdjMultizoneDriver::direct_output
protected

Array of pointers to the direct outputs.

◆ eval_transfer

bool CDiscAdjMultizoneDriver::eval_transfer = false
protected

Evaluate the transfer section of the tape.

◆ FixPtCorrector

vector<CQuasiNewtonInvLeastSquares<passivedouble> > CDiscAdjMultizoneDriver::FixPtCorrector
protected

Members to use GMRES to drive inner iterations (alternative to quasi-Newton).

◆ Has_Deformation

su2vector<bool> CDiscAdjMultizoneDriver::Has_Deformation
protected

True if iZone has mesh deformation (used for lazy evaluation of TRANSFER tape section).

Individual cross-terms of the coupled problem, 5D array [iZone][jZone][iSol](iPoint,iVar). The column sum, i.e. along all iZones for each jZone, gives the External (total cross-term) for jZone, we need to store all terms to have BGS-type updates with relaxation.

◆ KrylovMinIters

constexpr unsigned long CDiscAdjMultizoneDriver::KrylovMinIters = 3
staticconstexprprotected

◆ KrylovTol

const Scalar CDiscAdjMultizoneDriver::KrylovTol = 0.01
protected

◆ LinSolver

vector<CSysSolve<Scalar> > CDiscAdjMultizoneDriver::LinSolver
protected

◆ nInnerIter

vector<unsigned long> CDiscAdjMultizoneDriver::nInnerIter
protected

Number of inner iterations for each zone.

◆ ObjFunc

su2double CDiscAdjMultizoneDriver::ObjFunc
protected

Value of the objective function.

◆ ObjFunc_Index

AD::Identifier CDiscAdjMultizoneDriver::ObjFunc_Index
protected

Index of the value of the objective function.

◆ RecordingState

RECORDING CDiscAdjMultizoneDriver::RecordingState = RECORDING::CLEAR_INDICES
protected

The kind of recording that the tape currently holds.

◆ wrt_sol_freq

unsigned long CDiscAdjMultizoneDriver::wrt_sol_freq = std::numeric_limits<unsigned long>::max()
protected

File output frequency.


The documentation for this class was generated from the following files: