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

Fix adjoint for streamwise periodic massflow + General handling of adjoints of additional solution variables #1536

Merged
merged 47 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
629dd1d
Move SP pressure drop update to the Source_residual.
TobiKattmann Feb 4, 2022
a4da54c
Merge remote-tracking branch 'origin/develop' into feature_StreamPer_…
TobiKattmann Feb 4, 2022
0417812
Merge branch 'develop' into feature_StreamPer_massflow_PlzWörkDisTime
TobiKattmann Feb 4, 2022
1836f11
Treat streamw.per. dp like a solution var in the adjoint solver.
TobiKattmann Feb 6, 2022
1e16ffd
Merge branch 'feature_StreamPer_massflow_PlzWörkDisTime' of https://g…
TobiKattmann Feb 6, 2022
dd3dc5a
Update value using += instead of repeating var
TobiKattmann Feb 6, 2022
ce164a2
Make pressure-drop adjoint work with mpi. Do not allreduce Adjoint_dp.
TobiKattmann Feb 6, 2022
e3da0cb
Merge branch 'feature_StreamPer_massflow_PlzWörkDisTime' of https://g…
TobiKattmann Feb 6, 2022
5120764
Merge branch 'develop' into feature_StreamPer_massflow_PlzWörkDisTime
TobiKattmann Feb 7, 2022
55bdc8c
Merge branch 'develop' into feature_StreamPer_massflow_PlzWörkDisTime
TobiKattmann Feb 8, 2022
d42692f
First push for correct Multizone pressure-drop adjoint. Not workin yet.
TobiKattmann Feb 9, 2022
fa7cbb0
Add HistOutput for Adjoint_DP.
TobiKattmann Feb 9, 2022
5a1b542
Merge remote-tracking branch 'origin/develop' into feature_StreamPer_…
TobiKattmann Feb 9, 2022
11774ce
Merge branch 'feature_StreamPer_massflow_PlzWörkDisTime' of https://g…
TobiKattmann Feb 9, 2022
8b02b9a
Replace hardcoded ADJFLOW_SOL index with less hardcoded one.
TobiKattmann Feb 9, 2022
44bc57b
Add OF/External contribution for pressure-drop adjoint.
TobiKattmann Feb 9, 2022
8fe730b
Update reg test val after changing sp massflow implementation.
TobiKattmann Feb 10, 2022
a73f6c4
Add adjoint pressure drop testcase
TobiKattmann Feb 10, 2022
fadd23d
Implement Extra adjoint equation in a more generic way.
TobiKattmann Feb 13, 2022
cbd17e2
Merge remote-tracking branch 'origin/develop' into feature_StreamPer_…
TobiKattmann Feb 13, 2022
44a2b26
Cleanup and Removing old bits
TobiKattmann Feb 14, 2022
78e465d
Move SolExtra-ExternalExra from driver to Solver method.
TobiKattmann Feb 14, 2022
d745e13
Pass containers by ref + fix typo
TobiKattmann Feb 14, 2022
9dd5d6f
Don't pass vector by value
TobiKattmann Feb 14, 2022
fab7a4d
Make Addresses an std::vector to have a push_back
TobiKattmann Feb 14, 2022
7ff0655
Move Set/Restore BGS_k solution out of the driver.
TobiKattmann Feb 14, 2022
ef6bbc4
Dont set BGS_k solution in 'ComputeResiual_Multizone'
TobiKattmann Feb 14, 2022
26df373
Extra Adj Solution new impl: No Index or Adresses arrays
TobiKattmann Feb 24, 2022
9b51dd6
Updates: Remove DiscAdj layer for Set/GetAdjoint and simpl of primal …
TobiKattmann Feb 24, 2022
fe218ce
Remove now unnecessary fields
TobiKattmann Feb 24, 2022
6d3de4e
Remove superfluous sol_direct container
TobiKattmann Feb 24, 2022
e995a55
Add some method comemnts
TobiKattmann Feb 24, 2022
51fdffc
Merge branch 'feature_StreamPer_massflow_PlzWörkDisTime' of https://g…
TobiKattmann Feb 24, 2022
26a5d27
Fix to assure that primal runs properly
TobiKattmann Feb 24, 2022
8d53c5a
Add more comments
TobiKattmann Feb 24, 2022
bdf85e2
Update the extra adjoint output.
TobiKattmann Feb 24, 2022
75012f0
Remove unnecessary function
TobiKattmann Feb 24, 2022
f5a0275
Apply suggestions from code review
TobiKattmann Feb 24, 2022
c50405d
Fix build, missing switch away from VectorType
TobiKattmann Feb 24, 2022
f331b2a
Add a const sister method.
TobiKattmann Feb 24, 2022
ef02b89
Folder rename
TobiKattmann Feb 25, 2022
9e8c2f2
Revert regression.yml to develop Testcases
TobiKattmann Feb 25, 2022
a3d698e
Update filepath for regression test
TobiKattmann Feb 25, 2022
d510f0e
Update date in regression test
TobiKattmann Feb 25, 2022
01eb182
Merge remote-tracking branch 'origin/develop' into feature_StreamPer_…
TobiKattmann Feb 25, 2022
eb7328a
make the extra allocation more generic
pcarruscag Feb 25, 2022
4784c30
Rename a method to reflect its purpose
TobiKattmann Feb 26, 2022
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 @@ -92,7 +92,7 @@ jobs:
uses: docker://su2code/test-su2:20200303
with:
# -t <Tutorials-branch> -c <Testcases-branch>
args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}}
args: -b ${{github.ref}} -t develop -c feature_StreamPer_massflow_itWorksDisTime=D -s ${{matrix.testscript}}
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
unit_tests:
runs-on: ubuntu-latest
name: Unit Tests
Expand Down
2 changes: 2 additions & 0 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,8 @@ struct StreamwisePeriodicValues {
su2double Streamwise_Periodic_MassFlow; /*!< \brief Value of current massflow [kg/s] which results in a delta p and therefore an artificial body force vector. */
su2double Streamwise_Periodic_IntegratedHeatFlow; /*!< \brief Value of of the net sum of heatflow [W] into the domain. */
su2double Streamwise_Periodic_InletTemperature; /*!< \brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */
su2double Streamwise_Periodic_BoundaryArea; /*!< \brief Global Surface area of the streamwise periodic interface. */
su2double Streamwise_Periodic_AvgDensity; /*!< \brief Area avg density on the periodic interface. */
};

/*!
Expand Down
2 changes: 0 additions & 2 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4803,8 +4803,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("A MARKER_PERIODIC pair has to be set with KIND_STREAMWISE_PERIODIC != NONE.", CURRENT_FUNCTION);
if (Energy_Equation && Streamwise_Periodic_Temperature && nMarker_Isothermal != 0)
SU2_MPI::Error("No MARKER_ISOTHERMAL marker allowed with STREAMWISE_PERIODIC_TEMPERATURE= YES, only MARKER_HEATFLUX & MARKER_SYM.", CURRENT_FUNCTION);
if (DiscreteAdjoint && Kind_Streamwise_Periodic == ENUM_STREAMWISE_PERIODIC::MASSFLOW)
SU2_MPI::Error("Discrete Adjoint currently not validated for prescribed MASSFLOW.", CURRENT_FUNCTION);
if (Ref_Inc_NonDim != DIMENSIONAL)
SU2_MPI::Error("Streamwise Periodicity only works with \"INC_NONDIM= DIMENSIONAL\", the nondimensionalization with source terms doesn;t work in general.", CURRENT_FUNCTION);
if (Axisymmetric)
Expand Down
30 changes: 26 additions & 4 deletions SU2_CFD/include/solvers/CIncEulerSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class CIncEulerSolver : public CFVMFlowSolverBase<CIncEulerVariable, ENUM_REGIME::INCOMPRESSIBLE> {
protected:
vector<CFluidModel*> FluidModel; /*!< \brief fluid model used in the solver. */
StreamwisePeriodicValues SPvals;
StreamwisePeriodicValues SPvals, SPvalsUpdated;

