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

Get vectorial values Fx / Fy on airfoil

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ronan_normand

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 28, 2023, 04:06
Default Get vectorial values Fx / Fy on airfoil
  #1
New Member
 
Join Date: Nov 2023
Posts: 6
Rep Power: 2
ronan_normand is on a distinguished road
Hello everyone,

For my PhD work, I’m working on a shape optimization project. I’d like to try an “original” way of calculating the gradient J (drag / lift) with respect to the shape (no adjoint).

I need the force values Fx/Fy (drag / lift) at each point of the airfoil in a surface /edge of my airfoil. This will allow me to calculate my gradient.

I managed to calculate Cd / Cl directly in by changing the ControlDict file with function forces. But I can't figure out how to get the distribution of forces on the wing.

Can anyone help me?
ronan_normand is offline   Reply With Quote

Old   November 28, 2023, 06:29
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,074
Rep Power: 26
Yann will become famous soon enough
Hello,

If you are using the OpenCFD branch (openfoam.com), have a look at the forces function object. There is a writeFields flag allowing to write forces as a field so you can get forces on your airfoil surface.
https://doc.openfoam.com/2306/tools/...forces/forces/

I don't think this flag is available in the foundation branch (openfoam.org) but maybe there is another way to achieve the same result.

I hope this helps,
Yann
Yann is offline   Reply With Quote

Old   November 28, 2023, 07:09
Default
  #3
New Member
 
Join Date: Nov 2023
Posts: 6
Rep Power: 2
ronan_normand is on a distinguished road
Hello, thank you for your reply ! The point is that i'm already using writeFields in my dict file. See below:

https://github.com/Extrality/NACA_simulation

But it give me the integration around the wing, not point by point...
ronan_normand is offline   Reply With Quote

Old   November 28, 2023, 08:04
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,074
Rep Power: 26
Yann will become famous soon enough
Hello,

I can see you defined it in the forceCoeffs function, but not in the forces function. If you defined writeFields for your forces function, you should have a force variable written in the time step directories.

Yann
Yann is offline   Reply With Quote

Old   November 30, 2023, 03:39
Default
  #5
New Member
 
Join Date: Nov 2023
Posts: 6
Rep Power: 2
ronan_normand is on a distinguished road
Hello,

You're right. The point is that it produce me some forces values in x, y, z around the airfoil in a "forceCoeffs" file.

Are you sure those forces correspond to my Fx, Fy forces around the airfoil ?

forceCoeffs1
{
// Mandatory entries
type forceCoeffs;
libs ("libforces.so");
patches ("aerofoil");


// Optional entries

// Field names
p p;
U U;
rho rhoInf;

////Density only for incompressible flows
rhoInf 1.184;

// Reference pressure [Pa]
pRef 0;

// Include porosity effects?
porosity no;

// Store and write volume field representations of forces and moments
writeFields yes;
writeControl timeStep;
writeInterval $endTime;

// Centre of rotation for moment calculations
CofR (0 0 0);

// Lift direction
liftDir (0 1 0);

// Drag direction
dragDir (1 0 0);

// Pitch axis
pitchAxis (0 0 1);

// Freestream velocity magnitude [m/s]
magUInf $Uinf;

// Reference length [m]
lRef 1;

// Reference area [m2]
Aref 1;

// Spatial data binning
// - extents given by the bounds of the input geometry
/*binData
{
nBin 20;
direction (1 0 0);
cumulative yes;
}*/
}
ronan_normand is offline   Reply With Quote

Old   November 30, 2023, 03:54
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,074
Rep Power: 26
Yann will become famous soon enough
You are confusing 2 different function objects :

forceCoeffs computes forces coefficients (Cd, Cl, Cs, ...) : https://doc.openfoam.com/2306/tools/...s/forceCoeffs/
forces computes... forces (Fx, Fy, Fz): https://doc.openfoam.com/2306/tools/...forces/forces/

The writeField flag in the forces function object (not forceCoeffs) should write a force vector, in Newton.
Yann is offline   Reply With Quote

Old   November 30, 2023, 04:18
Default
  #7
New Member
 
Join Date: Nov 2023
Posts: 6
Rep Power: 2
ronan_normand is on a distinguished road
Okay, thank you for your answer, i'll deal with that!
Have a great day
ronan_normand is offline   Reply With Quote

Old   November 30, 2023, 04:37
Default
  #8
New Member
 
Join Date: Nov 2023
Posts: 6
Rep Power: 2
ronan_normand is on a distinguished road
It does not seem to work ...

I add
writeFields yes;
to the controldict forces type:

forces_object
{
type forces;
libs ("libforces.so");
patches ("aerofoil");
//enabled true;


// Field names
p p;
U U;
rho rhoInf;

//// Density only for incompressible flows
rhoInf 1.1839305888344056;


// Store and write volume field representations of forces and moments
writeFields yes;
writeControl timeStep;
writeInterval $endTime;

//// Centre of rotation
CofR (0 0 0);
}


