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

Evaluating Cell Quality

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 14, 2005, 23:31
Default I am undertaking a PhD at Mona
  #1
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
I am undertaking a PhD at Monash University in Australia developing a novel shape optimisation method. I am looking to develop a stricter halt criteria involving various measures of model quality, including cell field gradients and cell quality.

I have modified the analyticalCylinder tutorial example to calculate the following:
  • analytical solution for complete 360 deg;
  • difference between the analtical and numerical solution;
  • cell field gradients;
  • cell quality; and
  • finally write all of the information to file.

I am having trouble, however, in getting the cellQuality class to compile. I keep getting the following error: "undefined reference to 'Foam::cellQuality::cellQuality(Foam::polyMesh const&)'

I have attached the code and has been extensively commented. I was wondering if someone could please identify my error.

analyticalCylinder.C
createGradFields.H
createCellQualityFields.H
vas is offline   Reply With Quote

Old   May 15, 2005, 02:22
Default You probably need to link the
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
You probably need to link the dynamic mesh library - that's where the cellQuality class has been defined.

Edit the Make/options and under EXE_LIBS add -ldynamicMesh

There may be some other libraries missing when you do that (maybe meshTools or cfdTools); the procedure is the same.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 15, 2005, 06:25
Default Thank you Hrvoje, You were
  #3
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
Thank you Hrvoje,

You were right, I hadn't included the libraries properly. Now that this component is working, I can send the data to Info, but I am not sure how to write the data to file.

In "createGradFields.H" I initialised the volScalarField and volVectorField types using IOobject and was able to write the data to file. I attempted to do the same thing in "createCellQualityFields.H", but the compiler returned the following error message:

no matching function for call to 'Foam::tmp<foam::field<foam::scalar> >::tmp(Foam::IOobject)'

Some possible alternative functions are then proposed from "tmpI.H".

I have reattached the files with some minor modifications from the previous message. I would greatly appreciate it if you could help me again with this query.




vas is offline   Reply With Quote

Old   May 15, 2005, 06:27
Default Thank you Hrvoje, You were
  #4
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
Thank you Hrvoje,

You were right, I hadn't included the libraries properly. Now that this component is working, I can send the data to Info, but I am not sure how to write the data to file.

In "createGradFields.H" I initialised the volScalarField and volVectorField types using IOobject and was able to write the data to file. I attempted to do the same thing in "createCellQualityFields.H", but the compiler returned the following error message:

no matching function for call to 'Foam::tmp<foam::field<foam::scalar> >::tmp(Foam::IOobject)'

Some possible alternative functions are then proposed from "tmpI.H".

I have reattached the files with some minor modifications from the previous message. I would greatly appreciate it if you could help me again with this query.

analyticalCylinder.C
createGradFields.H
createCellQualityFields.H
vas is offline   Reply With Quote

Old   May 15, 2005, 06:57
Default Two errors: 1) You are tryi
  #5
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Two errors:

1) You are trying to create tmp<scalarfield> in createCellQualityFields.H, which does not make sense: tmp is a wrapper that allows you to "copy" field (and other) objects without actually copying the data. What you want to create are scalar fields that can write themselves out, right. If so, you need to use scalarIOField. Funnily enough, the rest of the statement is OK! :-)

scalarIOField cellSkewness
(
IOobject
(
"cellSkewness",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
)
);

2) main code, line 99. You said cellQuality.write(), but cellQuality is a class. This is probably a typo, I bet you wanted:

cellNonOrthogonality.write();

I loke the code organisation and use of field algebra - well done. You should also try to indent the code according to the rules and it will be very nice indeed!

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 16, 2005, 00:23
Default Cheers Hrvoje, That worked
  #6
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
Cheers Hrvoje,

That worked and I could write the information to file. I have a couple more questions though if it is ok.

I am using paraView to view the data and hense, I am running the foamToVTK utility. This utility, however, does not convert the cellSkewness and cellQuality files.

I modified the output files to be identical to the formats generated from the volScalarField type. This worked and foamToVTK then converted these files as well.