/*!
* \brief Preprocessing actions common to the Euler and NS solvers.
Expand Down Expand Up @@ -395,8 +395,30 @@ class CIncEulerSolver : public CFVMFlowSolverBase<CIncEulerVariable, ENUM_REGIME
inline bool GetHasHybridParallel() const final { return true; }

/*!
* \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat.
* \return Struct holding 4 su2doubles.
* \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat, etc.
* \return Struct holding streamwise periodic values.
*/
StreamwisePeriodicValues GetStreamwisePeriodicValues() const final { return SPvals; }
StreamwisePeriodicValues GetStreamwisePeriodicValues() final { return SPvals; }
StreamwisePeriodicValues GetStreamwisePeriodicValuesUpdated() final { return SPvalsUpdated; }
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

/*!
* \brief Register In- or Output.
* \param[in] input - Boolean whether In- or Output should be registered.
* \param[in] config - The particular config.
*/
void RegisterSolutionExtra(bool input, const CConfig* config);
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

/*!
* \brief Seed the adjoint of the extra solution at the output.
* \param[in] adj_sol - Vector containing the adjoint solution to seed.
* \param[in] config - The particular config.
*/
void SetAdjoint_SolutionExtra(const VectorType& adj_sol, const CConfig* config);
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

/*!
* \brief Extract the adjoint of the extra solution at the input.
* \param[out] adj_sol - Vector to store the adjoint into.
* \param[in] config - The particular config.
*/
void ExtractAdjoint_SolutionExtra(VectorType& adj_sol, const CConfig* config);
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
};
30 changes: 27 additions & 3 deletions SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ using namespace std;