and it returned me the log message:




/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : _6e1fca0e-20220610 OPENFOAM=2112 patch=220610 version=2112
Arch : "LSB;label=32;scalar=64"
Exec : simpleFoam
Date : Nov 30 2023
Time : 10:31:43
Host : ronan-HP-Dragonfly-13-5-inch-G4-Notebook-PC
PID : 11619
I/O : uncollated
Case : /home/ronan/Bureau/naca/NACA_simulation/Simulations/airFoil2D_SA_0.155_0_0_0_12_shape_0
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0


SIMPLE: convergence criteria
field p tolerance 0
field U tolerance 0
field nuTilda tolerance 0
field k tolerance 0
field omega tolerance 0
field h tolerance 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model SpalartAllmaras
Selecting patchDistMethod meshWave
RAS
{
RASModel SpalartAllmaras;
turbulence on;
printCoeffs on;
sigmaNut 0.666667;
kappa 0.41;
Cb1 0.1355;
Cb2 0.622;
Cw2 0.3;
Cw3 2;
Cv1 7.1;
Cs 0.3;
}

No MRF models present

No finite volume options present

Starting time loop

forces forces_object:
p: p
U: U
rho: rhoInf
Freestream density (rhoInf) set to 1.18393
Not including porosity effects
Fields will be written

forceCoeffs forceCoeffs1:
p: p
U: U
rho: rhoInf
Freestream density (rhoInf) set to 1.18393
Reference pressure (pRef) set to 0
Not including porosity effects
Fields will be written
--> FOAM Warning :
From bool Foam::regIOobject::store()
in file ./src/OpenFOAM/lnInclude/regIOobjectI.H at line 45
Refuse to store unregistered object: force


--> FOAM FATAL ERROR: (openfoam-2112 patch=220610)
Failed to store pointer: force. Risk of memory leakage


From static Type& Foam::regIOobject::store(Type*) [with Type = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>]
in file ./src/OpenFOAM/lnInclude/regIOobjectI.H at line 67.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::error::simpleExit(int, bool) at ??:?
#2 Foam::functionObjects::forces::read(Foam::dictiona ry const&) at ??:?
#3 Foam::functionObjects::forceCoeffs::read(Foam::dic tionary const&) at ??:?
#4 Foam::functionObjects::forceCoeffs::forceCoeffs(Fo am::word const&, Foam::Time const&, Foam::dictionary const&, bool) at ??:?
#5 Foam::functionObject::adddictionaryConstructorToTa ble<Foam::functionObjects::forceCoeffs>::New(Foam: :word const&, Foam::Time const&, Foam::dictionary const&) at ??:?
#6 Foam::functionObject::New(Foam::word const&, Foam::Time const&, Foam::dictionary const&) at ??:?
#7 Foam::functionObjects::timeControl::timeControl(Fo am::word const&, Foam::Time const&, Foam::dictionary const&) at ??:?
#8 Foam::functionObjectList::read() at ??:?
#9 Foam::Time::run() const at ??:?
#10 Foam::Time::loop() at ??:?
#11 ? in /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/bin/simpleFoam
#12 ? in /lib/x86_64-linux-gnu/libc.so.6
#13 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#14 ? in /usr/lib/openfoam/openfoam2112/platforms/linux64GccDPInt32Opt/bin/simpleFoam
Aborted (core dumped)
ronan_normand is offline   Reply With Quote

Old   November 30, 2023, 05:01
Default
  #9
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,074
Rep Power: 26
Yann will become famous soon enough
Alright, there might be a clash between both functions.
Do you need to write the force coefficients on your surface?

If not, try removing the writeFields flag from the forceCoeffs function (use it only on the forces function).
If you need both, maybe try to use the useNamePrefix flag in both functions.

Bug report: https://develop.openfoam.com/Develop.../-/issues/2490
Forces function header (to check the useNamePrefix usage): https://develop.openfoam.com/Develop...orces/forces.H
Yann is offline   Reply With Quote

Old   November 30, 2023, 08:56
Default
  #10
New Member
 
Join Date: Nov 2023
Posts: 6
Rep Power: 2
ronan_normand is on a distinguished road
Thank you, it's working by removing the other !
Yann likes this.
ronan_normand is offline   Reply With Quote

Reply


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
Airfoil analysis - the output values differ from the theoretical ones HSalwa CFX 1 November 15, 2015 17:15
reference values - 2D airfoil model ANDRES ORTIZ FLUENT 6 April 1, 2015 18:33
Reference Values for airfoil coefficent calculatio Patrizio FLUENT 5 November 24, 2011 09:03
Airfoil boundary condition Frank Main CFD Forum 1 April 21, 2008 18:36
very urgent pleasade:Cl and Cd values for airfoil Liaquat FLUENT 2 April 27, 2006 12:20


All times are GMT -4. The time now is 01:09.