CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to select certains faces to calculate lift coefficient?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2017, 16:20
Default How to select certains faces to calculate lift coefficient?
  #1
New Member
 
Xiaojie Wang
Join Date: Aug 2017
Posts: 9
Rep Power: 9
xuankushuocai is on a distinguished road
Hi guys,

I want to calculate the lift coefficient of a model with a fan patch created in OpenFOAM. The problem is that I don't want to calculate the lift force on the fan patch. Who knows how to recognize different types of surfaces or select surfaces to do the calculation? Thanks.
xuankushuocai is offline   Reply With Quote

Old   October 13, 2017, 04:18
Default
  #2
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
If you calculate forces using the forces function object you can choose over which patches to integrate:

https://cpp.openfoam.org/v4/classFoa...s.html#details
kandelabr is offline   Reply With Quote

Old   October 15, 2017, 10:43
Default
  #3
New Member
 
JPeternel
Join Date: Oct 2014
Posts: 19
Rep Power: 12
jpeter3 is on a distinguished road
You can code it into the solver as follows:

You can access the boundary field using .boundaryField().

That returns an array of fields, one for each patch.

You can identify patchID of your patch by using .findPatchID("nameOfThePatch") that Will be used to acces the one you need.

Looping through boundary field of selected patch you can access data on the faces on that patch to calculate what you want.

Like this:


//Find patch ID for your patch:
label patchID = mesh.boundaryMesh().findPatchID("yourPatchName");

//Store face IDs of your patch:
const polyPatch& cPatch = mesh.boundaryMesh()[patchID];

//Field you want to extract values from:
const someFieldType& yourFieldRef = yourField

//Loop over face IDs of faces that are located on your patch:
forAll(cPatch, facei)
{
//Data you seek:
scalar/vector... data = yourFieldRef.boundaryField()[patchID][facei];
}
jpeter3 is offline   Reply With Quote

Old   October 16, 2017, 13:49
Default
  #4
New Member
 
Xiaojie Wang
Join Date: Aug 2017
Posts: 9
Rep Power: 9
xuankushuocai is on a distinguished road
Hi, Nejc and Jaka, thanks a lot. I have figured it out.
xuankushuocai 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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 06:38
[Other] Mesh Importing Problem cuteapathy ANSYS Meshing & Geometry 2 June 24, 2017 06:29
[snappyHexMesh] SHM is not extruding/adding Layers everywhere matthiasd OpenFOAM Meshing & Mesh Conversion 2 October 16, 2016 17:45
How can I calculate force for lift coefficient and drag coefficient ? gemxx CFX 3 July 4, 2015 09:37
how can i calculate the lift and drag coefficient yujun Main CFD Forum 5 January 23, 2003 16:16


All times are GMT -4. The time now is 11:58.