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

Drag Components in OpenFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 28, 2017, 04:14
Default Drag Components in OpenFoam
  #1
adr
New Member
 
anthony
Join Date: Oct 2016
Posts: 5
Rep Power: 10
adr is on a distinguished road
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.
adr is offline   Reply With Quote

Old   March 29, 2017, 11:58
Default
  #2
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
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:
(-4.093538e-03 7.591890e-02 1.893935e-21)
, meaning Fpx = -4.093538e-03, Fpy = 7.591890e-02 and a very small Fpz due to machine tolerance for time = 50.

Similar for Fv =
Quote:
(1.010413e-02 2.705541e-04 -1.629982e-19)
for time = 50.

You probably want to write a script or do this with a spreadsheat program or whatever.

Cheers,
Tom
tomf is offline   Reply With Quote

Old   March 29, 2017, 14:34
Default
  #3
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
OF can calculate the drac coefficient for you. Simply include in controlDict lines like

Code:
functions
{
    forces
    {
        type            forceCoeffs;
        functionObjectLibs ( "libforces.so" );
        outputControl   timeStep;
        outputInterval  1;
        patches         ( cylinder );
        pName           p;
        UName           U;
        rhoName         rhoInf;
        log             true;
        rhoInf          1;
        liftDir         (0 1 0);
        dragDir         (1 0 0);
        CofR            (-0.5 0 0);
        pitchAxis       (0 1 0);
        magUInf         1;
        lRef            1;
        Aref            1;
    }
}
You have to adapt it to your case.

The result is in the postProcessing/forces folder.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   March 30, 2017, 07:32
Default
  #4
adr
New Member
 
anthony
Join Date: Oct 2016
Posts: 5
Rep Power: 10
adr is on a distinguished road
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!!!
adr is offline   Reply With Quote

Old   March 30, 2017, 07:35
Default
  #5
adr
New Member
 
anthony
Join Date: Oct 2016
Posts: 5
Rep Power: 10
adr is on a distinguished road
Hi Piu58;

Thanks for your reply, I will try to adapt the code for my case to simplify the postprocessing.

Code:
functions
{
    forces
    {
        type            forceCoeffs;
        functionObjectLibs ( "libforces.so" );
        outputControl   timeStep;
        outputInterval  1;
        patches         ( cylinder );
        pName           p;
        UName           U;
        rhoName         rhoInf;
        log             true;
        rhoInf          1;
        liftDir         (0 1 0);
        dragDir         (1 0 0);
        CofR            (-0.5 0 0);
        pitchAxis       (0 1 0);
        magUInf         1;
        lRef            1;
        Aref            1;
    }
}
Thanks!!!
adr is offline   Reply With Quote

Old   March 29, 2020, 04:17
Default
  #6
New Member
 
damu
Join Date: Feb 2017
Posts: 24
Rep Power: 9
damu1414 is on a distinguished road
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
damu1414 is offline   Reply With Quote

Old   March 29, 2020, 11:54
Default
  #7
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
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
tomf is offline   Reply With Quote

Old   March 29, 2020, 13:26
Default
  #8
New Member
 
damu
Join Date: Feb 2017
Posts: 24
Rep Power: 9
damu1414 is on a distinguished road
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.
damu1414 is offline   Reply With Quote

Old   March 30, 2020, 04:57
Default
  #9
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 647
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
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
tomf is offline   Reply With Quote

Old   February 8, 2021, 05:47
Default edit drag coefficients
  #10
New Member
 
David
Join Date: Jan 2021
Posts: 13
Rep Power: 5
dalschouten is on a distinguished road
Hi there, Id like to edit the drag coefficients in a solver, to represent microplastics. Is this possible?
dalschouten is offline   Reply With Quote

Reply

Tags
drag, forces, lift, openfoam


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
Getting Started with OpenFOAM wyldckat OpenFOAM 26 June 21, 2024 07:54
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 15:24
Adding new DRAG MODEL for TwoPhaseEulerFoam In OpenFOAM 2.3.x vishal3 OpenFOAM Programming & Development 1 September 11, 2014 08:08
Velocity cylindrical components from OpenFOAM aerospain OpenFOAM 2 October 17, 2012 08:09
Components of Drag Matja90 FLUENT 0 August 20, 2012 04:57


All times are GMT -4. The time now is 13:57.