CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Modifying rhoSimpleFoam to calculate ptot every iteration (http://www.cfd-online.com/Forums/openfoam/80986-modifying-rhosimplefoam-calculate-ptot-every-iteration.html)

RalphS October 13, 2010 02:59

Modifying rhoSimpleFoam to calculate ptot every iteration
 
I want to modify rhoSimpleFoam so that it calculate ptot every time. I need ptot to calculate measuring total pressure with simpleFunctionObjects.

So, I have to change createFields.H and my_rhoSimpleFoam.C. I have tried it, but it didn't worked.

In createFields.H, i have add this:

Code:


    Info<< "Reading field ptot\n" << endl;
    volVectorField ptot
    (
        IOobject
        (
            "ptot",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        )
        p + 0.5*rho*magSqr(U)
    );

In my_rhoSimpleFoam.C, i have add this:

Code:

ptot = p + 0.5*rho*magSqr(U)
Can someone help me?

sabin.ceuca October 13, 2010 03:09

Code:


    Info<< "Reading field ptot\n" << endl;
    volScalarField ptot
    (
        IOobject
        (
            "ptot",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        )
        p + 0.5*rho*magSqr(U)
    );

Hi,
try it like this. The problem seemed be the declaration of ptot as volVectorField instead of volScalarField.
Ciao,
Sabin

RalphS October 13, 2010 03:25

thanks for the fast reply.

I have tried volSalarField, but it doesn't solve the problem.

cpp: Internal error: Floating point exception (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [linux64GccDPOpt/options] Error 1
cpp: Internal error: Floating point exception (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [linux64GccDPOpt/files] Error 1
wmake error: file 'Make/linux64GccDPOpt/objectFiles' could not be created

herbert October 13, 2010 04:20

This doesn't look like a standard compilation error. I think there is something wrong with you compiler itself or with you Make/options (if you changed anything there). Can you try compiling on another maschine?

Regards,
Stefan

RalphS October 13, 2010 05:00

You're right, thanks. I have to use another machine.

Now I can use my_rhoSimpleFoam to calculate ptot.

Here is my code (I have found two faults in it):

my_rhoSimpleFoam.C:

Code:


      turbulence->correct();
 
//BEGIN NEW
 ptot = p + 0.5*rho*magSqr(U);
//END NEW
 
        runTime.write();

createFields.H

Code:


        mesh
    );
 
//BEGIN  NEW
  Info<< " Reading field ptot\n" << endl;
  volScalarField ptot
    (
      IOobject
      (
        "ptot",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
      ),
        p + 0.5*rho*magSqr(U)     
  );
//END NEW
 
    #include "compressibleCreatePhi.H"



All times are GMT -4. The time now is 09:26.