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

Axisymmetric problems : Viscous source terms and generalised convective source terms and jacobian #1106

Merged
merged 22 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
cbe7143
implementing viscous axisymmetric terms for flow solver: runs but div…
WallyMaier Oct 8, 2020
aecffd5
fixing indices. axisymmetric is operational explicit. validation work…
WallyMaier Oct 8, 2020
ddedd78
fixing spaces, remove print statements
WallyMaier Oct 12, 2020
516da93
Merge remote-tracking branch 'origin/develop' into feature_axi
WallyMaier Nov 13, 2020
d916436
merge in develop and adding in Florian's work
WallyMaier Nov 13, 2020
8b90694
Merge branch 'develop' into feature_axi_general_viscous
FlorianDm Nov 16, 2020
a6a1992
correct viscous terms
FlorianDm Nov 16, 2020
ebef382
space
FlorianDm Nov 16, 2020
52c032b
Merge branch 'develop' into feature_axi_general_viscous
FlorianDm Nov 19, 2020
b6c3b02
addressing PR comments
WallyMaier Nov 20, 2020
b64bbd5
fix and simplify source term in energy eq
FlorianDm Nov 20, 2020
690e918
Merge branch 'feature_axi_general_viscous' of /~https://github.com/su2c…
FlorianDm Nov 20, 2020
0d2ded5
add contribution of turbulence kinetic energy to axisymmetry energy s…
FlorianDm Nov 20, 2020
ccfbc28
attempting to generalize the axisymm formulation
WallyMaier Nov 20, 2020
e394f9b
fix compilation issues
pcarruscag Nov 20, 2020
7a73428
Merge remote-tracking branch 'origin/develop' into feature_axi_genera…
WallyMaier Nov 23, 2020
3eae110
Merge branch 'develop' into feature_axi_general_viscous
WallyMaier Nov 24, 2020
f61da0a
allow laminar simulations
WallyMaier Nov 25, 2020
048d37f
Merge branch 'develop' into feature_axi_general_viscous
WallyMaier Dec 2, 2020
ac408b5
Merge branch 'develop' into feature_axi_general_viscous
FlorianDm Dec 4, 2020
ec7839e
Merge branch 'develop' into feature_axi_general_viscous
WallyMaier Dec 11, 2020
b391d27
Merge branch 'develop' into feature_axi_general_viscous
WallyMaier Dec 14, 2020
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
3 changes: 2 additions & 1 deletion Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const su2double EPS = 1.0E-16; /*!< \brief Error scale. */
const su2double TURB_EPS = 1.0E-16; /*!< \brief Turbulent Error scale. */

const su2double ONE2 = 0.5; /*!< \brief One divided by two. */
const su2double ONE3 = 1.0 / 3.0; /*!< \brief One divided by three. */
const su2double TWO3 = 2.0 / 3.0; /*!< \brief Two divided by three. */
const su2double FOUR3 = 4.0 / 3.0; /*!< \brief Four divided by three. */

Expand Down Expand Up @@ -2180,7 +2181,7 @@ enum MPI_QUANTITIES {
SOLUTION_FEA_OLD = 26, /*!< \brief FEA solution old communication. */
MESH_DISPLACEMENTS = 27, /*!< \brief Mesh displacements at the interface. */
SOLUTION_TIME_N = 28, /*!< \brief Solution at time n. */
SOLUTION_TIME_N1 = 29, /*!< \brief Solution at time n-1. */
SOLUTION_TIME_N1 = 29, /*!< \brief Solution at time n-1. */
PRIMITIVE = 30 /*!< \brief Primitive solution communication. */
};

