|
[Sponsors] |
April 26, 2010, 12:13 |
Printing out forces in 1.6.x
|
#1 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
Hi all,
I'm quite new to OpenFOAM and CFD and general so please be nice . I'm just practicing different setups right now and I'm trying to determine the drag on a cylinder. I read in previous posts about using the forces library so I'm trying to get that going. It says that I should see a created file in each of my time interval folders, but I see nothing. My functions section in my controlDict looks like: functions ( forces { type forces; functionObjectLibs ("libforces.so"); patches (cylinder); rhoInf 1.0; CofR (-0.5 0 0); outputControl outputTime; outputInterval 0.01; } ); It compiles fine (using pisoFoam) but nothing is printed out afterward. Any help would be really appreciated. Thanks! |
|
April 27, 2010, 03:28 |
Printing out forces in 1.6.x
|
#2 |
Senior Member
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18 |
Hi Jeff
I have your problem too. |
|
April 27, 2010, 09:53 |
|
#3 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
I've checked out a bunch of threads and what I have should just work but I can't seem to get it going. I'm sure it's something silly but I can't for the life of me figure out what it is. If anyone else has anyone thoughts please let us know.
|
|
April 27, 2010, 10:03 |
|
#4 |
Super Moderator
Niklas Nordin
Join Date: Mar 2009
Location: Stockholm, Sweden
Posts: 693
Rep Power: 29 |
which code are you using?
if you check the messages at the beginning it will warn you if something is wrong with the forces calculation, in which case it will turn it off. It will create a forces directory and write the info to that directory. here's my forces dictionary in controlDict and its for pisoFoam Code:
forces { type forceCoeffs; functionObjectLibs ( "libforces.so" ); outputControl timeStep; outputInterval 1; patches ( cylinder ); directForceDensity no; pName p; UName U; rhoName rhoInf; //log true; rhoInf 994.5; CofR ( 0 0 0 ); liftDir ( 0 1 0 ); dragDir ( 1 0 0 ); pitchAxis ( 0 0 1 ); magUInf 0.54; lRef 0.04; Aref2 0.0157; Aref 0.004; rhoRef 994.5; } |
|
April 27, 2010, 10:15 |
|
#5 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
I'm at work right now so I can't check if I have any error messages but from what I remember I don't think I do. I noticed in your code though that your type is "forceCoeffs", I thought that was used for if you want to determine the coefficient of lift and drag instead of the specific force values. Also, what is "directForceDensity"
Thanks a ton! |
|
April 28, 2010, 22:32 |
|
#6 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
Ok nevermind there is errors. Here are the printouts:
--> FOAM Warning : From function void forces::read(const dictionary& dict) in file forces/forces.C at line 278 Could not find U, p or rho in database. De-activating forces. --> FOAM Warning : From function void forces::read(const dictionary& dict) in file forces/forces.C at line 278 Could not find U, p or rho in database. De-activating forces. Clearly something is wrong, does anyone know what these mean. I'll look online and post if I find a solution. Thanks! |
|
April 28, 2010, 22:45 |
|
#7 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
Ok, it's actually a simple fix.
1) Add "rhoName rhoInf;" to your forces subcategory in controlDict (without the quotes) 2) Create a 0/rho file The warnings should go away and you will get a "forces" file printout in your case folder. This will contain all the forces and moments at each time step. |
|
April 29, 2010, 04:01 |
Printing out forces in 1.6.x
|
#8 |
Senior Member
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18 |
Hi Jeff
Thank you very much. I'll exam your offer and inform you if I have a problem. Best regards Ata |
|
April 29, 2010, 07:28 |
|
#9 |
Senior Member
Join Date: Feb 2010
Posts: 213
Rep Power: 17 |
I have a similar problem. In 1.6 I included the following lines in my controlDict:
Code:
functions { forces { type forces; functionObjectLibs ( "libforces.so" ); // lib to load outputControl timeStep; outputInterval 1; patches ( wall // change to your patch name ); // name of fields pName p; UName U; log true; // dump to file rhoInf 1025; CofR ( 0 0 0 ); } forcesCoeffs { type forceCoeffs; functionObjectLibs ( "libforces.so" ); // lib to load outputControl timeStep; outputInterval 1; patches ( wall // change to your patch name ); // name of fields pName p; UName U; log true; // dump to file rhoInf 1025; CofR ( 0 0 0 ); liftDir ( 0 1 0 ); dragDir ( 1 0 0 ); pitchAxis ( 0 0 0 ); magUInf 7.30; lRef 0.319; Aref 0.001595; } } Code:
--> FOAM Warning : From function void forces::read(const dictionary& dict) in file forces/forces.C at line 278 Could not find U, p or rho in database. De-activating forces. --> FOAM Warning : From function void forces::read(const dictionary& dict) in file forces/forces.C at line 278 Could not find U, p or rho in database. De-activating forces. |
|
April 29, 2010, 09:30 |
|
#10 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
Hey vaina, that is the exact same problem I had. You need to do the following 2 things:
1) Add "rhoName rhoInf;" (without the quotes) to your controlDict file before you enter "rhoInf 1025;" 2) Create a 0/rho file. I imagine you will have to do #1 for your forcecoeffs as well, but I didn't care about the coefficients in my case so I didn't bother. When you do both of those the error messages will disappear and you will create a "forces" file in your case directory with all the information in it that you need. Good luck |
|
April 29, 2010, 12:17 |
|
#11 |
Senior Member
Join Date: Feb 2010
Posts: 213
Rep Power: 17 |
I read your tip, but I posted becouse I hope someone can explain what's the difference. I can't understand why my code works in OF1.6 and doesn't in OF1.6.x. Another question: what should I write in 0/rho file? I have an incompressible case.
Thank you for your help. |
|
April 29, 2010, 12:25 |
|
#12 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
Hey viana,
That's strange because I'm running 1.6.x and that code worked for me. Only suggestion is to double check that you aren't missing any ";" or something silly like that. Do you get any error messages? For the 0/rho file, I'm not sure what your test case is like but essentially for me I just did: type fixedValue; Value 1.2; //air for every place in my simulation that had fluid. For outlet of my control volume I used zeroGradient and I can't quite remember what I used for my surfaces but I believe it was zeroGradient as well (computer not with me atm). |
|
April 29, 2010, 22:21 |
|
#13 |
Senior Member
jeff osborne
Join Date: Mar 2010
Posts: 108
Rep Power: 16 |
Also, if anyone knows how to print out the .dat file that this creates that contains the forces I would really appreciate that!
Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reading forces from previous time step within solver | SD@TUB | OpenFOAM Programming & Development | 5 | April 24, 2023 12:51 |
Forces in V1.6 | terrybarnaby | OpenFOAM Post-Processing | 72 | September 2, 2015 17:49 |
Forces calulated through pressure | LVDH | OpenFOAM Post-Processing | 2 | February 26, 2010 04:15 |
Calculate forces without hydrostatic pressure | geir_oye | FLUENT | 4 | November 12, 2009 10:12 |
Valve Forces in CFdesign | Mike Clapp | Main CFD Forum | 3 | March 8, 2001 15:09 |