-
Notifications
You must be signed in to change notification settings - Fork 918
Fix bug in SA-neg diffusion term (and generalize indices of flow variables for use by scalar solvers and numerics) #1392
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
294deb1
initial commit towards generalized solver indices+ nemo turb
WallyMaier 77dcc80
Update SU2_CFD/include/variables/CEulerVariable.hpp
pcarruscag f6dfac8
Merge remote-tracking branch 'origin/develop' into feature_NEMO_turbu…
WallyMaier bb35691
Update incomp and nemo index structure
WallyMaier 4b604b3
Merge remote-tracking branch 'upstream/develop' into feature_NEMO_tur…
pcarruscag 3213f85
put the code in a compilable state
pcarruscag 15a6915
use the index classes in the variables
pcarruscag ac3f474
using the indices in scalar convection
pcarruscag 9790d11
viscous scalar and turbulent numerics
pcarruscag 60eed7c
fix old bug in SA-neg diffusion and abstract "velocity gradient"
pcarruscag 36282d7
update regressions after bug fix
pcarruscag 40c5586
turbulence sources
pcarruscag f7d054e
doxygen
pcarruscag 57a736a
Apply suggestions from code review
pcarruscag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,18 +44,24 @@ | |
| * \ingroup ConvDiscr | ||
| * \author C. Pederson, A. Bueno., and A. Campos. | ||
| */ | ||
| template <class FlowIndices> | ||
| class CUpwScalar : public CNumerics { | ||
| protected: | ||
| su2double a0 = 0.0; /*!< \brief The maximum of the face-normal velocity and 0 */ | ||
| su2double a1 = 0.0; /*!< \brief The minimum of the face-normal velocity and 0 */ | ||
| su2double* Flux = nullptr; /*!< \brief Final result, diffusive flux/residual. */ | ||
| su2double** Jacobian_i = nullptr; /*!< \brief Flux Jacobian w.r.t. node i. */ | ||
| su2double** Jacobian_j = nullptr; /*!< \brief Flux Jacobian w.r.t. node j. */ | ||
| enum : unsigned short {MAXNVAR = 8}; | ||
|
|
||
| const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */ | ||
| su2double a0 = 0.0; /*!< \brief The maximum of the face-normal velocity and 0. */ | ||
| su2double a1 = 0.0; /*!< \brief The minimum of the face-normal velocity and 0. */ | ||
| su2double Flux[MAXNVAR]; /*!< \brief Final result, diffusive flux/residual. */ | ||
| su2double* Jacobian_i[MAXNVAR]; /*!< \brief Flux Jacobian w.r.t. node i. */ | ||
| su2double* Jacobian_j[MAXNVAR]; /*!< \brief Flux Jacobian w.r.t. node j. */ | ||
| su2double JacobianBuffer[2*MAXNVAR*MAXNVAR]; /*!< \brief Static storage for the two Jacobians. */ | ||
|
Comment on lines
+55
to
+58
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The great static-ification of SU2 👍 |
||
|
|
||
| const bool implicit = false, incompressible = false, dynamic_grid = false; | ||
|
|
||
| /*! | ||
| * \brief A pure virtual function; Adds any extra variables to AD | ||
| * \brief A pure virtual function. Derived classes must use it to register the additional | ||
| * variables they use as preaccumulation inputs, e.g. the density for SST. | ||
| */ | ||
| virtual void ExtraADPreaccIn() = 0; | ||
|
|
||
|
|
@@ -69,21 +75,65 @@ class CUpwScalar : public CNumerics { | |
| public: | ||
| /*! | ||
| * \brief Constructor of the class. | ||
| * \param[in] val_nDim - Number of dimensions of the problem. | ||
| * \param[in] val_nVar - Number of variables of the problem. | ||
| * \param[in] ndim - Number of dimensions of the problem. | ||
| * \param[in] nvar - Number of variables of the problem. | ||
| * \param[in] config - Definition of the particular problem. | ||
| */ | ||
| CUpwScalar(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config); | ||
|
|
||
| /*! | ||
| * \brief Destructor of the class. | ||
| */ | ||
| ~CUpwScalar(void) override; | ||
| CUpwScalar(unsigned short ndim, unsigned short nvar, const CConfig* config) | ||
| : CNumerics(ndim, nvar, config), | ||
| idx(ndim, config->GetnSpecies()), | ||
TobiKattmann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| implicit(config->GetKind_TimeIntScheme_Turb() == EULER_IMPLICIT), | ||
| incompressible(config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE), | ||
| dynamic_grid(config->GetDynamic_Grid()) { | ||
| if (nVar > MAXNVAR) { | ||
| SU2_MPI::Error("Static arrays are too small.", CURRENT_FUNCTION); | ||
| } | ||
| for (unsigned short iVar = 0; iVar < nVar; iVar++) { | ||
| Jacobian_i[iVar] = &JacobianBuffer[iVar * nVar]; | ||
| Jacobian_j[iVar] = &JacobianBuffer[iVar * nVar + MAXNVAR * MAXNVAR]; | ||
| } | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Compute the scalar upwind flux between two nodes i and j. | ||
| * \param[in] config - Definition of the particular problem. | ||
| * \return A lightweight const-view (read-only) of the residual/flux and Jacobians. | ||
| */ | ||
| ResidualType<> ComputeResidual(const CConfig* config) override; | ||
| CNumerics::ResidualType<> ComputeResidual(const CConfig* config) final { | ||
| AD::StartPreacc(); | ||
| AD::SetPreaccIn(Normal, nDim); | ||
| AD::SetPreaccIn(ScalarVar_i, nVar); | ||
| AD::SetPreaccIn(ScalarVar_j, nVar); | ||
| if (dynamic_grid) { | ||
| AD::SetPreaccIn(GridVel_i, nDim); | ||
| AD::SetPreaccIn(GridVel_j, nDim); | ||
| } | ||
| AD::SetPreaccIn(&V_i[idx.Velocity()], nDim); | ||
| AD::SetPreaccIn(&V_j[idx.Velocity()], nDim); | ||
|
|
||
| ExtraADPreaccIn(); | ||
|
|
||
| su2double q_ij = 0.0; | ||
| if (dynamic_grid) { | ||
| for (unsigned short iDim = 0; iDim < nDim; iDim++) { | ||
| su2double Velocity_i = V_i[iDim + idx.Velocity()] - GridVel_i[iDim]; | ||
| su2double Velocity_j = V_j[iDim + idx.Velocity()] - GridVel_j[iDim]; | ||
| q_ij += 0.5 * (Velocity_i + Velocity_j) * Normal[iDim]; | ||
| } | ||
| } else { | ||
| for (unsigned short iDim = 0; iDim < nDim; iDim++) { | ||
| q_ij += 0.5 * (V_i[iDim + idx.Velocity()] + V_j[iDim + idx.Velocity()]) * Normal[iDim]; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| } | ||
| } | ||
|
|
||
| a0 = 0.5 * (q_ij + fabs(q_ij)); | ||
| a1 = 0.5 * (q_ij - fabs(q_ij)); | ||
|
|
||
| FinishResidualCalc(config); | ||
|
|
||
| AD::SetPreaccOut(Flux, nVar); | ||
| AD::EndPreacc(); | ||
|
|
||
| return ResidualType<>(Flux, Jacobian_i, Jacobian_j); | ||
| } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.