CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Forces in V1.6

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 23, 2010, 04:41
Default
  #21
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Alessandro

You could try something like this in the command line:

grep -v "<word in header>" forces.dat | tr -d '(' | tr -d ')' > forces.dat.modified

I do not have a forces.dat file available, hence just replace <word in header> with a word from the header. Then it should work without any problems.

Best regards,

Niels
silencebreak likes this.
ngj is offline   Reply With Quote

Old   February 23, 2010, 05:05
Default
  #22
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 16
83_Ale_83 is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Alessandro

You could try something like this in the command line:

grep -v "<word in header>" forces.dat | tr -d '(' | tr -d ')' > forces.dat.modified

I do not have a forces.dat file available, hence just replace <word in header> with a word from the header. Then it should work without any problems.

Best regards,

Niels
Thank you very much, it does exactly what I was looking for
__________________

83_Ale_83 is offline   Reply With Quote

Old   February 23, 2010, 07:22
Default
  #23
Member
 
Join Date: Sep 2009
Posts: 45
Rep Power: 17
AirS is on a distinguished road
You should try this:

sed 's/(/ /g' forces.dat > forcesi
sed 's/)/ /g' forcesi > forces

where forces is the same file as forces.dat without the brackets.
Hope it helps!
AirS is offline   Reply With Quote

Old   February 23, 2010, 11:24
Default
  #24
Member
 
Jean-Peer Lorenz
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 33
Rep Power: 17
jploz is on a distinguished road
Hi,

you can use any text postprocessing tool you like (e.g. sed, awk, a perl script) and modify the file (described above).

If you want to remove it directly from the output you will have to create your own version of the forces function object and remove the according lines of source code and recompile it.

HTH.
jploz is offline   Reply With Quote

Old   February 23, 2010, 11:50
Default
  #25
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 16
83_Ale_83 is on a distinguished road
Thank a lot for your advises, I take in consideration all of them
__________________

83_Ale_83 is offline   Reply With Quote

Old   February 25, 2010, 20:48
Default
  #26
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Hi,

You can do it in a different way, please check [1]. They recommend to add some lines in the foamLog script.

Ruben

[1] http://www.cfd-online.com/Forums/ope...rces-of15.html
rubenparedes is online now   Reply With Quote

Old   February 26, 2010, 03:59
Default
  #27
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 16
83_Ale_83 is on a distinguished road
Hi Ruben,

thank you for the advice but I have changed che controlDict in order to obtain the forces values...I don't know how to obtain forces and coeffs from a log file

