CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   compressible solver for engine simulations (http://www.cfd-online.com/Forums/openfoam/86824-compressible-solver-engine-simulations.html)

Peter_600 April 3, 2011 13:17

compressible solver for engine simulations
 
Hello Foamers

I ve a problem with a compressible solver for mesh motion and topological changes. Basically, it is the dieselEngineFoam solver with some minor modifications. I would like to use with this solver the engineTopoChangerMesh classes. So far it runs, but only when i comment out the turbulent time scale, part for the combustion model. Since I do not have a lot of experiences with this kind of solver, i would appreciate if some of you could have a look on it. The spray seems to work.
I can upload the solver if you are interested. I have a version for 1.5-dev and 1.6-ext.

Quote:

int main(int argc, char *argv[])
{

# include "setRootCase.H"

# include "createEngineTime.H"
# include "createEngineDynamicMesh.H"
# include "readPISOControls.H"

# include "createFields.H"
# include "readEnvironmentalProperties.H"
# include "readCombustionProperties.H"
# include "createSpray.H"
# include "initContinuityErrs.H"
# include "readEngineTimeControls.H"
# include "compressibleCourantNo.H"
# include "setInitialDeltaT.H"
# include "startSummary.H"
# include "createEngineOutput.H"

# include "createSets.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

thermo->correct();

Info << "\nStarting time loop\n" << endl;

while (runTime.run())
{
# include "readPISOControls.H"
# include "readEngineTimeControls.H"
# include "compressibleCourantNo.H"
# include "setDeltaT.H"

runTime++;

Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;

phi += meshFlux;

bool meshChanged = mesh.update();
vpi.updateMesh();
mesh.setBoundaryVelocity(U);

forAll(p.boundaryField(), patchI)
{
p.boundaryField()[patchI].evaluate();
}

if(meshChanged)
{
Info << "meshChanged" << endl;
thermo->correct();
}

dieselSpray.evolve();

Info << "Solving chemistry" << endl;
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
);

//thermo->correct();
//thermo-> rho();

// turbulent time scale
/*{
volScalarField tk =
Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon());
volScalarField tc = chemistry.tc();
//Chalmers PaSR model
kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
}
*/

meshFlux = fvc::interpolate(rho) * fvc::meshPhi(rho, U);

Info << "meshFlux" << endl;

phi -= meshFlux;

Info << "phi-=" << endl;

phi = fvc::interpolate(rho)
*((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U));

Info << "phi = fvc::interpolate(rho)" << endl;


# include "rhoEqn.H"
# include "UEqn.H"

for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
# include "YEqn.H"
# include "hEqn.H"

// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
# include "pEqn.H"
}
}

turbulence->correct();

# include "logSummary.H"
# include "spraySummary.H"
rho = thermo->rho();

runTime.write();

# include "infoDataOutput.H"
# include "writeOutputSets.H"

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return(0);
}
Best regards
Peter

abminternet May 17, 2011 05:40

Hi Peter,

I got engine simulation working with turbulence model but using sonicTurbDyMEngineFoam, and the simpleEngineFvMesh class, I think u already have the example maybe it would be easier to adapt that software.

I have a question for you, I also want to use the engineTopoChanger class, Im using verticalValves, but still don't know what the valveHeadPatch entry in engineGeometry stands for. What patch is it? I tried to set it to "none" or "empty", but what happens is that the cylinderHead part just above the valves moves down together with the valves!! :S Any ideas?? Would appreciate it :)

Peter_600 May 17, 2011 06:46

Hi,

yes I got it ;) Thx again a lot for it.

I suppose the valveHeadPatch will be the upper part of your valve. Basically, you can split your valve in a bottom part, an upper part and the stem. Try to create different patches for your valve. I can imagine, since you don t specify any valveHeadpatch, the solver takes all upper cells as ValveHeadPatches and move them with the same speed as the valve.
How many patches do you have for one valve?

Best reagards
Peter

abminternet May 17, 2011 07:09

No prob :) well the thing is that in engineGeometry it must also be specified a bottomPatch and poppetPatch for the valve, so I have this two patches for one valve, and I thought the poppetPatch was the top part of the valve, I'm quite confused now, so if I set the valveHeadPatch to the upper part of the valve, then what should the poppetPatch be?

arun May 19, 2011 09:57

Hi,

Just wondering have you tried changing the kappa to be unity which increases the stability of the solution by assuming the reactor perfectly mixed (PSR)?

I am not sure will this solve the problem or not but you can try.

You can do this just by assigning the value as shown below:

{
//volScalarField tk =
//Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon());
//volScalarField tc = chemistry.tc();
//Chalmers PaSR model
//kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);

kappa = 1.0;
}

Regards
A

Peter_600 May 20, 2011 03:42

Hi arun,

thank you for the hint. I will try it.

Regards
peter

wschosta June 9, 2011 13:40

Where can I find where
Quote:

turbulence->correct();
is referring to? I'm working on a different solver and it crashes every time it enters this segment of code. I think it's dividing by zero somewhere but I can't seem to find the function this line is referring to.

Any help is much appreciated,

Walter


All times are GMT -4. The time now is 15:56.