Forces in V1.6
Hi, I have updated from 1.5 to 1.6 (GIT source). I have modified some of my cases control files to get OpenFOAM 1.6 to work but I am having problems with forces in simpleFoam.
I get the error message: --> FOAM Warning : From function void forces::read(const dictionary& dict) in file forces/forces.C at line 277 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 277 Could not find U, p or rho in database. De-activating forces. My controlDict force configuration is: functions ( forces { type forces; functionObjectLibs ("libforces.so"); outputControl outputTime; // Patches to sample patches (car_car); // Name of fields pName p; Uname U; // Dump to file log true; // Density rhoInf 1.17; // Centre of rotation CofR (0 0 0); } forceCoeffs { type forceCoeffs; functionObjectLibs ("libforces.so"); outputControl outputTime; // Patches to sample patches (car_car); // Name of fields pName p; Uname U; // Dump to file log true; // Density rhoInf 1.17; // Centre of rotation CofR (0 0 0); // Direction for lift liftDir (0.0 1.0 0.0); // Direction for drag dragDir (1.0 0.0 0.0); // Pitching axis pitchAxis (0 0 0); magUInf 13.0; lRef 2.5; Aref 0.296256; } ); Any one have any idea what is wrong ? |
Looking at the source code it looks like I need to add: "rhoName rhoInf;" to the "forces" and "forceCoeffs" entreis in controlDict or provide a "rho" initial conditions file in "0".
This appears to work ... |
Nice find, it worked for me too.
/Mads |
could someone tell me the best way to simulate the Flow over a Cylinder?
Laminare, k-epsilon and k-omega! |
Terry,
I am using MRFSimpleFoam - OpenFoam-1.6.x. I get the following message error : Starting time loop --> 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. My controlDict is : functions ( forces { type forces; functionObjectLibs ("libforces.so"); //Lib to load patches (object1); // change to your patch name pName p; Uname U; rhoName rho; rhoInf 1.225; //Reference density for fluid CofR (0 0 0); //Origin for moment calculations outputControl timeStep; outputInterval 1; } ); How do I modify my controlDict file ? Regards, Stephane |
Hi,
You need to add: rhoName rhoInf; rhoInf 1.17; instead of: rhoName rho; rhoInf 1.225; //Reference density for fluid I think... Cheers Terry |
Obviously rhoInf should be set how you need it :)
|
Thanks Terry,
Now it works fine ! One more question. And if I want to have the forces results like below (tail -f log) in the log file ? Courant Number mean: 0.000625962 max: 0.0181186 DILUPBiCG: Solving for Ux, Initial residual = 8.58271e-05, Final residual = 5.68736e-12, No Iterations 1 DILUPBiCG: Solving for Uy, Initial residual = 0.000135717, Final residual = 1.58931e-11, No Iterations 1 DICPCG: Solving for p, Initial residual = 0.000308555, Final residual = 2.98446e-06, No Iterations 6 DICPCG: Solving for p, Initial residual = 5.6599e-06, Final residual = 9.87842e-07, No Iterations 193 DICPCG: Solving for p, Initial residual = 1.97131e-06, Final residual = 8.93472e-07, No Iterations 1 DICPCG: Solving for p, Initial residual = 9.0792e-07, Final residual = 9.0792e-07, No Iterations 0 time step continuity errors : sum local = 9.67148e-15, global = -1.15687e-16, cumulative = -1.07021e-10 DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0 DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0 DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0 DICPCG: Solving for p, Initial residual = 9.19959e-07, Final residual = 9.19959e-07, No Iterations 0 time step continuity errors : sum local = 9.79972e-15, global = -1.14472e-16, cumulative = -1.07021e-10 ExecutionTime = 25809.3 s ClockTime = 77462 s forces output: forces(pressure, viscous)((3.36459 -0.00234243 9.49148e-20) (0.365777 -2.56403e-05 -1.76832e-22)) moment(pressure, viscous)((3.41853e-19 -8.54044e-18 -0.00215479) (-8.87561e-22 1.48373e-20 0.0157578)) forceCoeffs output: Cd = 152.26 Cl = -0.0966561 Cm = -1.91544e-17 Time = 2.417 Stephane. |
Sorry, I am only a novice at this so I don't know how to do that.
You could try adding: log true; I'm not sure what that does ... |
Hi,
Is there not a website or tutorial anywhere that gives some instructions for using the forces function? Does it really take digging through the source code? Any links or tips would be much appreciated! Thanks |
Hi all,
I want to investigate the forces acting on a cylinder so I use the entry "forces" in the controlDict, It works well but in the file .dat I've got something like that: forces(pressure, viscous)((3.36459 -0.00234243 9.49148e-20) (0.365777 -2.56403e-05 -1.76832e-22)) moment(pressure, viscous)((3.41853e-19 -8.54044e-18 -0.00215479) (-8.87561e-22 1.48373e-20)) What does (pressure, viscous) mean ? I want to compute all the forces that is to say Fx,Fy,Fz. I can't see them anywhere in the data file... Is there something I'm missing? Thanks. |
As far as I know:
Pressure force is the force on the object due directly to pressure differences. Viscous force is the force due to the "friction" of the fluid passing over the objects surface. To get the total force acting on the object you need to add the pressure components to the viscous components. |
Multi-phase
Hi all,
I was trying to include the density in the forces.C file and I found that there are already some lines regarding to it. Therefore I wonder if multi-phase is already supported in OF1.6. If so, how should the controlDict entry be. If it doesn't support it, how should it be included? The most important line would be the following. I think it should be: vectorField vf = (Sfb[patchi] & devRhoReffb[patchi])*rho.boundaryField()[patchi]; and it is: vectorField vf = Sfb[patchi] & devRhoReffb[patchi] has anyone fixed this? Gonzalo |
Hi Gonzalo,
no, the forces object supplied with OF 1.6 does not support multiphase flow. It uses the prescribed density "rhoInf" when calculating the viscous forces (as I already wrote here http://www.cfd-online.com/Forums/ope...ip-flow-2.html) which is obviously not correct in the case of compressible flow and flow involving more than a single incompressible phase. If you would use a constant density in such case your resulting viscous forces would differ a lot. In order to fix this, you need to read the current density field and use that instead of the defined "rhoInf". Good luck. Jean-Peer |
Quote:
anyone can help me? I'am trying to calculate the drag and lift on a cylinder with simplefoam..any advise? Thank you |
Hi,
Put something like this in your system/controlDict, changing accordingly to your situation: Code:
functions Jose Santos |
Impressive;)
I have put in my controlDict file this code: Quote:
With regards |
"My" code calculates both the forces and their coefficients ;-)
|
Quote:
|
Hello to everybody,
I'm trying to remove the brackets and the header from forces.dat output file, any advise please? Thank you in advance |
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 |
Quote:
|
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! |
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. |
Thank a lot for your advises, I take in consideration all of them:o
|
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 |
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:
|
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 |
Quote:
I'm facing some problems of forces output for several patches. Entering all patch names within Code:
patches (patch1 patch2 patch3 ...); Code:
forces /Stefan |
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. |
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 Code:
patchname /Stefan |
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... |
In case of 64-bit setup, libforces.so is located at
HTML Code:
/usr/local/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libforces.so 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. |
Calculating forces from results without running the case again
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 |
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. |
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 |
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. |
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 |
Quote:
|
We are a little bit off topic, but why you think k-omega SST?
|
All times are GMT -4. The time now is 12:04. |