CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   DU/DT value? (https://www.cfd-online.com/Forums/openfoam/88995-du-dt-value.html)

maysmech June 1, 2011 02:40

DU/DT value?
 
Hi,

I need DU/Dt values for all grids.

How can i calculate and write this parameter.

Any suggestion will be appreciated.

nimasam June 3, 2011 16:46

look in UEqn, something like
volVectorField DuDt= fvc::ddt(U) +fvc::div(phi,U)

maysmech June 4, 2011 04:27

Thanks Nima,

When i switch from Euler to CrancNicholson in fvScheme, ddt0(U) and ddt0(phi) are Written in time folders.

Now, my questions are:

1- is this value equal to D/DT(U)? if no How it can be calculated.

2- Is it any way to write it with Euler ddt scheme?

Regards.

alberto June 4, 2011 09:53

Here it is:

Code:

DDtU =
          fvc::ddt(U)
  + fvc::div(phi, U)
  - fvc::div(phi)*U;

To write the field, simply declare it with the appropriate IOobject.

Best,

maysmech June 4, 2011 10:59

Dear Alberto,
Thanks for your answer.
Is it possible to describe more.
Where should i write this code?
What is steps for writing process in time folders?
Is it need to define DDT in folder 0?
I am running LES with pisoFoam.
Regards.

alberto June 4, 2011 11:32

Quote:

Originally Posted by maysmech (Post 310494)
Dear Alberto,
Thanks for your answer.
Is it possible to describe more.
Where should i write this code?
What is steps for writing process in time folders?
Is it need to define DDT in folder 0?
I am running LES with pisoFoam.
Regards.

This questions sounds a bit like "please do my homework", since this stuff is standard. :D

Take a look at createFields.H, where other fields are created, and do something similar for DDtU. Then update the field at the end of the iteration, before runTime.write().

You do not need to do anything in 0 if you specify NO_READ in the IOobject.

Best,

maysmech June 6, 2011 01:44

Quote:

Originally Posted by alberto (Post 310496)
This questions sounds a bit like "please do my homework", since this stuff is standard. :D

Take a look at createFields.H, where other fields are created, and do something similar for DDtU. Then update the field at the end of the iteration, before runTime.write().

You do not need to do anything in 0 if you specify NO_READ in the IOobject.

Best,

Thanks :)
it is my first openFoam programming and it was the cause of my silly questions. ;)
Now i have a scientific question. first i describe my works:

1- Copying pisoFoam to new folder pisoFoam2.

