Drag Components in OpenFoam
Hello partners;
I'm new in OpenFoam and I would like to know how to calculate the components of the drag coefficient, the viscous component (Cdv) and the pressure component (Cdp). I have this postprocessing, for example for a NACA profile with angle of attack 5: //////////////////////////////////////////////////////// # Force coefficients # liftDir : (-8.715574e-02 9.961947e-01 0.000000e+00) # dragDir : (9.961947e-01 8.715574e-02 0.000000e+00) # pitchAxis : (0.000000e+00 0.000000e+00 1.000000e+00) # magUInf : 1.000000e+00 # lRef : 1.000000e+00 # Aref : 1.000000e+00 # CofR : (2.500000e-01 0.000000e+00 0.000000e+00) # Time Cm Cd Cl Cl(f) Cl(r) 50 -3.381931e-02 2.525614e-02 1.507514e-01 4.155637e-02 1.091950e-01 100 2.877479e-02 2.730709e-02 3.181085e-01 1.878291e-01 1.302795e-01 //////////////////////////////////////////////////////////// # Forces # CofR : (2.500000e-01 0.000000e+00 0.000000e+00) # Time forces(pressure viscous porous) moment(pressure viscous porous) 50 ((-4.093538e-03 7.591890e-02 1.893935e-21) (1.010413e-02 2.705541e-04 -1.629982e-19) (0.000000e+00 0.000000e+00 0.000000e+00)) ((-3.795945e-02 -2.046769e-03 -1.683966e-02) (-1.352770e-04 5.052067e-03 -6.999131e-05) (0.000000e+00 0.000000e+00 0.000000e+00)) 100 ((-6.673421e-03 1.594468e-01 1.740584e-21) (6.412519e-03 1.921648e-04 2.494450e-20) (0.000000e+00 0.000000e+00 0.000000e+00)) ((-7.972341e-02 -3.336711e-03 1.443917e-02) (-9.608239e-05 3.206260e-03 -5.177497e-05) (0.000000e+00 0.000000e+00 0.000000e+00)) ///////////////////////////////////////////////////////////// Furthemore I have this parameters for the simulation: rho rhoInf; // Indicates incompressible log true; rhoInf 1; // Redundant for incompressible liftDir (0 1 0); dragDir (1 0 0); CofR (0.25 0 0); // Center of rotation for Cm Calculation pitchAxis (0 0 1); // Axis of rotation for Cm Calculation magUInf 1; lRef 1; // Chord Aref 1; // Chord*Span (our cell width is 1!) } //////////////////////////////////////////////////////// Can anyone help me calculate the components of the drag? THANKS A LOT. |
Hi,
Just use the output from forces to calculate your separated components: Cdv= 2*Fvx/(rho*Vē*A) Cdp= 2*Fpx/(rho*Vē*A) Where Fp is the first entry in forces Quote:
Similar for Fv = Quote:
You probably want to write a script or do this with a spreadsheat program or whatever. Cheers, Tom |
OF can calculate the drac coefficient for you. Simply include in controlDict lines like
Code:
functions The result is in the postProcessing/forces folder. |
Hi Tom;
Thank you very much for answering so quickly. I finally did what you told me and using a spreadsheet to automate all the angles of attack. Runs perfectly Thanks!!! |
Hi Piu58;
Thanks for your reply, I will try to adapt the code for my case to simplify the postprocessing. Code:
functions |
Hi,
This seems to be a thread I have been looking for. Can anybody suggest how to calculate the viscous and pressure drag separately for flow over a cylinder? I am simulating a 2D case in pisoFoam. I have copied the code to controlDict and run the case. In postProcessing/forceCoefficients, I get the drag coefficient for each deltaT whereas I need the viscous and pressure components. I understand it is possible to calculate these components using ParaView which I am not sure about. I would be grateful to have your suggestions. Thank you |
Hi,
The forceCoeff functionObject does not always print this out, use the forces and calculate the coefficients yourself as explained in the second post. In ParaView you would need to have the wallShearStress and the pressure to calculate the viscous and pressure force per patch, use integrate variables to get the correct forces. If your case is laminar and you do not have the wallShearStress available you may be able to calculate the wallNormal gradient in ParaView and use that to get the viscous force instead. If you case runs quickly however I would encourage you to use the forces option and parse that file with a script to get the pressure and viscous coefficients. Cheers, Tom |
Hi Tom,
Many thanks for the swift response. I understand you are pointing towards including a script in controlDict which can print the coefficients directly(please correct me if wrong). If that is the case, I presume such a script is not readily available in OF hence, I need to manipulate the source code. If you have come across any such scripts, please share. As you said, am simulating laminar cases. |
Hi,
No this is a script you write yourself, no OpenFOAM code. It can be python, bash, or simply copying the fields into a spreadsheat and work on the data there. You have the resulting data in some format, but you need it in a different format. You need to find something that works best for you, I am just giving you some ideas. Hope this helps, Tom |
edit drag coefficients
Hi there, Id like to edit the drag coefficients in a solver, to represent microplastics. Is this possible?
|
All times are GMT -4. The time now is 23:26. |