CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

compressible cavitation solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2016, 07:07
Post compressible cavitation solver
  #1
New Member
 
popovich
Join Date: Jan 2016
Posts: 9
Rep Power: 10
popovich is on a distinguished road
Hi all,
i made a solver based on interPhaseChangFoam and compressibleInterfoam.
i have some question about the alpha equation. Can you give me some suggestion?

alpha Equation in compressibleInterFoam is as followed
{
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");

surfaceScalarField phir(phic*interface.nHatf());

for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
{
volScalarField:imensionedInternalField Sp
(
IOobject
(
"Sp",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("Sp", dgdt.dimensions(), 0.0)
);

volScalarField:imensionedInternalField Su
(
IOobject
(
"Su",
runTime.timeName(),
mesh
),
// Divergence term is handled explicitly to be
// consistent with the explicit transport solution
divU*min(alpha1, scalar(1))
);

forAll(dgdt, celli)
{
if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0)
{
Sp[celli] -= dgdt[celli]*alpha1[celli];
Su[celli] += dgdt[celli]*alpha1[celli];
}
else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0)
{
Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]);
}
}


surfaceScalarField phiAlpha1
(
fvc::flux
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
-fvc::flux(-phir, alpha2, alpharScheme),
alpha1,
alpharScheme
)
);

MULES::explicitSolve
(
geometricOneField(),
alpha1,
phi,
phiAlpha1,
Sp,
Su,
1,
0
);

surfaceScalarField rho1f(fvc::interpolate(rho1));
surfaceScalarField rho2f(fvc::interpolate(rho2));
rhoPhi = phiAlpha1*(rho1f - rho2f) + phi*rho2f;

alpha2 = scalar(1) - alpha1;
}

Info<< "Liquid phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< " Min(" << alpha1.name() <<") = " << min(alpha1).value()
<< " Min(" << alpha2.name() <<") = " << min(alpha2).value()
<< endl;
}



my alpha Equation
{
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");

surfaceScalarField phir("phir", phic*interface.nHatf());

Pair<tmp<volScalarField> > vDotAlphal =
twoPhaseProperties->vDotAlphal();
const volScalarField& vDotcAlphal = vDotAlphal[0]();
const volScalarField& vDotvAlphal = vDotAlphal[1]();
const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal);
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
{
volScalarField:imensionedInternalField Sp
(
IOobject
(
"Sp",
runTime.timeName(),
mesh
),
vDotvmcAlphal
);

volScalarField:imensionedInternalField Su
(
IOobject
(
"Su",
runTime.timeName(),
mesh
),
// Divergence term is handled explicitly to be
// consistent with the explicit transport solution
vDotcAlphal //divU*min(alpha1, scalar(1))
);

forAll(dgdt, celli)
{
if (dgdt[celli] >= 0.0 )
{
Su[celli] += (dgdt[celli]*alpha1[celli]*alpha2[celli]);
}
else
{
Sp[celli] += (dgdt[celli]*alpha2[celli]);
}
if (divU[celli] >= 0.0 )
{
Su[celli] += alpha1[celli]*divU[celli];
}
else
{
Sp[celli] += divU[celli];
}
}


surfaceScalarField phiAlpha1
(
fvc::flux
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
-fvc::flux(-phir, alpha2, alpharScheme),
alpha1,
alpharScheme
)
);

MULES::explicitSolve
(
geometricOneField(),
alpha1,
phi,
phiAlpha1,
Sp,
Su,
1,
0
);

surfaceScalarField rho1f(fvc::interpolate(rho1));
surfaceScalarField rho2f(fvc::interpolate(rho2));
rhoPhi = phiAlpha1*(rho1f - rho2f) + phi*rho2f;

alpha1 = min(max(alpha1, scalar(0)), scalar(1));
alpha2 = scalar(1) - alpha1;
}

Info<< "Liquid phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< " Min(" << alpha1.name() <<") = " << min(alpha1).value()
<< " Min(" << alpha2.name() <<") = " << min(alpha2).value()
<< endl;
}
popovich is offline   Reply With Quote

Old   May 31, 2016, 08:59
Default
  #2
Member
 
Lennart
Join Date: Feb 2016
Posts: 46
Rep Power: 10
elmo555 is on a distinguished road
Hey,

first of all, it's easier to read if you put your code in the CODE-tags, then the formatting will be nice.

And what exactly is your question?
elmo555 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Density-based, fully-coupled, compressible solver in OpenFOAM? francesco_capuano OpenFOAM Running, Solving & CFD 7 November 20, 2018 13:12
Blow of compressible solver while using K-epsilon model in openfoam Amit Mathur OpenFOAM 16 October 6, 2013 11:09
Cryogenics, compressible multiphase and heat transfer solver mturcios777 OpenFOAM Programming & Development 3 March 22, 2012 10:11
compressible solver with moving mesh Peter_600 OpenFOAM 1 July 12, 2011 15:39
Compressible magnetohydrodynamics solver thekay OpenFOAM 0 January 27, 2010 08:04


All times are GMT -4. The time now is 20:47.