Expand Down
15 changes: 8 additions & 7 deletions SU2_CFD/include/numerics/CNumerics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ class CNumerics {
**TurbPsi_Grad_i, /*!< \brief Gradient of adjoint turbulent variables at point i. */
**TurbPsi_Grad_j; /*!< \brief Gradient of adjoint turbulent variables at point j. */
su2double
*AuxVar_Grad_i, /*!< \brief Gradient of an auxiliary variable at point i. */
*AuxVar_Grad_j; /*!< \brief Gradient of an auxiliary variable at point i. */
**AuxVar_Grad_i, /*!< \brief Gradient of an auxiliary variable at point i. */
**AuxVar_Grad_j; /*!< \brief Gradient of an auxiliary variable at point i. */
const su2double *RadVar_Source; /*!< \brief Source term from the radiative heat transfer equation. */
su2double
*Coord_i, /*!< \brief Cartesians coordinates of point i. */
Expand Down Expand Up @@ -482,12 +482,13 @@ class CNumerics {

/*!
* \brief Set the gradient of the auxiliary variables.
* \param[in] val_auxvargrad_i - Gradient of the auxiliary variable at point i.
* \param[in] val_auxvargrad_j - Gradient of the auxiliary variable at point j.
* \param[in] val_auxvar_grad_i - Gradient of the auxiliary variable at point i.
* \param[in] val_auxvar_grad_j - Gradient of the auxiliary variable at point j.
*/
inline void SetAuxVarGrad(su2double *val_auxvargrad_i, su2double *val_auxvargrad_j) {
AuxVar_Grad_i = val_auxvargrad_i;
AuxVar_Grad_j = val_auxvargrad_j;
inline void SetAuxVarGrad(su2double **val_auxvar_grad_i,
su2double **val_auxvar_grad_j) {
AuxVar_Grad_i = val_auxvar_grad_i;
AuxVar_Grad_j = val_auxvar_grad_j;
}

/*!
Expand Down
32 changes: 30 additions & 2 deletions SU2_CFD/include/numerics/flow/flow_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ class CSourceBase_Flow : public CNumerics {
* \ingroup SourceDiscr
* \author F. Palacios
*/
class CSourceAxisymmetric_Flow final : public CSourceBase_Flow {
class CSourceAxisymmetric_Flow : public CSourceBase_Flow {
protected:
bool implicit, viscous;
su2double yinv{0.0};

/*!
* \brief Diffusion residual of the axisymmetric source term.
*/
void ResidualDiffusion();

public:
/*!
* \brief Constructor of the class.
Expand All @@ -74,12 +83,31 @@ class CSourceAxisymmetric_Flow final : public CSourceBase_Flow {
CSourceAxisymmetric_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config);

/*!
* \brief Residual of the rotational frame source term.
* \brief Residual of the axisymmetric source term.
* \param[in] config - Definition of the particular problem.
* \return Lightweight const-view of residual and Jacobian.
*/
ResidualType<> ComputeResidual(const CConfig* config) override;

};

/*!
* \class CSourceGeneralAxisymmetric_Flow
* \brief Class for source term for solving axisymmetric problems for a general (non ideal) fluid.
* \ingroup SourceDiscr
* \author F. Dittmann
*/
class CSourceGeneralAxisymmetric_Flow final : public CSourceAxisymmetric_Flow {
public:

using CSourceAxisymmetric_Flow::CSourceAxisymmetric_Flow;
/*!
* \brief Residual of the general axisymmetric source term.
* \param[in] config - Definition of the particular problem.
* \return Lightweight const-view of residual and Jacobian.
*/
ResidualType<> ComputeResidual(const CConfig* config) override;

};

/*!
Expand Down
7 changes: 7 additions & 0 deletions SU2_CFD/include/solvers/CAdjEulerSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ class CAdjEulerSolver : public CSolver {
*/
inline CVariable* GetBaseClassPointerToNodes() override { return nodes; }

/*!
* \brief Compute the Least Squares gradient of an auxiliar variable on the profile surface.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
*/
void SetAuxVar_Surface_Gradient(CGeometry *geometry, const CConfig *config);

public:

/*!
Expand Down
7 changes: 0 additions & 7 deletions SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,6 @@ class CSolver {
*/
void SetAuxVar_Gradient_LS(CGeometry *geometry, const CConfig *config);

/*!
* \brief Compute the Least Squares gradient of an auxiliar variable on the profile surface.
* \param[in] geometry - Geometrical definition of the problem.
* \param[in] config - Definition of the particular problem.
*/
void SetAuxVar_Surface_Gradient(CGeometry *geometry, const CConfig *config);

/*!
* \brief Add External to Solution vector.
*/
Expand Down
75 changes: 39 additions & 36 deletions SU2_CFD/include/variables/CVariable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class CVariable {
MatrixType Solution_Max; /*!< \brief Max solution for limiter computation. */
MatrixType Solution_Min; /*!< \brief Min solution for limiter computation. */

VectorType AuxVar; /*!< \brief Auxiliar variable for gradient computation. */
MatrixType Grad_AuxVar; /*!< \brief Gradient of the auxiliar variable. */
MatrixType AuxVar; /*!< \brief Auxiliar variable for gradient computation. */
CVectorOfMatrix Grad_AuxVar; /*!< \brief Gradient of the auxilliary variables of the problem. */

VectorType Max_Lambda_Inv; /*!< \brief Maximun inviscid eingenvalue. */
VectorType Max_Lambda_Visc; /*!< \brief Maximun viscous eingenvalue. */
Expand All @@ -105,6 +105,7 @@ class CVariable {
unsigned long nPrimVarGrad = 0; /*!< \brief Number of primitives for which a gradient is computed. */
unsigned long nSecondaryVar = 0; /*!< \brief Number of secondary variables. */
unsigned long nSecondaryVarGrad = 0; /*!< \brief Number of secondaries for which a gradient is computed. */
unsigned long nAuxVar = 0; /*!< \brief Number of auxiliary variables. */

/*--- Only allow default construction by derived classes. ---*/
CVariable() = default;
Expand Down Expand Up @@ -137,6 +138,11 @@ class CVariable {
*/
virtual ~CVariable() = default;

/*!
* \brief Get the number of auxiliary variables.
*/
inline unsigned long GetnAuxVar() const { return nAuxVar; }

/*!
* \brief Set the value of the solution, all variables.
* \param[in] iPoint - Point index.
Expand Down Expand Up @@ -564,65 +570,62 @@ class CVariable {
inline su2double GetLocalCFL(unsigned long iPoint) const { return LocalCFL(iPoint); }

/*!
* \brief Set auxiliar variables, we are looking for the gradient of that variable.
* \param[in] iPoint - Point index.
* \param[in] val_auxvar - Value of the auxiliar variable.
* \brief Get the entire Aux matrix of the problem.
* \return Reference to the aux var matrix.
*/
inline void SetAuxVar(unsigned long iPoint, su2double val_auxvar) { AuxVar(iPoint) = val_auxvar; }
inline const MatrixType& GetAuxVar(void) const { return AuxVar; }

/*!
* \brief Get the value of the auxiliary variable.
* \param[in] iPoint - Point index.
* \return Value of the auxiliary variable.
* \brief Get the Aux var value at Point i, variable j.
*/
inline su2double GetAuxVar(unsigned long iPoint) const { return AuxVar(iPoint); }
inline su2double GetAuxVar(unsigned long iPoint, unsigned long iVar = 0) const { return AuxVar(iPoint,iVar); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


/*!
* \brief Get the auxiliary variable.
* \return 2D view of the auxiliary variable.
* \brief Set auxiliary variables.
* \param[in] iPoint - Point index.
* \param[in] iVar - Varriable indexs
* \param[in] val_auxvar - Value of the auxiliar variable.
*/
inline C2DDummyLastView<const VectorType> GetAuxVar(void) const {
return C2DDummyLastView<const VectorType>(AuxVar);
inline void SetAuxVar(unsigned long iPoint, unsigned long iVar, const su2double auxvar) {
AuxVar(iPoint,iVar) = auxvar;
}

/*!
* \brief Set the value of the auxiliary variable gradient.
* \brief Set value of auxillary gradients.
* \param[in] iPoint - Point index.
* \param[in] iVar - Index of the variable.
* \param[in] iDim - Index of the dimension.
* \param[in] val_gradient - Value of the gradient for the index <i>iDim</i>.
* \param[in] value - Value of the gradient.
*/
inline void SetAuxVarGradient(unsigned long iPoint, unsigned long iDim, su2double val_gradient) { Grad_AuxVar(iPoint,iDim) = val_gradient; }
inline void SetAuxVarGradient(unsigned long iPoint, unsigned long iVar, unsigned long iDim, su2double value) {
Grad_AuxVar(iPoint,iVar,iDim) = value;
}

/*!
* \brief Add a value to the auxiliary variable gradient.
* \param[in] iPoint - Point index.
* \param[in] iDim - Index of the dimension.
* \param[in] val_value - Value of the gradient to be added for the index <i>iDim</i>.
* \brief Get the gradient of the auxilary variables.
* \return Reference to gradient.
*/
inline void AddAuxVarGradient(unsigned long iPoint, unsigned long iDim, su2double val_value) { Grad_AuxVar(iPoint,iDim) += val_value;}
inline CVectorOfMatrix& GetAuxVarGradient(void) { return Grad_AuxVar; }

/*!
* \brief Get the gradient of the auxiliary variable.
* \brief Get the value of the auxilliary gradient.
* \param[in] iPoint - Point index.
* \return Value of the gradient of the auxiliary variable.
*/
inline su2double *GetAuxVarGradient(unsigned long iPoint) { return Grad_AuxVar[iPoint]; }

/*!
* \brief Get the gradient of the auxiliary variable.
* \return 3D view of the gradient of the auxiliary variable.
* \param[in] iVar - Index of the variable.
* \param[in] iDim - Index of the dimension.
* \return Value of the solution gradient.
*/
inline C3DDummyMiddleView<MatrixType> GetAuxVarGradient() {
return C3DDummyMiddleView<MatrixType>(Grad_AuxVar);
inline su2double GetAuxVarGradient(unsigned long iPoint, unsigned long iVar, unsigned long iDim) const {
return Grad_AuxVar(iPoint,iVar,iDim);
}

/*!
* \brief Get the gradient of the auxiliary variable.
* \brief Get the value of the auxilliary gradient.
* \param[in] iPoint - Point index.
* \param[in] iDim - Index of the dimension.
* \return Value of the gradient of the auxiliary variable for the dimension <i>iDim</i>.
* \return Value of the solution gradient.
*/
inline su2double GetAuxVarGradient(unsigned long iPoint, unsigned long iDim) const { return Grad_AuxVar(iPoint,iDim); }
inline su2double** GetAuxVarGradient(unsigned long iPoint) {
return Grad_AuxVar[iPoint];
}

/*!
* \brief Add a value to the truncation error.
Expand Down
4 changes: 3 additions & 1 deletion SU2_CFD/src/drivers/CDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1865,8 +1865,10 @@ void CDriver::Numerics_Preprocessing(CConfig *config, CGeometry **geometry, CSol
else if (config->GetAxisymmetric() == YES) {
if (incompressible)
numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceIncAxisymmetric_Flow(nDim, nVar_Flow, config);
else
else if (ideal_gas)
numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceAxisymmetric_Flow(nDim, nVar_Flow, config);
else
numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceGeneralAxisymmetric_Flow(nDim, nVar_Flow, config);
}
else if (config->GetGravityForce() == YES) {
numerics[iMGlevel][FLOW_SOL][source_first_term] = new CSourceGravity(nDim, nVar_Flow, config);
Expand Down
Loading