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

[WIP] Isothermal streamwise periodicity #1799

Draft
wants to merge 46 commits into
base: develop
Choose a base branch
from

Conversation

NAnand-TUD
Copy link

Proposed Changes

Implementation of Streamwise periodic Iso-thermal BCs

Related Work

This is an add-on to the already existing Streamwise periodic flow solver. As a result, there are new source terms which are accounted for in the solution.

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • [X ] I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

@bigfooted
Copy link
Contributor

Hi Nitish, can you remove the codi and opdi changes from the PR? This happens when your local codi/opdi is not up to date, so you should update these submodules.

@NAnand-TUD
Copy link
Author

@bigfooted, Thanks for your comment. I tried but it was not reflected. I see that during the merge with develop the submodule commit keys got updated. Any clues how I can do this ?

@NAnand-TUD
Copy link
Author

All tests are now passing, except CodeFactor. But I guess that was there even before I implemented anything. @bigfooted : Thanks for your commit.

Common/include/CConfig.hpp Outdated Show resolved Hide resolved
SU2_CFD/src/numerics/flow/flow_sources.cpp Show resolved Hide resolved
SU2_CFD/src/output/CFlowIncOutput.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/output/CFlowIncOutput.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CIncNSSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CIncNSSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CIncNSSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CIncNSSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CIncNSSolver.cpp Outdated Show resolved Hide resolved
SU2_CFD/src/solvers/CIncNSSolver.cpp Outdated Show resolved Hide resolved
@pcarruscag pcarruscag changed the title Feature isothermal swp [WIP] Isothermal streamwise periodicity Oct 28, 2022
NAnand-TUD and others added 6 commits November 10, 2022 19:23
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
Co-authored-by: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com>
const auto AreaNormal = geometry->vertex[iMarker][iVertex]->GetNormal();

su2double GradT[MAXNDIM] = {0.0,0.0,0.0};
for (auto iDim = 0u; iDim < nDim; iDim++)
Copy link
Author

Choose a reason for hiding this comment

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

So I have to revert this as GetGradient_Primitive gives a Matrix su2double which does not comply with DotProduct. I saw at other parts of the code for loop being used to construct a variable and then do DotProduct.

Do you know a better way to handle this?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, slightly wrong suggestion, do this instead please:

const auto GradT = nodes->GetGradient_Primitive(iPoint)[prim_idx.Temperature()];

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 (Energy_Equation && Streamwise_Periodic_Temperature && nMarker_Isothermal > 0 && nMarker_HeatFlux > 0)
SU2_MPI::Error("MARKER_ISOTHERMAL and MARKER_HEATFLUX are not allowed simultaneously with STREAMWISE_PERIODIC_TEMPERATURE= YES, only one of these is allowed MARKER_ISOTHERMAL, MARKER_HEATFLUX in a fluid zone.", CURRENT_FUNCTION);
Copy link
Author

Choose a reason for hiding this comment

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

Do you see any edge case that might pass this?

Copy link
Member

Choose a reason for hiding this comment

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

Looks ok but @TobiKattmann should know better

@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still a relevant issue please comment on it to restart the discussion. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2023
@stale stale bot removed the stale label Jul 11, 2023
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.


// } // points

// }

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
// if (turbulent && (config->GetnMarker_Isothermal() != 0))
// turb_b1_coeff_Local += Temp * nodes->GetAuxVarGradient(iPoint, 0, 0) * config->GetSpecific_Heat_Cp() * volume / config->GetPrandtl_Turb();

// Volume_VTemp_Local += volume * Temp * nodes->GetVelocity(iPoint, 2) * nodes->GetDensity(iPoint);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

// Volume_TempS_Local += volume * Temp;

// Volume_Temp_Local += volume * Temp * nodes->GetThermalConductivity(iPoint);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

// Volume_Local += volume;

// Volume_TempS_Local += volume * Temp;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

// const su2double Temp = nodes->GetTemperature(iPoint);

// Volume_Local += volume;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines +783 to +789
if (implicit) {

// /*--- Jacobian is set to zero on initialization. ---*/

/*--- Compute a scalar factor ---*/
scalar_factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow / (SPvals.Streamwise_Periodic_MassFlow * sqrt(norm2_translation) * Prandtl_Turb);
// jacobian[nDim+1][nDim+1] = Volume * scalar_factor * dot_product;

}

Check notice

Code scanning / CodeQL

Futile conditional Note

If-statement with an empty then-branch and no else-branch.
Comment on lines +807 to +813
if (implicit) {

// /*--- Jacobian is set to zero on initialization. ---*/

// jacobian[nDim+1][nDim+1] -= Volume * scalar_factor * dot_product;

}

Check notice

Code scanning / CodeQL

Futile conditional Note

If-statement with an empty then-branch and no else-branch.

// /*--- Jacobian is set to zero on initialization. ---*/

// jacobian[nDim+1][nDim+1] -= Volume * scalar_factor * dot_product;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

/*--- Compute a scalar factor ---*/
scalar_factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow / (SPvals.Streamwise_Periodic_MassFlow * sqrt(norm2_translation) * Prandtl_Turb);
// jacobian[nDim+1][nDim+1] = Volume * scalar_factor * dot_product;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
dot_product += config->GetPeriodic_Translation(0)[iDim]* nodes->GetAuxVarGradient(iPoint, 0, iDim);
}
// su2double dot_product = GeometryToolbox::DotProduct(nDim, config->GetPeriodic_Translation(0), nodes->GetAuxVarGradient(iPoint, 0));

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants