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

Dividing Iteration Classes #1015

Merged
merged 18 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
1 change: 0 additions & 1 deletion SU2_CFD/include/SU2_CFD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include "../../Common/include/grid_movement_structure.hpp"
#include "../../Common/include/CConfig.hpp"
#include "../include/definition_structure.hpp"
#include "../include/iteration_structure.hpp"
#include "../include/interfaces/CInterface.hpp"

using namespace std;
3 changes: 2 additions & 1 deletion SU2_CFD/include/drivers/CDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include "../../../Common/include/mpi_structure.hpp"

#include "../iteration_structure.hpp"
#include "../integration/CIntegration.hpp"
#include "../solvers/CSolver.hpp"
#include "../interfaces/CInterface.hpp"
Expand All @@ -42,6 +41,8 @@ using namespace std;

class COutputLegacy;
class CInterpolator;
class CIteration;
class COutput;

/*!
* \class CDriver
Expand Down
4 changes: 1 addition & 3 deletions SU2_CFD/include/drivers/CMultizoneDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,5 @@ class CMultizoneDriver : public CDriver {
* \brief Returns whether all specified windowed-time-averaged ouputs have been converged
* \return Boolean indicating whether the problem is converged.
*/
inline virtual bool GetTimeConvergence() const{
return driver_output->GetTimeConvergence();
}
virtual bool GetTimeConvergence() const;
};
5 changes: 1 addition & 4 deletions SU2_CFD/include/drivers/CSinglezoneDriver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ class CSinglezoneDriver : public CDriver {
* \brief Returns whether all specified windowed-time-averaged ouputs have been converged
* \return Boolean indicating whether the problem is converged.
*/
inline virtual bool GetTimeConvergence() const{
return output_container[ZONE_0]->GetTimeConvergence();
}

virtual bool GetTimeConvergence() const;

/*!
* \brief Runtime_Parsing
Expand Down
86 changes: 86 additions & 0 deletions SU2_CFD/include/iteration/CAdjFluidIteration.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*!
* \file CAdjFluidIteration.hpp
* \brief Headers of the iteration classes used by SU2_CFD.
* Each CIteration class represents an available physics package.
* \author F. Palacios, T. Economon
* \version 7.0.5 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
*
* SU2 is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* SU2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "CFluidIteration.hpp"

/*!
* \class CAdjFluidIteration
* \brief Class for driving an iteration of the adjoint fluid system.
* \author T. Economon
*/
class CAdjFluidIteration : public CFluidIteration {
public:
/*!
* \brief Constructor of the class.
* \param[in] config - Definition of the particular problem.
*/
CAdjFluidIteration(const CConfig* config);

/*!
* \brief Destructor of the class.
*/
~CAdjFluidIteration(void) override;
pcarruscag marked this conversation as resolved.
Show resolved Hide resolved

/*!
* \brief Preprocessing to prepare for an iteration of the physics.
* \param[in] ??? - Description here.
*/
void Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Perform a single iteration of the adjoint fluid system.
* \param[in] output - Pointer to the COutput class.
* \param[in] integration - Container vector with all the integration methods.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] surface_movement - Surface movement classes of the problem.
* \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
*/
void Iterate(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Updates the containers for the adjoint fluid system.
* \param[in] ??? - Description here.
*/
void Update(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;
};

240 changes: 240 additions & 0 deletions SU2_CFD/include/iteration/CDiscAdjFEAIteration.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
/*!
* \file CFEAIteration.hpp
* \brief Headers of the iteration classes used by SU2_CFD.
* Each CIteration class represents an available physics package.
* \author F. Palacios, T. Economon
* \version 7.0.5 "Blackbird"
*
* SU2 Project Website: https://su2code.github.io
*
* The SU2 Project is maintained by the SU2 Foundation
* (http://su2foundation.org)
*
* Copyright 2012-2020, SU2 Contributors (cf. AUTHORS.md)
*
* SU2 is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* SU2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "CIteration.hpp"

class CFEAIteration;

/*!
* \class CDiscAdjFEAIteration
* \brief Class for driving an iteration of the discrete adjoint FEM system.
* \author R. Sanchez
*/
class CDiscAdjFEAIteration : public CIteration {
private:
CFEAIteration* fem_iteration; /*!< \brief Pointer to the primal iteration class. */
unsigned short CurrentRecording; /*!< \brief Stores the current status of the recording. */

public:
/*!
* \brief Constructor of the class.
* \param[in] config - Definition of the particular problem.
*/
CDiscAdjFEAIteration(const CConfig* config);

/*!
* \brief Destructor of the class.
*/
~CDiscAdjFEAIteration(void) override;

/*!
* \brief Preprocessing to prepare for an iteration of the physics.
* \param[in] output - Pointer to the COutput class.
* \param[in] integration - Container vector with all the integration methods.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] surface_movement - Surface movement classes of the problem.
* \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
*/
void Preprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Perform a single iteration of the adjoint mean flow system.
* \param[in] output - Pointer to the COutput class.
* \param[in] integration - Container vector with all the integration methods.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] surface_movement - Surface movement classes of the problem.
* \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
*/
void Iterate(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Updates the containers for the discrete adjoint mean flow system.
* \param[in] output - Pointer to the COutput class.
* \param[in] integration - Container vector with all the integration methods.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] surface_movement - Surface movement classes of the problem.
* \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
*/
void Update(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Monitors the convergence and other metrics for the discrete adjoint mean flow system.
* \param[in] output - Pointer to the COutput class.
* \param[in] integration - Container vector with all the integration methods.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] surface_movement - Surface movement classes of the problem.
* \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
*/
bool Monitor(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Postprocesses the discrete adjoint mean flow system before heading to another physics system or the next
* iteration. \param[in] output - Pointer to the COutput class. \param[in] integration - Container vector with all the
* integration methods. \param[in] geometry - Geometrical definition of the problem. \param[in] solver - Container
* vector with all the solutions. \param[in] numerics - Description of the numerical method (the way in which the
* equations are solved). \param[in] config - Definition of the particular problem. \param[in] surface_movement -
* Surface movement classes of the problem. \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
*/
void Postprocess(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst) override;

/*!
* \brief Registers all input variables of the FEM iteration.
* \param[in] solver - Container vector with all the solutions.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
* \param[in] iZone - Index of the zone.
* \param[in] kind_recording - Kind of recording, either FEM_VARIABLES or MESH_COORDS
*/
void RegisterInput(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short iZone,
unsigned short iInst, unsigned short kind_recording) override;

/*!
* \brief Registers all output variables of the FEM iteration.
* \param[in] solver - Container vector with all the solutions.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
* \param[in] iZone - Index of the zone.
* \param[in] iInst - Index of the zone.
*/
void RegisterOutput(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short iZone,
unsigned short iInst);
using CIteration::RegisterOutput;

/*!
* \brief Initializes the adjoints of the output variables of the FEM iteration.
* \param[in] solver - Container vector with all the solutions.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
* \param[in] iZone - Index of the zone.
* \param[in] iInst - Index of the zone.
*/
void InitializeAdjoint(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short iZone,
unsigned short iInst) override;

/*!
* \brief Record a single iteration of the direct FEM system.
* \param[in] output - Pointer to the COutput class.
* \param[in] integration - Container vector with all the integration methods.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] surface_movement - Surface movement classes of the problem.
* \param[in] grid_movement - Volume grid movement classes of the problem.
* \param[in] FFDBox - FFD FFDBoxes of the problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
* \param[in] kind_recording - The kind of recording (geometry or flow).
*/
void SetRecording(COutput* output, CIntegration**** integration, CGeometry**** geometry, CSolver***** solver,
CNumerics****** numerics, CConfig** config, CSurfaceMovement** surface_movement,
CVolumetricMovement*** grid_movement, CFreeFormDefBox*** FFDBox, unsigned short val_iZone,
unsigned short val_iInst, unsigned short kind_recording);

/*!
* \brief Record a single iteration of the direct FEM system.
* \param[in] solver - Container vector with all the solutions.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
* \param[in] kind_recording - The kind of recording (geometry or flow).
*/

void SetRecording(CSolver***** solver, CGeometry**** geometry, CConfig** config, unsigned short val_iZone,
unsigned short val_iInst, unsigned short kind_recording) override;

/*!
* \brief Compute necessary variables that depend on the variables in the numerics (E, Nu...)
* \param[in] solver - Container vector with all the solutions.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] numerics - Description of the numerical method (the way in which the equations are solved).
* \param[in] config - Definition of the particular problem.
* \param[in] iZone - Index of the zone.
* \param[in] iInst - Index of the zone.
* \param[in] kind_recording - The kind of recording (geometry or flow).
*/
void SetDependencies(CSolver***** solver, CGeometry**** geometry, CNumerics****** numerics, CConfig** config,
unsigned short iZone, unsigned short iInst, unsigned short kind_recording) override;

/*!
* \brief load solution for dynamic problems
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] solver - Container vector with all the solutions.
* \param[in] config - Definition of the particular problem.
* \param[in] val_iZone - Index of the zone.
* \param[in] val_iInst - Index of the instance.
* \param[in] val_DirectIter - Direct iteration to load.
*/
void LoadDynamic_Solution(CGeometry**** geometry, CSolver***** solver, CConfig** config, unsigned short val_iZone,
unsigned short val_iInst, int val_DirectIter) override;
};
Loading