CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Pressure Gradient in channelOodles (http://www.cfd-online.com/Forums/openfoam-solving/63645-pressure-gradient-channeloodles.html)

sega April 15, 2009 05:34

Pressure Gradient in channelOodles
 
Hello World.

Is there a way to "monitor" the pressure gradient in channelOodles?
I started a simulation with a given bulk velocity and let it run in hope the pressure gradient would converge - which it does!

Unfortunately I simulated far too long, so the pressure gradient has reached a constant value long time ago.

I tried to use foamLog to have a look at the log file and to get a glimpse at which timestep the pressure gradient became constant.
But foamLog is not reporting the value for the pressure gradient.

Do you have any ideas, how I can determine the value for the pressure gradient over time from the log file?

santos April 16, 2009 05:22

Hi Sebastian,

Have a look at pyFoam in the OpenFOAM Wiki, it may suit your needs. It has pyFoamPlotWatcher utility, that allows you for monitoring custom variables, like the pressure gradient.

As an alternative, if you do:
tail -f <log_file> | grep 'pressure gradient'
it will also work.

Regards,
Jose Santos

sega April 18, 2009 05:56

Quote:

Originally Posted by santos (Post 213111)
Hi Sebastian,

Have a look at pyFoam in the OpenFOAM Wiki, it may suit your needs. It has pyFoamPlotWatcher utility, that allows you for monitoring custom variables, like the pressure gradient.

As an alternative, if you do:
tail -f <log_file> | grep 'pressure gradient'
it will also work.

Regards,
Jose Santos

Dear Santos.

Thanks for your answer. I avoided pyFoam because it looks really confusing with all these libraries you have to write.
I'm happy enough I managed to read the C++ from OpenFOAM and I'm not quite sure if I can do this with Pearl.

Meanwhile I tried to use the tail -f <log_file> | grep 'pressure gradient' but it just gave one output: "pressure gradient" and thats it.
I even had to kill the process using Ctrl + C.

So I'm still stuck. Does this mean I have to walk the dark and stony way to pyFoam?

santos April 18, 2009 12:02

Hi Sebastian,

With pyFoam you dont have to write any library (at least to do what you want). Have a look in http://openfoamwiki.net/index.php/Co...omRegexp-files

In what concerns the tail command, it will only work if your simulation is running, with your log file being updated on the fly.

If you start your run with:
channelOodles > log &
and then you run the tail command, it will definitely work.

Regards,
Jose Santos

nikos_fb16 April 18, 2009 12:33

Hi,

another possibility for monitoring the pressure gradient is the following:

create for example a volScalarField "X" which gets his value from gradP in channelOodles. Then you can set "X" in the probes part in the controlDict and you will have the time series of gradP.

For doing it that way it is necessary to add some lines in the top level code and recompile it but its anotherone of probably many solutions.

Nikos

sega April 18, 2009 13:06

Quote:

Originally Posted by santos (Post 213395)
In what concerns the tail command, it will only work if your simulation is running, with your log file being updated on the fly.

That's the Problem. The simulation is finished, the log file is written.
What about using the view command instead?

santos April 18, 2009 14:44

If your simulation is over, you could do:

cat <log_file> | grep 'pressure gradient'

If you want to send it to a text file instead of terminal:

cat <log_file> | grep 'pressure gradient' > textFile.txt

You could afterwards post-process this text file in Octave or Matlab.

I am not familiar with the view command, sorry.

Regards,
Jose Santos

mou_mi June 29, 2009 17:57

channelOodles
 
Hello

In channelOodles.C or oodles.C , in "PISO loop" there is


if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}


instead of

pEqn.solve();


in turbFoam.C or icoFoam.C. Would you explain for me, what this section do, and why we need to have it in channelOodles.C?

Thank you
Mou

mou_mi August 11, 2009 16:20

Comparison of pressure behavior in 5 periodic cells in icoFoam and channelOodles
 
4 Attachment(s)
Hello

I compared the pressure gradient along 5 periodic unit cells for two solver icoFoam and channelOodles. The results are shown below:

for icoFoam, we have inlet and outlet,

Attachment 807

Attachment 802

for channelOodles, the inlet and outlet are cyclic,

Attachment 806

Attachment 801

according to the icoFoam, it should be pressure drop along the whole channel, but in channelOodles, the pressure does not drop and it cycle in each cell. wold you explain why there is this wrong behavior for pressure gradient for channelOodles solver?

Thank you
Moe

sandy August 12, 2009 02:21

Please give a detailed explanation.
 
Quote:

Originally Posted by nikos_fb16 (Post 213398)
Hi,

another possibility for monitoring the pressure gradient is the following:

create for example a volScalarField "X" which gets his value from gradP in channelOodles. Then you can set "X" in the probes part in the controlDict and you will have the time series of gradP.

For doing it that way it is necessary to add some lines in the top level code and recompile it but its anotherone of probably many solutions.

Nikos

Hi Nikos, could you make me lighter?

Is your method:

step 1: In the file pdEqn. H of the solver, add a line:
volScalarField X = fvc :: grad(p)

step 2: In the controlDict(???) or createFields.H (??), write an output (or input?? I don't know) as follows:

volScalarField X
(
IOobject
(
"X",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fiv :: grad(p)
);
?? I guess I am wrong. I never use it, however I want to try.

In addition,
how can you set "X" in the probes part in the controlDict? Could you give me a detailed explanation? Thanks a lot.

sandy August 12, 2009 05:01

for example
 
For example:

functions
(
probes
{
// Type of functionObject
type probes;

// Name of the directory for the probe data
name probes;

// Locations to be probed. runTime modifiable!
probeLocations
(
(0 9.95 19.77)
(0 -9.95 19.77)
);

// Fields to be probed. runTime modifiable!
fields
(
p
);
}

wallPressure
{
// Type of functionObject
type surfaces;

// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");

// Output every 10th time step
interval 10;

surfaceFormat raw;

fields
(
p
);

surfaces
(
walls
{
type patch;
patchName walls;
triangulate false;
}
);
}
);


I find it in the controlDict of the sloshingTank2D in the interDyMFoam solver. Is it about the set of the probe? Who can explain it? Thanx

nikos_fb16 August 12, 2009 05:10

Hi Sandy,

I wanted to get a probe of the driving pressure gradient. Probes are defined in the controlDict that way:
functions
(
probes1
{
// Type of functionObject
type probes;

// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");

// Locations to be probed. runTime modifiable!
probeLocations
(
(x y z)//your coordinates
);

// Fields to be probed. runTime modifiable!
fields
(
gradPField //for example
);
}

);

There you see, that only fields can be probed, not scalars like gradP in channelOodles. So you have to create a field containing the value of gradP (I called it gradPField) in order to get the probes of it.

Creating gradPField:

1. create the following two fields in createFields.H:

volScalarField FieldOnes
(
IOobject
(
"FieldOnes",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,gradP/gradP
);

volScalarField gradPField
(
IOobject
(
"gradPField",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,scalar(0)*gradP
);

FieldOnes contains only ones.

2.
add the following line in channelOodles.C:
after gradP += gragPplus;
add: gradPField = gradP * FieldOnes;

What I did is not elegant but it works.

Nikos

sandy August 12, 2009 05:44

Hi Nikos, how can I set the "probeLocations" namely the coordinates? you think. Thanks.

nikos_fb16 August 12, 2009 05:48

instead of (x y z) you edit the coordinates of the points you want to probe in your domain.

Nikos

sandy August 12, 2009 06:21

I find this: http://www.cfd-online.com/Forums/ope...over-time.html


All times are GMT -4. The time now is 02:46.