Quote:
functions
{
forces
{
type forces;
functionObjectLibs ("libforces.so"); //Lib to load
patches (ala); // change to your patch name
rhoName rhoInf;
rhoInf 1.184; //Reference density for fluid
CofR (1 0 0); //Origin for moment calculations
outputControl timeStep;
outputInterval 1;
}
forceCoeffs
{
// rhoInf - reference density
// CofR - Centre of rotation
// dragDir - Direction of drag coefficient
// liftDir - Direction of lift coefficient
// pitchAxis - Pitching moment axis
// magUinf - free stream velocity magnitude
// lRef - reference length
// Aref - reference area
type forceCoeffs;
functionObjectLibs ("libforces.so");
patches (ala);
rhoName rhoInf;
rhoInf 1.184;
CofR (1 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 25;
lRef 1; // sphere diameter
Aref 0.1; //1/2 * projected area = pi*r²/2

outputControl timeStep;
outputInterval 1;
}
}
__________________

83_Ale_83 is offline   Reply With Quote

Old   February 26, 2010, 07:25
Default
  #28
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Hi Ale,

I use 1.5 version, but I assume that 1.6 version generates a forces directory where the forces.dat file is saved. Check reply # 19 in [1]

good luck,

R
rubenparedes is online now   Reply With Quote

Old   February 28, 2010, 19:53
Default
  #29
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16
SD@TUB is on a distinguished road
Quote:
..., but I assume that 1.6 version generates a forces directory where the forces.dat file is saved.
That's correct.
I'm facing some problems of forces output for several patches. Entering all patch names within
Code:
patches (patch1 patch2 patch3 ...);
i get summarized forces and moment for the given patches. But i want to distinguish the forces/moments of each patch. When i repeat
Code:
forces
{
...
}
for every patch, the data are seperated but mixed together within ./forces/<firstTimeStep>/forces.dat! I prefer a solution of creating directories for everey patch, like ./forces/patch1/forces.dat, ./forces/patch2/forces.dat and so on. Any advise of handling several patches in functions -> forces is much appreciated...


/Stefan
SD@TUB is offline   Reply With Quote

Old   March 2, 2010, 01:06
Default
  #30
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Hi Stefan,

I am new to OpenFoam and Cpp, so maybe I will say something stupid. Also, I have never worked with multiple patches, what do you mean when you say "for every patch, the data are separated but mixed together within ./forces/<firstTimeStep>/forces.dat"?

I was reading the force.C file, and it looks like in the makeFile() function the force directory is set as:
forcesDir = obr_.time().path()/name_/obr_.time().timeName();

So, I think that changing the "/obr_.time().timeName()" part with a kind of "/patchSet_()[# ID of patch in list?]" could work to get a directory <#IDpatch>/forces.dat.

That makes sense?,

R.
rubenparedes is online now   Reply With Quote

Old   March 3, 2010, 05:31
Default
  #31
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16
SD@TUB is on a distinguished road
Hello Ruben,

that could be a solution (i didn't try it).
What i did to fix it, is some way easier. Ich changed
Code:
forces
{
...
}
in
Code:
patchname
{
...
}
within functions{...} and i get different directories for the included patches!

/Stefan
SD@TUB is offline   Reply With Quote

Old   March 17, 2010, 10:29
Default
  #32
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 16
83_Ale_83 is on a distinguished road
Hello,
I need to look inside the code of libforces...How I can do it? I would like to know in which way openfoam compute the forces...
__________________

83_Ale_83 is offline   Reply With Quote

Old   March 17, 2010, 18:00
Default
  #33
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16
SD@TUB is on a distinguished road
In case of 64-bit setup, libforces.so is located at
HTML Code:
/usr/local/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libforces.so
In Doxygen the dependencies of forces treatment are listed, see here:
http://foam.sourceforge.net/doc/Doxy...1_1forces.html

Forces are integrated over given walls with patchIntegrate[patchI]. Viscous forces depends on shear stress, pressure forces are related to the pressure field on the wall.
SD@TUB is offline   Reply With Quote

Old   March 22, 2010, 22:21
Default Calculating forces from results without running the case again
  #34
New Member
 
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 20
Rep Power: 17
alexisespinosa is on a distinguished road
Following the indications in this thread, I was able to set the force calculation for a flow past a cylinder.

But I have done a lot of runs in the past days without these settings and i want to calculate the forces from the result files that I already have, because running again the cases will be very time consuming. Obvioulsly, it is possible. I just need to read the U and p files for every saved time and use the force functions to calculate forces.

But how can I do that???

Thanks a lot.
Alexis
alexisespinosa is offline   Reply With Quote

Old   March 22, 2010, 22:44
Default
  #35
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Hi Alexi,

I think that you can use the "execFlowFunctionObjects" utility, but first you need to include in the controlDict file the forceObject as described above.

R.
rubenparedes is online now   Reply With Quote

Old   March 23, 2010, 02:27
Default
  #36
New Member
 
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 20
Rep Power: 17
alexisespinosa is on a distinguished road
Thanks Ruben,

The execFlowFunctionObjects is working, BUT it creates a result file for every saved time step! That is a problem, but the biggest problem is that it overwrites it each time step. So, at the end I get just one file with the forces for the latest time step that i have saved.

Do you know how to avoid overwriting?? It would be wonderful if execFlowFunctionObjects could work with all the saved timesteps just as if they were being generated in runtime. In that way it would output just one file at the end but with one line per processed time, instead of overwriting.

Thanks,
Alexis
alexisespinosa is offline   Reply With Quote

Old   March 23, 2010, 11:22
Default
  #37
New Member
 
rubenparedes's Avatar
 
Ruben Paredes
Join Date: Mar 2009
Location: Guayaquil, Ecuador
Posts: 21
Rep Power: 17
rubenparedes is on a distinguished road
Send a message via MSN to rubenparedes
Hi Alexi,

I am not sure about it, but it sounds to me like you are using:
outputControl timeStep;
outputInterval 1;

Maybe you can try using outputTime instead.

Good luck,

R.
rubenparedes is online now   Reply With Quote

Old   March 23, 2010, 20:05
Default
  #38
New Member
 
Alexis Espinosa
Join Date: Aug 2009
Location: Australia
Posts: 20
Rep Power: 17
alexisespinosa is on a distinguished road
When I use
outputControl outputTime;
Then the utility processes every time directory I have with saved results, but it does not create any file. Nothing!!
When I use
outputControl timeStep;
outputInterval 1;
Then again, execFlowFunctionObjects process every time directory and creates a forces.dat file for every time, but it always overwrite the old one, so it keeps overwriting files and at the end i finish with just one file. The problem is that in every file there is only one line with the calculated forces for that specific time. So, at the end I finish with just the calculated forces for the last time.

Thank you very much.

I also started a thread in OpenFoam_bugs about the execFlowFunctionObjects, I hope that we can also get some hints over there.

Thanks again,

Alexis
alexisespinosa is offline   Reply With Quote

Old   March 28, 2010, 09:32
Default
  #39
Senior Member
 
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18
sandy is on a distinguished road
Quote:
Originally Posted by ronaldo View Post
could someone tell me the best way to simulate the Flow over a Cylinder?
Laminare, k-epsilon and k-omega!
k-omegaSST
sandy is offline   Reply With Quote

Old   March 28, 2010, 10:24
Default
  #40
Member
 
83_Ale_83's Avatar
 
Alessandro
Join Date: Nov 2009
Posts: 67
Rep Power: 16
83_Ale_83 is on a distinguished road
We are a little bit off topic, but why you think k-omega SST?
__________________

83_Ale_83 is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
changes to forces in 1.6 linnemann OpenFOAM Running, Solving & CFD 0 July 30, 2009 09:49
Strange results from interFoam solution converges but sum of all forces not equal to zero nicasch OpenFOAM Running, Solving & CFD 0 April 15, 2008 03:01
2d foil pressure forces problem mayor FLUENT 4 December 1, 2003 04:57
viscous-pressure forces nico FLUENT 0 June 9, 2003 15:41
Valve Forces in CFdesign Mike Clapp Main CFD Forum 3 March 8, 2001 15:09


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