2-Adding below code next of U and P IOobject of creatFields.H:
Code:

    volVectorField DDtU
    (
        IOobject
        (
            "DDtU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    );

3-Adding below code to before of runTime.write(); of pisoFoam.C:

Code:

    DDtU =
              fvc::ddt(U)
            + fvc::div(phi, U)
        - fvc::div(phi)*U;

4- Changing pisoFoam2/Make/files with:

Code:

EXE = $(FOAM_APPBIN)/pisoFoam2
5-wmake.

After this steps and running a case with pisoFoam2 this error is displayed:

HTML Code:

Reading field p

Reading field U



--> FOAM FATAL ERROR:
NO_READ specified for read-constructor of object DDtU of class IOobject

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 46.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::error::abort() in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  Foam::regIOobject::readStream() in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#3  Foam::regIOobject::readStream(Foam::word const&) in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPOpt/libOpenFOAM.so"
#4  Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::fvMesh const&) in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/pisoFoam2"
#5 
 in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/pisoFoam2"
#6  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 
 in "/home/maysam/OpenFOAM/OpenFOAM-1.7.0/applications/bin/linux64GccDPOpt/pisoFoam2"
Aborted

Switching NO-READ to MUST-READ and defining DDtU in 0 folder solves this error but the problem is i don't know boundary values for this variable.

Regards.

gregor June 6, 2011 04:05

sorry double post :)

gregor June 6, 2011 04:06

hi its because you are using the wrong constructor

look for example at the createfields.H from the coalChemistryFoam Solver


Code:

    DimensionedField<scalar, volMesh> kappa
    (
        IOobject
        (
            "kappa",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimless, 0.0)
    );

there dimensionedScalar("zero", dimless, 0.0) is the value you prescribe initially to your field. You have to prescribe a initial field value otherwise it has to be read from a bc file

gregor

maysmech June 6, 2011 05:44

Hi and thanks Gregor
I didn't find its format for vevtor DDtU with dimension [0 1 -2 0 0 0]. Do you know it?
Another question for Alberto:
Quote:

DDtU =
fvc::ddt(U)
+ fvc::div(phi, U)
- fvc::div(phi)*U;
Are you mean DDt(rho*U)? because phi=rho*U and i think above relation is a material derivation of rho*U. Am i right?

gregor June 6, 2011 05:58

try dimensionedScalar("ddtU", dimVelocity/dimTime/dimTime, 0.0)

edit: well obviously it has to be vector::zero instead of 0.0

nimasam June 6, 2011 11:49

volVectorField DDtU
(
IOobject
(
"DDtU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("DDtU",dimensionSet(0,1,-2,0,0,0),vector::zero)
);
)

maysmech June 6, 2011 15:58

Quote:

Originally Posted by nimasam (Post 310719)
volVectorField DDtU
(
IOobject
(
"DDtU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedVector("DDtU",dimensionSet(0,1,-2,0,0,0),vector::zero)
);
)

Thanks Nima and Gregor
The problem is solved by:
Code:

    volVectorField DDtU
    (
        IOobject
        (
            "DDtU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        mesh,
    dimensionedVector("DDtU",dimensionSet(0,1,-2,0,0,0,0),vector::zero)
    );

But i am in doubt about DDtU value

Quote:

DDtU = fvc::ddt(U) + fvc::div(phi, U) - fvc::div(phi)*U;
Is it DDt(rho.U)?

nimasam June 6, 2011 16:43

no its not!!!!!! it is just DU/DT not D(rho U )/DT

maysmech June 7, 2011 03:17

DDtU = fvc::ddt(U) + fvc::div(phi, U) - fvc::div(phi)*U

As it is stated in User guide phi=rho*U
So it has problem in dimension.

DDtU=>m/s2

ddt(U)=>m/s2

div(phi,U)=div((rho*U)U)=> kg/(m2s2)

div(phi)*U=> kg/(m2s2)

maysmech June 8, 2011 14:45

Quote:

Originally Posted by maysmech (Post 310793)
DDtU = fvc::ddt(U) + fvc::div(phi, U) - fvc::div(phi)*U

As it is stated in User guide phi=rho*U
So it has problem in dimension.

DDtU=>m/s2

ddt(U)=>m/s2

div(phi,U)=div((rho*U)U)=> kg/(m2s2)

div(phi)*U=> kg/(m2s2)

i wrote above post because of:
http://www.openfoam.com/docs/user/fv...20-1120004.4.5

But phi which is written in time folders has this dimension: [0 3 -1 0 0 0 0]
And with this dimension it has dimension problem yet.

div(phi,U)=> m3/s2 :confused:

nimasam June 8, 2011 16:05

phi is not rho*U , it is U & sf()
sf() : surface vector
so
U (m/s) and sf (m^2) so phi is (m^3/s), ok?

maysmech June 8, 2011 16:21

Ok, you mean it is not equal to what user guide wrote for phi. Maybe this is another phi.

But what is your idea about dimensional problem of DDtU?

nimasam June 8, 2011 16:31

whats wrong with m/s^2 ?

maysmech June 9, 2011 01:32

DDtU=>m/s2

ddt(U)=>m/s2

div(phi,U)=> m3/(s2)

div(phi)*U=> m3/(s2)

All of these four phrases should have same dimension, shouldn't they?


All times are GMT -4. The time now is 16:57.