|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Join Date: Oct 2015
Location: Finland
Posts: 39
Rep Power: 10 ![]() |
Hey,
I want to get the face area of my 2d mesh for each cell. I will then take a square root of it to use it in some equation. So far what I do is taking the volume of the cell and getting the cubic root of it, which highly depends on z direction and I don't want that: Code:
volScalarField cellVolu ( IOobject ( "cellVolu", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero", dimVolume, 0.0) ); cellVolu.ref() = mesh.V(); Any ideas? Bulut |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Join Date: Oct 2015
Location: Finland
Posts: 39
Rep Power: 10 ![]() |
I tried the following lines in my header file to see what they do:
Code:
forAll(mesh.magSf(), idx) { Info<< "magSf of cell with index " << idx << " is " << mesh.magSf()[idx] << endl; } forAll(mesh.Sf(), idx) { Info<< "normal of cell with index " << idx << " is " << mesh.Sf()[idx]/ mesh.magSf()[idx] << endl; Code:
Sf of cell with index 9748 is (0 -1 0) Sf of cell with index 9749 is (0 1 0) Sf of cell with index 9750 is (1 0 0) Sf of cell with index 9751 is (0 1 0) Sf of cell with index 9752 is (-1 0 0) Sf of cell with index 9753 is (0 -1 0) Sf of cell with index 9754 is (1 0 0) Any suggestions? Bulut |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Davide Fransos
Join Date: Jun 2009
Location: Torino, Italy
Posts: 4
Rep Power: 17 ![]() |
Dear Bulut,
first of all: both MagSf() and Sf() methods of the class fvMesh return surfaceScalarFields. This mean that you have one value for each face of your mesh, and not cells. The "idx" index you are printing in your code refers to faces in the mesh and not cells. Given that: - a 2d mesh in OpenFOAM is in fact a 3d mesh with constant thickness in the third dimension; - each face in your 2d setup corresponds to a cell in the 3d OpenFOAM mesh; why don't you just take the cell volumes and divide them by the constant thickness? Davide |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Join Date: Oct 2015
Location: Finland
Posts: 39
Rep Power: 10 ![]() |
Hey,
Thanks for the reply. I tried that by getting the cell volumes and taking the cubic root of it because of unit consistency. Just to be clear what you suggest is:
Do I understand correctly? -Bulut |
|
![]() |
![]() |
![]() |
![]() |
#5 | |
New Member
Davide Fransos
Join Date: Jun 2009
Location: Torino, Italy
Posts: 4
Rep Power: 17 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#6 |
Member
Join Date: Oct 2015
Location: Finland
Posts: 39
Rep Power: 10 ![]() |
You're right it's that easy! Thanks
|
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Prithvi
Join Date: Mar 2022
Location: Darmstadt
Posts: 6
Rep Power: 4 ![]() |
Hi Bulut,
Were you able to implement this successfully? |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Member
Join Date: Oct 2015
Location: Finland
Posts: 39
Rep Power: 10 ![]() |
Hey,
No, it's been a while but as far as I remember I opted to just using volume instead of face are and ensuring that my third dimension is a unit dimension (in meters) so effectively volume == face area. Hope this helps, Bulut |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to determine the direction of cell face vectors on processor patches | sebastian_vogl | OpenFOAM Programming & Development | 1 | October 11, 2016 13:17 |
[OpenFOAM] Problem with cell area calculation in a slice | daniel87 | ParaView | 5 | October 24, 2015 16:18 |
Flow Direction: normal to boundary!!! | Atit | CFX | 1 | August 2, 2015 13:42 |
FvMatrix coefficients | shrina | OpenFOAM Running, Solving & CFD | 10 | October 3, 2013 14:38 |
Cells with t below lower limit | Purushothama | Siemens | 2 | May 31, 2010 21:58 |