I then tried replacing the scalarIOField type name for volScalarField but received the following error and provides some possible function candidates.

no match for 'operator=' in 'cellskewness = Foam::cellQuality::skewness() const()'

I was wondering if there is a way to initialise the cellSkewness and cellNonOrthogonality variables as volScalarFields to ensure the data is written in a format that the foamToVTK utility can convert. Unless there is a meas to convert the scalarIOField output to VTK format somehow.

Also I have a separate question, still related to mesh quality. Is there a utility to calculate the geometric volume of a cell, as I want to be able to capture cell volume gradients?

Cheers Vassili
vas is offline   Reply With Quote

Old   May 16, 2005, 05:24
Default I would suggest making volScal
  #7
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
I would suggest making volScalarFields to start with. You can do the op = as follows:

cellSkewness.internalField() = qualityCheck.skewness();

Ditto for cell volumes.

A word of warning: if you want grad of cell volumes, you need to say something about boundary conditions, i.e. whether you want the volume on the boundary to be zero or zero gradient. By default, the constructor for volScalarField (and other geometric fields) will take a "calculated" b.c., so if you do (sorry, different names):

volScalarField vols
(
IOobject
(
"vols",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimVolume, 0.0)
);

you get zeros on the boundary, which affects the gradient (and probably in the right way! but you'll know whether that's what you want). :-)

Here's an example with zeroGradient boundaries:

volScalarField A
(
IOobject
(
"A",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("A", dimless/dimTime, 1),
zeroGradientFvPatchScalarField::typeName
);


You will need an include file for zeroGradient:

#include "zeroGradientFvPatchFields.H"

Aha, volumes:

vols.internalField() = mesh.V();

(and then if you want):

vols.correctBoundaryConditions();

Isn't FOAM nice!

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   May 16, 2005, 21:50
Default Thanks Hrvoje, I have made
  #8
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
Thanks Hrvoje,

I have made those modifications and uploaded the final files for anyone else that might want to utilise the code.

One note, however, in my mesh the nonOrthogonality function returned "nan" instead of a numerical result for a handful of cells in my mesh. Not sure why as these cells were not excessively nonOrthogonal or orthogonal for that matter.

analyticalCylinder.C
createAnalyticalFields.H
createGradFields.H
createCellQualityFields.H
files
options

Cheers Vas
vas is offline   Reply With Quote

Old   May 17, 2005, 05:07
Default Hi Vassili, The nan is usua
  #9
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 16
mattijs is on a distinguished road
Hi Vassili,

The nan is usually caused by a division by zero somewhere. If you rerun with environment variables

FOAM_SIGFPE
FOAM_ABORT

all set (to a non-empty value) the code should fall over immediately and you can use a debugger to look at where it goes wrong.
mattijs is offline   Reply With Quote

Old   May 18, 2005, 05:45
Default Thanks Hrvoje, I'll give th
  #10
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
Thanks Hrvoje,

I'll give that a go.

I have also been reading through the discussion board and there are various mentions of your thesis and the error estimation tools. I have been playing around with these FOAM functions and I would appreciate some further reading on the rational behind these functions.

I was wondering if you have a soft copy of your thesis that you could forward me. It would be much appreciated. My email address is vassili_kitsios@yahoo.com

Cheers Vas
vas is offline   Reply With Quote

Old   May 18, 2005, 05:58
Default Sorry Hrvoje, I found the l
  #11
vas
New Member
 
Vassili Kitsios
Join Date: Mar 2009
Location: Melbourne, Victoria, Australia
Posts: 7
Rep Power: 8
vas is on a distinguished road
Sorry Hrvoje,

I found the location your paper on the web from another area in the discussion group. I will go through it and possibly get back to you later.

Cheers Vas
vas is offline   Reply With Quote

Old   May 18, 2005, 09:30
Default Hello Vassili, No problem -
  #12
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Hello Vassili,

No problem - actually, a list of all my papers, including my PhD work on error estimation and adaptive meshing + FV discretisation etc. are available on my private web page:

http://www.h.jasak.dial.pipex.com/

All the research + code development has been done in FOAM over the last 12 years. If you want any of the papers that you cannot find on the web, please let me know.

I usually put my presentation slides there as well - you may find some interesting info on FOAM structure etc. This may not be the best place for it, but what started as a private home page now looks like FOAM-related data repository. :-) I will probably have to move it to a more sensible web address but that will be announced here.

