|
[Sponsors] |
August 15, 2007, 11:54 |
Hello!
I would kindly like
|
#1 |
New Member
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17 |
Hello!
I would kindly like to ask if someone could describe to me what is the easiest way to write drag- and lift- force for each time step using turbFoam. I have seen other threads on this subject with several references to the function dragCoefficient. Is this function accessible in OpenFoam 1.4 or is there some other way to do it?? Regards! /H |
|
August 15, 2007, 12:04 |
Hello Hardy,
I am still at
|
#2 |
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25 |
Hello Hardy,
I am still at work, but since you sound quite hurried.... question is, do you want to calculate the lift and drag during the simulation, or do you want to do it as a post-processing step once the simulation is done?? Anyway.... have a look at the folder: "OpenFOAM/OpenFOAM-1.4/src/postProcessing/incompressible/liftDrag" The code in there should give you more than a simple "Head-start" :-)! Enjoy! Philippose |
|
August 16, 2007, 03:41 |
Hello again and thank you!
|
#3 |
New Member
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17 |
Hello again and thank you!
Yes, I would like to calculate the forces during the simulation. Hmmm, in my file structure there is no "postProcessing" folder within the "src" folder as you suggests. Is there something wrong with my system? Can´t find such folder anywhere else either. /H |
|
August 16, 2007, 04:35 |
Hardy,
To install liftDrag
|
#4 |
Senior Member
Join Date: Mar 2009
Posts: 225
Rep Power: 18 |
Hardy,
To install liftDrag tool in OpenFOAM 1.4, please follow instructions included here, those describe how to import liftDrag from version 1.2: http://www.cfd-online.com/OpenFOAM_D...es/1/2299.html Below address also includes updated (I guess) and tided up version of liftDrag tool: http://www.cfd-online.com/OpenFOAM_D...es/1/1604.html I also know there were some issues with that tool validity, but I'm not sure. For more questions about liftDrag try to follow Search Utility on the left side and type 'liftDrag'. Regards and good luck, Krystian |
|
August 21, 2007, 07:24 |
Thank you once again!
I hav
|
#5 |
New Member
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17 |
Thank you once again!
I have now imported liftDrag from version 1.2 and it compiled well! I have looked through the liftDrag code and all other threads about liftDrag but I am still confused about how to use it? As being a beginner in OpenFOAM and C++ I wonder if someone could point out a way for me how to use liftDrag, or parts of it, in order to get drag data from each time step of my simulation. Don´t hesitate to treat me as stupid if that would make thing easier.... :-) /Hardy |
|
August 22, 2007, 20:14 |
Hardy. Tell me which solver yo
|
#6 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
Hardy. Tell me which solver you are using and I will post the instructions.
|
|
August 22, 2007, 20:15 |
oops, I already see you want t
|
#7 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
oops, I already see you want to use turbFoam. I will post the instructions shortly.
|
|
August 22, 2007, 20:57 |
Here you go. Place this file i
|
#8 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
Here you go. Place this file in ~/OpenFOAM/OpenFOAM-1.4/applications/solvers/incompressible
and run the following command: tar -xzvf turbFoam_1.tar.gz Next enter the newly created turbFoam_1 directory and execute the following commands: wclean && wmake That's all. Your modified turbFoam_1 solver which calculates Lift/Drag forces in every time-step is ready for use. There is one catch however. The code assumes a reference area of unity and also a reference velocity of unity. I personally find it easier to set the reference velocity and reference area to unity so that I can later find the exact drag and lift coefficients depending on the case by multiplying/dividing by the appropriate numbers. If you don't follow something, drop a message here and I will get back to you. Good Luck! Attachments: turbFoam_1.tar.gz |
|
August 23, 2007, 05:12 |
Thank you very much!
turbFo
|
#9 |
New Member
Hardy
Join Date: Mar 2009
Location: Sweden
Posts: 19
Rep Power: 17 |
Thank you very much!
turbFoam_1 is up and running! Now I just have to understand how it works so that I can make such modifications my self in the future :-) /H |
|
August 23, 2007, 14:21 |
Good to know that it compiled
|
#10 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
Good to know that it compiled without issues. The Drag/Lift computation was primarily done by Frank Bos. Search for his posts in this forum concerning Lift and Drag, you will find many useful threads.
PS: If you need to extract the Lift/Drag coefficients from the log file conveniently, using the foamLog command, you need to add the following 4 lines in your foamLog.db file (which is present in ~/OpenFOAM/OpenFOAM-1.4/bin) #- Drag coefficient: dragCoefficient/DragCoefficient = /DragCoefficient = #- Pressure Drag coefficient: pressureDragCoefficient/pressureDragCoefficient = /pressureDragCoefficient = #- Viscous Drag coefficient: viscDragCoefficient/viscDragCoefficient = /viscDragCoefficient = #- Lift coefficient: liftCoefficient/LiftCoefficient = /LiftCoefficient = |
|
April 3, 2008, 03:05 |
Hi all, I'm referring to Srina
|
#11 |
New Member
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
Hi all, I'm referring to Srinath's post earlier on.
------------------------------------------------- Here you go. Place this file in ~/OpenFOAM/OpenFOAM-1.4/applications/solvers/incompressible and run the following command: tar -xzvf turbFoam_1.tar.gz Next enter the newly created turbFoam_1 directory and execute the following commands: wclean && wmake ------------------------------------------------ I've got a problem after this step. When I looked into FoamX again, I don't see a turbFoam_1 module. Or is it under turbFoam? Thanks Samuel |
|
April 3, 2008, 13:34 |
turbFoam_1 is simply a version
|
#12 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
turbFoam_1 is simply a version of turbFoam that also prints the dimensionless force coefficients in the log file for every time step (or iteration). As it is a customized version, I think that you will basically need to edit some FoamX cfg file(s) and copy the turbFoam section and create a new turbFoam_1 section. Having come this far, I would expect that folks would have weaned themselves off FoamX as it is merely a graphical frontend to editing the dictionary files ;)
|
|
April 7, 2008, 22:24 |
Ok! I think I some sort know w
|
#13 |
New Member
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
Ok! I think I some sort know what you mean! I just have a query as I'm really new to FoamX and the whole thing about C++, how do I edit the FoamX cfg files so that the coefficients can appear in the log file? After wmake, I ran the program with turbFoam again and the log file does not print the force coefficients =(
|
|
April 8, 2008, 15:49 |
After wmake, I ran the program
|
#14 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
After wmake, I ran the program with turbFoam again and the log file does not print the force coefficients =(
You need to run turbfoam_1 NOT turbfoam. |
|
April 8, 2008, 22:07 |
I'll go and try running turbFo
|
#15 |
New Member
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
I'll go and try running turbFoam_1 now and and see if it works this time! Thanks
|
|
April 11, 2008, 04:22 |
Hi Srinath!
I tried it and
|
#16 |
New Member
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
Hi Srinath!
I tried it and it works nicely! There is just one last problem that cropped up. I would like to find out the momentCoefficient value, so I uncommented the Lref and momentCoefficient statements. However, when I tried to compile again, it returns an error message saying that momentCoefficient is not declared in the scope. I did remember seeing it as a scalar somewhere in your script, but I'm not sure why it still says it isn't declared. |
|
April 11, 2008, 21:32 |
You need to add the relevant s
|
#17 |
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 21 |
You need to add the relevant section for momentCoefficient in liftDrag.H. I'm pasting the code from OpenFOAM 1.2 (where I got the original liftDrag code). Including it in liftDrag.H should do the trick.
Foam::vector Foam::momentCoefficient ( const volVectorField& U, const volScalarField& p, const dimensionedScalar& mu, const word& patchName, const vector& Uinf, const scalar& Aref, const scalar& Lref ) { if (mag(Uinf) < VSMALL) { FatalErrorIn ( "vector momentCoefficient\n" "(\n" " const volVectorField& U,\n" " const volScalarField& p,\n" " const dimensionedScalar& mu,\n" " const word& patchName,\n" " const vector& Uinf,\n" " const scalar& Aref,\n" " const scalar& Lref\n" ")\n" ) << "Uinf is zero." << exit(FatalError); } const fvMesh& mesh = p.mesh(); label patchLabel = -1; forAll (mesh.boundary(), patchi) { if (mesh.boundary()[patchi].name() == patchName) { patchLabel = patchi; break; } } vector pressureForceMoment; vector viscousForceMoment; if (patchLabel != -1) { pressureForceMoment = sum ( mesh.Cf().boundaryField()[patchLabel]^ (p.boundaryField()[patchLabel] *mesh.Sf().boundaryField()[patchLabel]) ); viscousForceMoment = sum ( mesh.Cf().boundaryField()[patchLabel]^ (-mu.value()*U.boundaryField()[patchLabel].snGrad() *mesh.magSf().boundaryField()[patchLabel]) ); } else { pressureForceMoment = sum(vectorField(0)); viscousForceMoment = sum(vectorField(0)); } scalar qRef = 0.5*magSqr(Uinf); scalar Fref = qRef*Aref; scalar Mref = Fref*Lref; vector pressureCoeff = pressureForceMoment/Mref; vector viscousCoeff = viscousForceMoment/Mref; return (pressureCoeff + viscousCoeff); } // ************************************************** *********************** // You may also want to add the following in the beginning: vector momentCoefficient ( const volVectorField& U, const volScalarField& p, const dimensionedScalar& mu, const word& patchName, const vector& Uinf, const scalar& Aref ); Please be aware that you need to test the moment results you obtain with a reference like I did for lift/drag. Frank has Momentcoefficient working as you can see here [1]. Please check with him if you have further problems :-) [1] http://www.cfd-online.com/OpenFOAM_D...es/1/1807.html |
|
April 13, 2008, 21:44 |
Thank you so much Srinath! I w
|
#18 |
New Member
Samuel Pang
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
Thank you so much Srinath! I will put in this section and try running again!
|
|
June 19, 2008, 12:31 |
Hello
I have some questions
|
#19 |
Member
mohd mojab
Join Date: Mar 2009
Posts: 31
Rep Power: 17 |
Hello
I have some questions about adjusting computeForces.H file. 1) Who I can find Aref? for example in this model, is the Aref hatched area, and I need also to multiply to depth Aref = [(10*5)-(1*1)]* 2 2) How can I set Umax? Thank you mou |
|
August 4, 2008, 03:50 |
Hi, all,
Will this turbF
|
#20 |
Member
Ivan Lau
Join Date: Mar 2009
Location: Hong Kong
Posts: 56
Rep Power: 17 |
Hi, all,
Will this turbFoam_1 work for version 1.5? Thanks, Ivan |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
accessing lift fore/drag force in UDF | changkiang | FLUENT | 6 | May 11, 2015 16:00 |
how to set lift and drag coefficients in force mon | alagesanj | FLUENT | 0 | November 16, 2008 21:47 |
Drag & lift force | Max | CFX | 1 | September 4, 2008 12:41 |
finding drag and lift force | Deloat | CFX | 3 | February 27, 2008 17:53 |
Lift and Drag force | Dmitriy | CFX | 4 | September 18, 2005 02:00 |