CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Pressure Gradient in channelOodles

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By sega

Reply
 
LinkBack Thread Tools Display Modes
Old   April 15, 2009, 05:34
Default Pressure Gradient in channelOodles
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
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?
oscarli likes this.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 16, 2009, 05:22
Default
  #2
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
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
santos is offline   Reply With Quote

Old   April 18, 2009, 05:56
Default
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Quote:
Originally Posted by santos View Post
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?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 18, 2009, 12:02
Default
  #4
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
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
santos is offline   Reply With Quote

Old   April 18, 2009, 12:33
Default
  #5
New Member
 
Nikolaos Spyrou
Join Date: Mar 2009
Posts: 22
Rep Power: 8
nikos_fb16 is on a distinguished road
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
nikos_fb16 is offline   Reply With Quote

Old   April 18, 2009, 13:06
Default
  #6
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Quote:
Originally Posted by santos View Post
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?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 18, 2009, 14:44
Default
  #7
Senior Member
 
santos's Avatar
 
Jose Luis Santos
Join Date: Mar 2009
Location: Portugal
Posts: 213
Rep Power: 9
santos is on a distinguished road
Send a message via Skype™ to santos
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
santos is offline   Reply With Quote

Old   June 29, 2009, 17:57
Default channelOodles
  #8
Member
 
mohd mojab
Join Date: Mar 2009
Posts: 31
Rep Power: 8
mou_mi is on a distinguished road
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 is offline   Reply With Quote

Old   August 11, 2009, 16:20
Default Comparison of pressure behavior in 5 periodic cells in icoFoam and channelOodles
  #9
Member
 
mohd mojab
Join Date: Mar 2009
Posts: 31
Rep Power: 8
mou_mi is on a distinguished road
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,

icoFoam_Up.JPG

icoFoam.JPG

for channelOodles, the inlet and outlet are cyclic,

channelOodles_Up.JPG

channelOodles.JPG

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
mou_mi is offline   Reply With Quote

Old   August 12, 2009, 02:21
Default Please give a detailed explanation.
  #10
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 207
Rep Power: 9
sandy is on a distinguished road
Quote:
Originally Posted by nikos_fb16 View Post
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 is offline   Reply With Quote

Old   August 12, 2009, 05:01
Default for example
  #11
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 207
Rep Power: 9
sandy is on a distinguished road
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
sandy is offline   Reply With Quote

Old   August 12, 2009, 05:10
Default
  #12
New Member
 
Nikolaos Spyrou
Join Date: Mar 2009
Posts: 22
Rep Power: 8
nikos_fb16 is on a distinguished road
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
nikos_fb16 is offline   Reply With Quote

Old   August 12, 2009, 05:44
Default
  #13
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 207
Rep Power: 9
sandy is on a distinguished road
Hi Nikos, how can I set the "probeLocations" namely the coordinates? you think. Thanks.
sandy is offline   Reply With Quote

Old   August 12, 2009, 05:48
Default
  #14
New Member
 
Nikolaos Spyrou
Join Date: Mar 2009
Posts: 22
Rep Power: 8
nikos_fb16 is on a distinguished road
instead of (x y z) you edit the coordinates of the points you want to probe in your domain.

Nikos
nikos_fb16 is offline   Reply With Quote

Old   August 12, 2009, 06:21
Default
  #15
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 207
Rep Power: 9
sandy is on a distinguished road
I find this: How to plot variables over time
sandy is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15
Gas pressure question Dan Moskal Main CFD Forum 0 October 24, 2002 22:02
pressure gradient term in low speed flow Atit Koonsrisuk Main CFD Forum 2 January 10, 2002 11:52
Hydrostatic pressure in 2-phase flow modeling (CFX4.2) HB &DS CFX 0 January 9, 2000 14:19
Hydrostatic pressure in 2-phase flow modeling (long) DS & HB Main CFD Forum 0 January 8, 2000 16:00


All times are GMT -4. The time now is 18:12.