As for talking about the work - I'd be delighted. Please feel free to contact me by E-mail.

Have fun,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   January 9, 2008, 06:15
Default Hi, I tried to use the code a
  #13
Member
 
David Segersson
Join Date: Mar 2009
Posts: 39
Rep Power: 8
segersson is on a distinguished road
Hi,
I tried to use the code attached above and found that it is out of date (think it's from OF 1.2).

Is there a recommended way to locate cells with low quality in OF? checkMesh writes a faceSet with nonOrthoFaces and I was thinking about writing a scalar field marking the cells containing these faces. It seems like this must have been done by a lot of users before. Is there anybody who can give me the steps to take or maybe send a code snippet?

Regards
David
segersson is offline   Reply With Quote

Old   January 9, 2008, 06:41
Default Much easier that that: use set
  #14
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Much easier that that: use setSet. A Help will give you an idea on how to use it - here's a little snippet I use often when dealing with poor meshes:

cellSet cellSet0 new faceToCell wrongOrientedFaces any

Got the gist?

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   January 9, 2008, 07:13
Default Thanks Hrvoje, I'm trying to
  #15
Member
 
David Segersson
Join Date: Mar 2009
Posts: 39
Rep Power: 8
segersson is on a distinguished road
Thanks Hrvoje,
I'm trying to compile setSet by running the Allwmake script and have trouble with:
.../libreadline.a: No such file or directory

Any hint on this as well?

David
segersson is offline   Reply With Quote

Old   January 9, 2008, 07:33
Default Some care required - follow th
  #16
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Some care required - follow the Allwmake script by hand (with understanding - the "parrot mode" will not work). You need to compile readline, adjust paths and variables to get it right and read messages about missed paths and libraries.

I have tried to get this sorted out but it seems the libraries never end up in consistent places between various linux flavours. Works on my machine though...

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   June 23, 2008, 10:54
Default The problem lies in the fact t
  #17
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
The problem lies in the fact that skewness is a face based property. The cellQuality.skewness() call returns a field of size nCells where the "cell" value is the max of all faces bordering a particular cell. If you want to change this behavior, call the faceSkewness function and create the cell-skewness field the way you want to.

I guess the cell-based return type is nice for post-processing, but it is also misleading if you are not aware of the implementation.
eugene is offline   Reply With Quote

Old   July 29, 2008, 09:38
Default Hi, Does anyone know the d
  #18
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 338
Rep Power: 9
lr103476 is on a distinguished road
Hi,

Does anyone know the difference between cellQuality.skewnewss() and mesh.checkFaceSkewness().

I mean, I get different maximal values while monitoring.....

Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   August 1, 2008, 13:49
Default Anyone? What's the differen
  #19
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 338
Rep Power: 9
lr103476 is on a distinguished road
Anyone?

What's the difference between cellQuality.skewnewss() and mesh.checkFaceSkewness().

Thanks, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   August 1, 2008, 16:17
Default The one from checkFaceSkewness
  #20
Super Moderator
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 16
mattijs is on a distinguished road
The one from checkFaceSkewness tries to include a measure of the 'height' of the face in the direction of the face centre. Gives more reasonably values for high aspect ratio faces.
mattijs is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tgrid and export bad quality cell mohr76 FLUENT 0 February 15, 2007 10:03
Evaluating multiple fluent files Ralf Schmidt FLUENT 0 October 25, 2004 05:15
Cell Quality Checks -> CPmatches Derek CD-adapco 2 August 6, 2004 04:36
Cell-vertex and cell-centered finite volume method Praveen Main CFD Forum 4 September 8, 2003 23:58
Evaluating CFD software Ernest Quintanilha Main CFD Forum 3 December 20, 2000 19:42


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