class CSolver {
protected:
using VectorType = C2DContainer<unsigned long, su2double, StorageType::ColumnMajor, 64, DynamicSize, 1>;

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
enum : size_t {OMP_MIN_SIZE = 32}; /*!< \brief Chunk size for small loops. */

int rank, /*!< \brief MPI Rank. */
Expand Down Expand Up @@ -3543,6 +3545,27 @@ class CSolver {
*/
inline virtual void ExtractAdjoint_Solution(CGeometry *geometry, CConfig *config, bool CrossTerm){}

/*!
* \brief Register In- or Output.
* \param[in] input - Boolean whether In- or Output should be registered.
* \param[in] config - The particular config.
*/
virtual void RegisterSolutionExtra(bool input, const CConfig* config) {}

/*!
* \brief Seed the adjoint of the extra solution at the output.
* \param[in] adj_sol - Vector containing the adjoint solution to seed.
* \param[in] config - The particular config.
*/
virtual void SetAdjoint_SolutionExtra(const VectorType& adj_sol, const CConfig* config) {}
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

/*!
* \brief Extract the adjoint of the extra solution at the input.
* \param[out] adj_sol - Vector to store the adjoint into.
* \param[in] config - The particular config.
*/
virtual void ExtractAdjoint_SolutionExtra(VectorType& adj_sol, const CConfig* config) {}

/*!
* \brief A virtual member.
* \param[in] geometry - Geometrical definition of the problem.
Expand Down Expand Up @@ -4281,10 +4304,11 @@ class CSolver {
inline virtual bool GetHasHybridParallel() const { return false; }

/*!
* \brief Get values for streamwise periodc flow: delta P, m_dot, inlet T, integrated heat.
* \return Struct holding 4 su2doubles.
* \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat, etc.
* \return Struct holding streamwise periodic values.
*/
virtual StreamwisePeriodicValues GetStreamwisePeriodicValues() const { return StreamwisePeriodicValues(); }
virtual StreamwisePeriodicValues GetStreamwisePeriodicValues() { return StreamwisePeriodicValues(); }
virtual StreamwisePeriodicValues GetStreamwisePeriodicValuesUpdated() { return StreamwisePeriodicValues(); }

/*!
* \brief Save snapshot or POD data using libROM
Expand Down
2 changes: 0 additions & 2 deletions SU2_CFD/include/variables/CHeatVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
*/
class CHeatVariable final : public CVariable {
protected:
MatrixType Solution_Direct; /*!< \brief Direct solution container for use in the adjoint Heat solver. */

CVectorOfMatrix& Gradient_Reconstruction; /*!< \brief Reference to the gradient of the primitive variables for MUSCL reconstruction for the convective term */
CVectorOfMatrix Gradient_Aux; /*!< \brief Auxiliary structure to store a second gradient for reconstruction, if required. */

Expand Down
31 changes: 31 additions & 0 deletions SU2_CFD/include/variables/CVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ class CVariable {
su2matrix<int> AD_InputIndex; /*!< \brief Indices of Solution variables in the adjoint vector. */
su2matrix<int> AD_OutputIndex; /*!< \brief Indices of Solution variables in the adjoint vector after having been updated. */

VectorType SolutionExtra; /*!< \brief Stores adjoint solution for extra solution variables.
Currently only streamwise periodic pressure-drop for massflow prescribed flows. */
VectorType ExternalExtra; /*!< \brief External storage for the adjoint value (i.e. for the OF mainly */

VectorType SolutionExtra_BGS_k; /*!< \brief Intermediate storage, enables cross term extraction as that is also pushed to Solution. */

protected:
unsigned long nPoint = 0; /*!< \brief Number of points in the domain. */
unsigned long nDim = 0; /*!< \brief Number of dimension of the problem. */
unsigned long nVar = 0; /*!< \brief Number of variables of the problem. */
Expand Down Expand Up @@ -406,6 +413,30 @@ class CVariable {
for(unsigned long iVar = 0; iVar < nVar; iVar++) External(iPoint,iVar) += val_sol[iVar];
}

/*!
* \brief Store the adjoint solution of the extra adjoint into the external container.
*/
void Add_SolutionExtra_To_ExternalExtra() {
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
assert(SolutionExtra.size() == ExternalExtra.size());
for (auto iEntry = 0ul; iEntry < SolutionExtra.size(); iEntry++)
ExternalExtra[iEntry] = SolutionExtra[iEntry];
}

/*!
* \brief Add the external contribution to the solution for the extra adjoint solutions.
*/
void Add_ExternalExtra_To_SolutionExtra() {
assert(SolutionExtra.size() == ExternalExtra.size());
for (auto iEntry = 0ul; iEntry < SolutionExtra.size(); iEntry++)
SolutionExtra[iEntry] += ExternalExtra[iEntry];
}

/*!
* \brief Return the extra adjoint solution.
* \return Reference to extra adjoint solution.
*/
inline VectorType& GetSolutionExtra() { return SolutionExtra; }

/*!
* \brief Update the variables using a conservative format.
* \param[in] iPoint - Point index.
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void CDiscAdjMultizoneDriver::Run() {
/*--- Compute residual from Solution and Solution_BGS_k and update the latter. ---*/

SetResidual_BGS(iZone);

Set_BGSSolution_k_To_Solution(iZone);
}

/*--- Set the multizone output. ---*/
Expand Down
4 changes: 3 additions & 1 deletion SU2_CFD/src/drivers/CMultizoneDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ bool CMultizoneDriver::OuterConvergence(unsigned long OuterIter) {
auto solvers = solver_container[iZone][INST_0][MESH_0];

for (unsigned short iSol = 0; iSol < MAX_SOLS; iSol++){
if (solvers[iSol] != nullptr)
if (solvers[iSol] != nullptr) {
solvers[iSol]->ComputeResidual_Multizone(geometry_container[iZone][INST_0][MESH_0], config_container[iZone]);
solvers[iSol]->GetNodes()->Set_BGSSolution_k();
}
}

/*--- Make sure that everything is loaded into the output container. ---*/
Expand Down
9 changes: 9 additions & 0 deletions SU2_CFD/src/output/CAdjFlowIncOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ void CAdjFlowIncOutput::SetHistoryOutputFields(CConfig *config){
/// DESCRIPTION: Maximum residual of the temperature.
AddHistoryOutput("RMS_ADJ_TEMPERATURE", "rms[A_T]", ScreenOutputFormat::FIXED, "RMS_RES", "Root-mean square residual of the adjoint temperature.", HistoryFieldType::RESIDUAL);

if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) {
AddHistoryOutput("ADJOINT_SolExtra", "Adjoint_SolExtra", ScreenOutputFormat::FIXED, "ADJOINT_SOLEXTRA", "Adjoint value of the first extra Solution.", HistoryFieldType::COEFFICIENT);
}

AddHistoryOutputFields_AdjScalarRMS_RES(config);

if (config->AddRadiation()){
Expand Down Expand Up @@ -205,6 +209,11 @@ void CAdjFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CS
if (config->AddRadiation()){
SetHistoryOutputValue("RMS_ADJ_RAD_ENERGY", log10(adjrad_solver->GetRes_RMS(0)));
}

if (adjflow_solver->GetNodes()->GetSolutionExtra().size() > 0) {
SetHistoryOutputValue("ADJOINT_SOLEXTRA", adjflow_solver->GetNodes()->GetSolutionExtra()[0]);
}

SetHistoryOutputValue("MAX_ADJ_PRESSURE", log10(adjflow_solver->GetRes_Max(0)));
SetHistoryOutputValue("MAX_ADJ_VELOCITY-X", log10(adjflow_solver->GetRes_Max(1)));
SetHistoryOutputValue("MAX_ADJ_VELOCITY-Y", log10(adjflow_solver->GetRes_Max(2)));
Expand Down
8 changes: 8 additions & 0 deletions SU2_CFD/src/solvers/CDiscAdjSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ void CDiscAdjSolver::RegisterSolution(CGeometry *geometry, CConfig *config) {
/*--- Boolean true indicates that an input is registered ---*/
direct_solver->GetNodes()->RegisterSolution(true);

direct_solver->RegisterSolutionExtra(true, config);

if (time_n_needed)
direct_solver->GetNodes()->RegisterSolution_time_n();

Expand Down Expand Up @@ -298,6 +300,8 @@ void CDiscAdjSolver::RegisterOutput(CGeometry *geometry, CConfig *config) {
/*--- Register variables as output of the solver iteration. Boolean false indicates that an output is registered ---*/

direct_solver->GetNodes()->RegisterSolution(false);

direct_solver->RegisterSolutionExtra(false, config);
}

void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *config, bool CrossTerm) {
Expand Down Expand Up @@ -337,6 +341,8 @@ void CDiscAdjSolver::ExtractAdjoint_Solution(CGeometry *geometry, CConfig *confi
}
END_SU2_OMP_FOR

direct_solver->ExtractAdjoint_SolutionExtra(nodes->GetSolutionExtra(), config);

/*--- Residuals and time_n terms are not needed when evaluating multizone cross terms. ---*/
if (CrossTerm) return;

Expand Down Expand Up @@ -468,6 +474,8 @@ void CDiscAdjSolver::SetAdjoint_Output(CGeometry *geometry, CConfig *config) {
direct_solver->GetNodes()->SetAdjointSolution(iPoint,Solution);
}
END_SU2_OMP_FOR

direct_solver->SetAdjoint_SolutionExtra(nodes->GetSolutionExtra(), config);
}

void CDiscAdjSolver::SetSensitivity(CGeometry *geometry, CConfig *config, CSolver*) {
Expand Down
56 changes: 48 additions & 8 deletions SU2_CFD/src/solvers/CIncEulerSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned
string filename_ = "flow";
filename_ = config->GetFilename(filename_, ".meta", Unst_RestartIter);
Read_SU2_Restart_Metadata(geometry, config, adjoint, filename_);
if (rank==MASTER_NODE) cout << "Setting streamwise periodic pressure drop from restart metadata file." << endl;
}

/*--- Set the gamma value ---*/
Expand Down Expand Up @@ -1614,8 +1615,32 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont

} // if turbulent

/*--- Set delta_p, m_dot, inlet_T, integrated_heat ---*/
numerics->SetStreamwisePeriodicValues(SPvals);
if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) {
/*---------------------------------------------------------------------------------------------*/
/*--- Update the Pressure Drop [Pa] for the Momentum source term if Massflow is prescribed. ---*/
/*--- The Pressure drop is iteratively adapted to result in the prescribed Target-Massflow. ---*/
/*---------------------------------------------------------------------------------------------*/

/*--- Compute update to Delta p based on massflow-difference ---*/
const su2double Average_Density_Global = SPvals.Streamwise_Periodic_AvgDensity;
const su2double Area_Global = SPvals.Streamwise_Periodic_BoundaryArea;
const su2double TargetMassFlow = config->GetStreamwise_Periodic_TargetMassFlow() / (config->GetDensity_Ref() * config->GetVelocity_Ref());
const su2double MassFlow_Global = SPvals.Streamwise_Periodic_MassFlow;
const su2double ddP = 0.5 / ( Average_Density_Global * pow(Area_Global, 2)) * (pow(TargetMassFlow, 2) - pow(MassFlow_Global, 2));

/*--- Store updated pressure difference ---*/
const su2double damping_factor = config->GetInc_Outlet_Damping();
SPvalsUpdated = SPvals;
SPvalsUpdated.Streamwise_Periodic_PressureDrop += damping_factor*ddP;
if (!config->GetDiscrete_Adjoint())
SPvals = SPvalsUpdated;

/*--- Set delta_p, m_dot, inlet_T, integrated_heat ---*/
numerics->SetStreamwisePeriodicValues(SPvalsUpdated);
}
else {
numerics->SetStreamwisePeriodicValues(SPvals);
}

AD::StartNoSharedReading();

Expand Down Expand Up @@ -3069,18 +3094,33 @@ void CIncEulerSolver::LoadRestart(CGeometry **geometry, CSolver ***solver, CConf
}

void CIncEulerSolver::SetFreeStream_Solution(const CConfig *config){

unsigned long iPoint;
unsigned short iDim;

SU2_OMP_FOR_STAT(omp_chunk_size)
for (iPoint = 0; iPoint < nPoint; iPoint++){
for (unsigned long iPoint = 0; iPoint < nPoint; iPoint++){
nodes->SetSolution(iPoint,0, Pressure_Inf);
for (iDim = 0; iDim < nDim; iDim++){
for (unsigned short iDim = 0; iDim < nDim; iDim++){
nodes->SetSolution(iPoint,iDim+1, Velocity_Inf[iDim]);
}
nodes->SetSolution(iPoint,nDim+1, Temperature_Inf);
}
END_SU2_OMP_FOR

}

void CIncEulerSolver::RegisterSolutionExtra(bool input, const CConfig* config) {
if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) {
if (input) AD::RegisterInput(SPvals.Streamwise_Periodic_PressureDrop);
else AD::RegisterOutput(SPvalsUpdated.Streamwise_Periodic_PressureDrop);
}
}

void CIncEulerSolver::SetAdjoint_SolutionExtra(const VectorType& adj_sol, const CConfig* config) {
if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) {
SU2_TYPE::SetDerivative(SPvalsUpdated.Streamwise_Periodic_PressureDrop, SU2_TYPE::GetValue(adj_sol[0]));
}
}

void CIncEulerSolver::ExtractAdjoint_SolutionExtra(VectorType& adj_sol, const CConfig* config) {
if (config->GetKind_Streamwise_Periodic() == ENUM_STREAMWISE_PERIODIC::MASSFLOW) {
adj_sol[0] = SU2_TYPE::GetDerivative(SPvals.Streamwise_Periodic_PressureDrop);
}
}
Loading