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

is it possible to get cell skewness when the simulation is running ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2022, 18:45
Default is it possible to get cell skewness when the simulation is running ?
  #1
New Member
 
Join Date: Jun 2022
Posts: 10
Rep Power: 3
AbhishekTAMU is on a distinguished road
I want to know if it is possible to get the value of cell skewness (please see the code attached from cellQuality.C) when the simulation itself is running. skewness is shown as an output to 'checkMesh' command and generally it is done after the simulation has been run.

However, I would like to know if I can get the value of skewness when the simulation itself is running and I would also like to know if this value of skewness can be stored as a 'volScalar Field'.


#include "cellQuality.H"
#include "unitConversion.H"
#include "SubField.H"

//This is "cellQuality.C"


Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const
{
tmp<scalarField> tresult
(
new scalarField
(
mesh_.nCells(), 0.0
)
);
scalarField& result = tresult.ref();

scalarField sumArea(mesh_.nCells(), 0.0);

const vectorField& cellCtrs = mesh_.cellCentres();
const vectorField& faceCtrs = mesh_.faceCentres();
const vectorField& areas = mesh_.faceAreas();

const labelList& own = mesh_.faceOwner();
const labelList& nei = mesh_.faceNeighbour();

forAll(nei, facei)
{
scalar dOwn = mag
(
(faceCtrs[facei] - cellCtrs[own[facei]]) & areas[facei]
)/mag(areas[facei]);

scalar dNei = mag
(
(cellCtrs[nei[facei]] - faceCtrs[facei]) & areas[facei]
)/mag(areas[facei]);

point faceIntersection =
cellCtrs[own[facei]]
+ (dOwn/(dOwn+dNei))*(cellCtrs[nei[facei]] - cellCtrs[own[facei]]);

scalar skewness =
mag(faceCtrs[facei] - faceIntersection)
/(mag(cellCtrs[nei[facei]] - cellCtrs[own[facei]]) + vSmall);

result[own[facei]] = max(skewness, result[own[facei]]);

result[nei[facei]] = max(skewness, result[nei[facei]]);
}

forAll(mesh_.boundaryMesh(), patchi)
{
const labelUList& faceCells =
mesh_.boundaryMesh()[patchi].faceCells();

const vectorField::subField faceCentres =
mesh_.boundaryMesh()[patchi].faceCentres();

const vectorField::subField faceAreas =
mesh_.boundaryMesh()[patchi].faceAreas();

forAll(faceCentres, facei)
{
vector n = faceAreas[facei]/mag(faceAreas[facei]);

point faceIntersection =
cellCtrs[faceCells[facei]]
+ ((faceCentres[facei] - cellCtrs[faceCells[facei]])&n)*n;

scalar skewness =
mag(faceCentres[facei] - faceIntersection)
/(
mag(faceCentres[facei] - cellCtrs[faceCells[facei]])
+ vSmall
);

result[faceCells[facei]] = max(skewness, result[faceCells[facei]]);
}
}

return tresult;
}
Attached Files
File Type: txt cellQuality.txt (2.4 KB, 2 views)

Last edited by AbhishekTAMU; July 24, 2022 at 19:10. Reason: wanted to add code
AbhishekTAMU 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
Error running AMI propeller simulation luitzor OpenFOAM Running, Solving & CFD 0 April 19, 2021 13:48
Two dimensional simulation of a PEMFC in Fluent fuel cell module A CFD free user FLUENT 0 October 17, 2014 06:59
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 12:25
Solution Diverging with Trimmer Mesh rietuk STAR-CCM+ 8 February 27, 2013 04:50
Severe nonorthogonality and severe skewness problem qtian OpenFOAM Running, Solving & CFD 2 January 22, 2008 18:47


All times are GMT -4. The time now is 02:45.