-
Notifications
You must be signed in to change notification settings - Fork 922
[WIP] Implementing variable density for unsteady incompressible flow #2641
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
base: develop
Are you sure you want to change the base?
Changes from all commits
509a608
6aeb0a3
79e238c
526b9a1
59979d0
99abfa4
bee5a27
cea69cc
a721a2e
02c03bb
0449bb4
572291f
c9fd0f6
fc33c6a
644a543
fed4892
8e09f7f
1e5008a
2aebc54
3f19c55
f5b3f56
735c27b
f9f98a0
adf7581
cc06d7e
6f2a8eb
fa318d2
3e1b898
87a3381
b278ad6
dda9271
ff74a7f
c194c4f
ac17146
35b018f
d14be6e
6cc4073
83c3416
459e3b4
630856b
35ad976
31f8af3
00ae736
8a47539
4f7a656
df27a84
51f18af
8f6da27
524fd46
acfe778
adedf6b
89661d4
df28101
2308622
d529abe
02c3311
2364e90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,8 +83,7 @@ class CIncEulerVariable : public CFlowVariable { | |
| * \param[in] nvar - Number of variables of the problem. | ||
| * \param[in] config - Definition of the particular problem. | ||
| */ | ||
|
|
||
| CIncEulerVariable(su2double pressure, const su2double *velocity, su2double enthalpy, | ||
| CIncEulerVariable(su2double density, su2double pressure, const su2double *velocity, su2double enthalpy, | ||
| unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config); | ||
|
|
||
| /*! | ||
|
|
@@ -101,6 +100,26 @@ class CIncEulerVariable : public CFlowVariable { | |
| Primitive(iPoint, indices.Density()) = val_density; | ||
| return val_density <= 0.0; | ||
| } | ||
|
|
||
| inline void SetDensity_time_n(unsigned long iPoint, su2double val) { | ||
| Density_time_n[iPoint] = val; | ||
| } | ||
|
Comment on lines
103
to
106
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. Documentation must be added, similar to the function above SetDensity, Same for the two functions below Set_Density_unsteady and GetDensity_time_n |
||
|
|
||
| inline void SetDensity_time_n1(unsigned long iPoint, su2double val) { | ||
| Density_time_n1[iPoint] = val; | ||
| } | ||
|
|
||
| inline void SetDensity_Unsteady(unsigned long iPoint, su2double val) { | ||
| Density_unsteady[iPoint] = val; | ||
| } | ||
|
|
||
| inline su2double GetDensity_time_n(unsigned long iPoint) const { | ||
| return Density_time_n[iPoint]; | ||
| } | ||
|
|
||
| inline su2double GetDensity_time_n1(unsigned long iPoint) const { | ||
| return Density_time_n1[iPoint]; | ||
| } | ||
|
|
||
| /*! | ||
| * \brief Set the value of the density for the incompressible flows. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,9 +200,9 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned | |
| /*--- Initialize the solution to the far-field state everywhere. ---*/ | ||
|
|
||
| if (navier_stokes) { | ||
| nodes = new CIncNSVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); | ||
| nodes = new CIncNSVariable(Density_Inf, Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); | ||
| } else { | ||
| nodes = new CIncEulerVariable(Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); | ||
| nodes = new CIncEulerVariable(Density_Inf, Pressure_Inf, Velocity_Inf, Enthalpy_Inf, nPoint, nDim, nVar, config); | ||
| } | ||
| SetBaseClassPointerToNodes(); | ||
|
|
||
|
|
@@ -2804,7 +2804,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver | |
| su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR]; | ||
| su2double Volume_nM1, Volume_nP1, TimeStep; | ||
| const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr; | ||
| su2double Density; | ||
| su2double Density, Density_time_n, Density_time_nM1; | ||
|
|
||
| const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); | ||
| const bool first_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST); | ||
|
|
@@ -2843,12 +2843,14 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver | |
|
|
||
| /*--- Access the density at this node (constant for now). ---*/ | ||
|
|
||
| Density_time_nM1 = nodes->GetDensity_time_n1(iPoint); | ||
| Density_time_n = nodes->GetDensity_time_n(iPoint); | ||
| Density = nodes->GetDensity(iPoint); | ||
|
|
||
| /*--- Compute the conservative variable vector for all time levels. ---*/ | ||
|
|
||
| V2U(Density, V_time_nM1, U_time_nM1); | ||
| V2U(Density, V_time_n, U_time_n); | ||
| V2U(Density_time_nM1, V_time_nM1, U_time_nM1); | ||
| V2U(Density_time_n, V_time_n, U_time_n); | ||
| V2U(Density, V_time_nP1, U_time_nP1); | ||
|
|
||
| /*--- CV volume at time n+1. As we are on a static mesh, the volume | ||
|
|
@@ -2897,7 +2899,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver | |
|
|
||
| V_time_n = nodes->GetSolution_time_n(iPoint); | ||
| Density = nodes->GetDensity(iPoint); | ||
| V2U(Density, V_time_n, U_time_n); | ||
| Density_time_n = nodes->GetDensity_time_n(iPoint); | ||
| V2U(Density_time_n, V_time_n, U_time_n); | ||
|
Comment on lines
+2902
to
+2903
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. alignment |
||
|
|
||
| GridVel_i = geometry->nodes->GetGridVel(iPoint); | ||
|
|
||
|
|
@@ -2981,12 +2984,16 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver | |
| /*--- Access the density at this node (constant for now). ---*/ | ||
|
|
||
| Density = nodes->GetDensity(iPoint); | ||
| Density_time_nM1 = nodes->GetDensity_time_n1(iPoint); | ||
| Density_time_n = nodes->GetDensity_time_n(iPoint); | ||
|
|
||
| /*--- Compute the conservative variable vector for all time levels. ---*/ | ||
|
|
||
| V2U(Density, V_time_nM1, U_time_nM1); | ||
| V2U(Density, V_time_n, U_time_n); | ||
| V2U(Density, V_time_nP1, U_time_nP1); | ||
| V2U(Density_time_nM1, V_time_nM1, U_time_nM1); | ||
| V2U(Density_time_n, V_time_n, U_time_n); | ||
| V2U(Density, V_time_nP1, U_time_nP1); | ||
|
Comment on lines
+2994
to
+2996
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. alignment |
||
|
|
||
| /*--- CV volume at time n-1 and n+1. In the case of dynamically deforming | ||
| grids, the volumes will change. On rigidly transforming grids, the | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add density only with unsteady