CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   SonicFoam HELP (https://www.cfd-online.com/Forums/openfoam-pre-processing/94890-sonicfoam-help.html)

 popezmark November 29, 2011 07:25

SonicFoam HELP

Greetings everyone. I'm new in OpenFOAM, I'm trying to use it for my thesis, and I'm having difficulties, could you please help me?

I'm trying to simulate a one dimensional laminar problem based from the shocktube tutorial. I'm using the sonicFoam solver, which seems to me the most suitable for this kind of problems. I used the same fvSchemes and fvSolution files of the shocktube turorial.

My model is a one-dimensional straight channel with inlet and outlet at the ends. I've successfully created the 1-D mesh with the command blockMesh. I defined one of the ends (the outlet) CLOSED like a WALL, while the other (the inlet) is an open patch.

______________________________________
inlet (open) |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_| outlet (wall)

The internal field has uniform pressure, uniform temperature, and zero velocity.
I tried to run two problems.
In the first problem I assigned for the inlet patch the boundary condition "totalPressure" with 350000 Pascal and gamma 1.4 for the pressure, "totalTemperature" with 1500 K and gamma 1.4 for the temperature, and zeroGradient for velocity U. For the outlet wall I assigned zeroGradient for pressure and temperature, and fixedValue (0 0 0) for velocity. The channel is 40 cm long, the mesh has 500 cells and I chose a time-step deltaT of 10^-8 sec.

for p:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

dimensions [1 -1 -2 0 0 0 0];

internalField uniform 150000;

boundaryField
{
inlet
{
type totalPressure;
gamma 1.4;
p0 350000;
}
outlet
{
}
empty
{
type empty;
}
}

************************************************** **********

for T:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

dimensions [0 0 0 1 0 0 0];

internalField uniform 500;

boundaryField
{
inlet
{
type totalTemperature;
gamma 1.4;
T0 uniform 1500;
}
outlet
{
}
empty
{
type empty;
}
}

************************************************** ***********

For U:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
}
outlet
{
type fixedValue;
value uniform (0 0 0);
}
empty
{
type empty;
}
}

************************************************** **********

This first simulation seems to work fine, with Courant Number steady below 10^-6. I see a shockwave entering from the inlet moving toward the outlet, and reflecting back after reaching the outlet wall. Furthermore, I see the hot gas entering from the inlet and the contact surface between the entering hot gas and the cold gas inside the channel.

The problem is in my second simulation! In this one, the files are all the same, but I wanted to simulate the opposite problem. I assigned 350000 Pa and 1500 K in the internal volume, with zero velocity. And this time, for the outlet patch, I assigned 150000 Pa and 500 K. I expect to see an expansion fan forming and moving torward the outlet, but the simulation stops after few seconds of calculations. In the last iteration i see:

Time = 1.394e-06

Courant Number mean: -0.0016823 max: 8.84695e-05
diagonal: Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
DILUPBiCG: Solving for Ux, Initial residual = 0.00126733, Final residual = 2.78929e-19, No Iterations 1
DILUPBiCG: Solving for e, Initial residual = 0.0224331, Final residual = 6.76904e-18, No Iterations 1

--> FOAM FATAL ERROR:
Maximum number of iterations exceeded

From function specieThermo<Thermo>::T(scalar f, scalar T0, scalar (specieThermo<Thermo>::*F)(const scalar) const, scalar (specieThermo<Thermo>::*dFdT)(const scalar) const) const
in file /home/opencfd/OpenFOAM/OpenFOAM-2.0.1/src/thermophysicalModels/specie/lnInclude/specieThermoI.H at line 67.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::error::abort() in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 Foam::ePsiThermo<Foam::pureMixture<Foam::constTran sport<Foam::specieThermo<Foam::eConstThermo<Foam:: perfectGas> > > > >::calculate() in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#3 Foam::ePsiThermo<Foam::pureMixture<Foam::constTran sport<Foam::specieThermo<Foam::eConstThermo<Foam:: perfectGas> > > > >::correct() in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#4
in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/sonicFoam"
#5 __libc_start_main in "/lib/libc.so.6"
#6
in "/opt/openfoam201/platforms/linux64GccDPOpt/bin/sonicFoam"
Abortito

I see Courant Number mean: -0.0016823. Negative? How is that possible?
I tried reducing deltaT from 10^-8, to 10^-9, nothing changed. I tried a deltaT of 10^-11 (an entire night of work!), no result.
Then I tried to reduce the pressure difference, assigning totalPressure of 200000 Pa for the intlet patch and keeping the internal field at 350000 Pa, and this time the simulation seems to work properly.
But I need to simulate with the greater pressure difference: external 150000/ internal 350000 Pa