forked from deepflameCFD/deepflame-dev
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add AUSM scheme and modify KNP scheme in dfHighSpeedFoam
- Loading branch information
1 parent
f19a074
commit d9c5e2b
Showing
8 changed files
with
349 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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 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
106 changes: 106 additions & 0 deletions
106
applications/solvers/dfHighSpeedFoam/fluxSchemes/AUSMDVFlux.H
This file contains 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 |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
\\ / O peration | Website: https://openfoam.org | ||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation | ||
\\/ M anipulation | | ||
------------------------------------------------------------------------------- | ||
License | ||
This file is part of OpenFOAM. | ||
OpenFOAM is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
Function | ||
AUSMDVFlux | ||
Description | ||
A function for solving convective flux based on AUSMDV, which mixes the AUSMD and AUSMV scheme | ||
Author | ||
Daoping Zhang ([email protected]) | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
void AUSMDVFlux( | ||
const surfaceScalarField& meshPhi, | ||
const surfaceScalarField& magSf, | ||
const surfaceVectorField& normal, | ||
const surfaceScalarField& rhoOwn, | ||
const surfaceScalarField& rhoNei, | ||
const surfaceVectorField& UOwn, | ||
const surfaceVectorField& UNei, | ||
const surfaceScalarField& HOwn, | ||
const surfaceScalarField& HNei, | ||
const surfaceScalarField& pOwn, | ||
const surfaceScalarField& pNei, | ||
const surfaceScalarField& gammaOwn, | ||
const surfaceScalarField& gammaNei, | ||
const surfaceScalarField& aOwn, | ||
const surfaceScalarField& aNei, | ||
surfaceVectorField& U12, | ||
surfaceScalarField& massFlux, | ||
surfaceVectorField& momentumFlux, | ||
surfaceScalarField& energyFlux | ||
) | ||
{ | ||
|
||
dimensionedScalar norP("norP", dimless, 1.0); | ||
//dimensionedScalar minU("minU", dimVelocity, SMALL); | ||
|
||
surfaceScalarField UvOwn((UOwn & normal) - meshPhi/magSf); | ||
|
||
surfaceScalarField UvNei((UNei & normal) - meshPhi/magSf); | ||
|
||
// Compute split velocity | ||
surfaceScalarField alphaOwn(2*(pOwn/rhoOwn)/(pOwn/rhoOwn + pNei/rhoNei)); | ||
surfaceScalarField alphaNei(2 - alphaOwn); | ||
|
||
surfaceScalarField cm(max(aOwn , aNei)); | ||
|
||
surfaceScalarField uPlus( | ||
neg0(mag(UvOwn/cm) - 1)*(alphaOwn*(sqr(UvOwn + cm)/(4*cm) - 0.5*(UvOwn + mag(UvOwn)))) | ||
+ 0.5*(UvOwn + mag(UvOwn)) | ||
); | ||
surfaceScalarField uMinus( | ||
neg0(mag(UvNei/cm) - 1)*(alphaNei*(-sqr(UvNei - cm)/(4*cm) - 0.5*(UvNei - mag(UvNei)))) | ||
+ 0.5*(UvNei - mag(UvNei)) | ||
); | ||
|
||
U12 = (alphaOwn*UOwn + alphaNei*UNei)/2.0; | ||
|
||
surfaceScalarField pPlus( | ||
neg0(mag(UvOwn/cm) - 1)*pOwn*sqr(UvOwn/cm + 1.0)*(2.0 - UvOwn/cm)/4.0 | ||
+ Foam::pos(mag(UvOwn/cm) - 1)*pOwn*0.5*(1 + Foam::sign(UvOwn))//pos(mag(UvNei)) | ||
); | ||
surfaceScalarField pMinus( | ||
neg0(mag(UvNei/cm) - 1)*pNei*sqr(UvNei/cm - 1.0)*(2.0 + UvNei/cm)/4.0 | ||
+ Foam::pos(mag(UvNei/cm) - 1)*pNei*0.5*(1 - Foam::sign(UvNei))//max(UvNei,minU) | ||
); | ||
|
||
surfaceScalarField P12(pPlus + pMinus); | ||
surfaceScalarField s(0.5*min(norP , 10.0*mag(pNei - pOwn)/min(pOwn,pNei))); | ||
|
||
surfaceScalarField caseA(Foam::neg(UvOwn - aOwn)*Foam::pos(UvNei - aNei)); | ||
surfaceScalarField caseB(Foam::neg(UvOwn + aOwn)*Foam::pos(UvNei + aNei)); | ||
|
||
massFlux = (uPlus*rhoOwn + uMinus*rhoNei)*magSf | ||
-(1-caseA*caseB)*(caseA*0.125*(UvNei - aNei - UvOwn + aOwn)*(rhoNei - rhoOwn)*magSf | ||
+ (1-caseA)*caseB*0.125*(UvNei + aNei - UvOwn - aOwn)*(rhoNei - rhoOwn)*magSf); | ||
|
||
surfaceVectorField AUSMV((uPlus*rhoOwn*UOwn + uMinus*rhoNei*UNei)*magSf); | ||
surfaceVectorField AUSMD(0.5*(massFlux*(UOwn+UNei) - mag(massFlux)*(UNei-UOwn))); | ||
|
||
momentumFlux = (0.5+s)*AUSMV + (0.5-s)*AUSMD + P12*normal*magSf | ||
-(1-caseA*caseB)*(caseA*0.125*(UvNei - aNei - UvOwn + aOwn)*(rhoNei*UNei - rhoOwn*UOwn)*magSf | ||
+ (1-caseA)*caseB*0.125*(UvNei + aNei - UvOwn - aOwn)*(rhoNei*UNei - rhoOwn*UOwn)*magSf); | ||
|
||
energyFlux = 0.5*(massFlux*(HOwn+HNei) - mag(massFlux)*(HNei-HOwn)) + meshPhi*P12 | ||
-(1-caseA*caseB)*(caseA*0.125*(UvNei - aNei - UvOwn + aOwn)*(rhoNei*HNei - rhoOwn*HOwn)*magSf | ||
+ (1-caseA)*caseB*0.125*(UvNei + aNei - UvOwn - aOwn)*(rhoNei*HNei - rhoOwn*HOwn)*magSf); | ||
|
||
|
||
} |
70 changes: 70 additions & 0 deletions
70
applications/solvers/dfHighSpeedFoam/fluxSchemes/KNPFlux.H
This file contains 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
void KNPFlux( | ||
const surfaceScalarField& meshPhi, | ||
const surfaceScalarField& magSf, | ||
const surfaceVectorField& normal, | ||
const surfaceScalarField& rhoOwn, | ||
const surfaceScalarField& rhoNei, | ||
const surfaceVectorField& UOwn, | ||
const surfaceVectorField& UNei, | ||
const surfaceScalarField& HOwn, | ||
const surfaceScalarField& HNei, | ||
const surfaceScalarField& pOwn, | ||
const surfaceScalarField& pNei, | ||
const surfaceScalarField& gammaOwn, | ||
const surfaceScalarField& gammaNei, | ||
const surfaceScalarField& aOwn, | ||
const surfaceScalarField& aNei, | ||
surfaceVectorField& U12, | ||
surfaceScalarField& massFlux, | ||
surfaceVectorField& momentumFlux, | ||
surfaceScalarField& energyFlux | ||
) | ||
{ | ||
surfaceScalarField UvOwn((UOwn & normal) - meshPhi/magSf); | ||
|
||
surfaceScalarField UvNei((UNei & normal) - meshPhi/magSf); | ||
|
||
surfaceScalarField EOwn("EOwn", HOwn - pOwn/rhoOwn); | ||
surfaceScalarField ENei("ENei", HNei - pNei/rhoNei); | ||
|
||
surfaceScalarField phiv_pos("phiv_pos", UvOwn*magSf); // | ||
surfaceScalarField phiv_neg("phiv_neg", UvNei*magSf); | ||
|
||
|
||
surfaceScalarField cSf_pos("cSf_pos",aOwn*magSf); | ||
surfaceScalarField cSf_neg("cSf_neg",aNei*magSf); | ||
dimensionedScalar v_zero("v_zero", dimVolume/dimTime, 0.0); | ||
surfaceScalarField ap("ap",max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero)); | ||
surfaceScalarField am("am",min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero)); | ||
|
||
surfaceScalarField a_pos("a_pos", ap/(ap - am)); | ||
|
||
surfaceScalarField amaxSf("amaxSf", max(mag(am), mag(ap))); | ||
|
||
surfaceScalarField aSf("aSf", am*a_pos); | ||
|
||
surfaceScalarField a_neg("a_neg", 1.0 - a_pos); | ||
|
||
phiv_pos *= a_pos; | ||
phiv_neg *= a_neg; | ||
|
||
U12 = a_pos*UOwn + a_neg*UNei; | ||
|
||
surfaceScalarField aphiv_pos("aphiv_pos", phiv_pos - aSf); | ||
surfaceScalarField aphiv_neg("aphiv_neg", phiv_neg + aSf); | ||
|
||
// Reuse amaxSf for the maximum positive and negative fluxes | ||
// estimated by the central scheme | ||
amaxSf = max(mag(aphiv_pos), mag(aphiv_neg)); | ||
|
||
massFlux = aphiv_pos*rhoOwn + aphiv_neg*rhoNei; | ||
|
||
momentumFlux = (aphiv_pos*rhoOwn*UOwn + aphiv_neg*rhoNei*UNei) | ||
+ (a_pos*pOwn + a_neg*pNei)*magSf*normal; | ||
|
||
energyFlux = aphiv_pos*(rhoOwn*EOwn + pOwn) | ||
+ aphiv_neg*(rhoNei*ENei + pNei) | ||
+ aSf*pOwn - aSf*pNei | ||
+ meshPhi*(a_pos*pOwn + a_neg*pNei); | ||
|
||
} |
This file contains 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.