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

Now really how to avoid the dimensions

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 29, 2007, 06:38
Default Hi all I need to compute so
  #1
New Member
 
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 8
vitke is on a distinguished road
Hi all

I need to compute some material properties from empirical polynomial corelations depending on the temperature, like this: http://users.wpi.edu/~ierardi/PDF/air_cp_plot.PDF . I have the temperature in volScalarField. Of course, dimensions do not match. I want to strip the dimension, evaluate the polynomial, and then impose propper dimensions. At the moment I define a dimensionedScalar containing one Kelvin, divide teperature with it, and finally multiply everything with another dimensionedScalar containing 1 [ 0 2 -2 -1 0]. But this is so ugly, and probably also time consuming. Is there any better way?
vitke is offline   Reply With Quote

Old   August 29, 2007, 06:51
Default First, dimensions are there fo
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,762
Rep Power: 21
hjasak will become famous soon enough
First, dimensions are there for your protection: it have saved my bacon more times than I care to remember.

Second, I bet you are doing something wrong. The internal field of the temperature field can be accessed without dimensions, eg.

volScalarField T(...);

scalarField& Tin = T.internalField();

forAll (Tin, cellI)
{
Tin[cellI] = blah blah, your polynomial;

}

This will not check the dimensions at all.

Third, dimension checking in OpenFOAM is done very carefully, to be executed only once for complete arrays and not for single values. Therefore, dimension checking basically costs you nothing in execution time.


However, if you do:

T = dimensionedScalar("fromPolynomial", dimTemperature, 77);

you are setting the WHOLE field to 77 and dimensions are checked. This will check the dimensions and basically cause trouble + the result will not be what you expect.

Clear?

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

Old   August 29, 2007, 13:14
Default Thanks Hrvoje for your answer.
  #3
New Member
 
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 8
vitke is on a distinguished road
Thanks Hrvoje for your answer. Dimensions are great, I agree, but those engineering "correlations" obtained by fitting a polynomial into experimental data showing dependence of material properties on temperature are based on adding grannies and frogs, if you know what I mean .

So I use

Cp.internalField() = myPolynomial(T.internalField());

and it works great. This is just what I wanted. Thanks again!
vitke is offline   Reply With Quote

Old   August 29, 2007, 15:31
Default Hi Dragan! What Hrv didn't
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Dragan!

What Hrv didn't point out to you is that you can switch off dimension checking for your installation completely: http://www.cfd-online.com/cgi-bin/Op...how.cgi?1/5281

He propably didn't tell you, because that would be like allowing children to run around with sharp knifes. I'm not such a responsible person, so I'm telling.

BTW: Don't know if it still works for 1.4. I never tried. My parents taught me not to run around with sharp knifes
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 29, 2007, 15:49
Default You take the fun out of being
  #5
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,762
Rep Power: 21
hjasak will become famous soon enough
You take the fun out of being a grown-up... At least now I know what you want for Christmas!

Thanks Bernhard, a complete answer is always a pleasure to see.

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

Old   August 30, 2007, 04:12
Default Thanks Bernhard! But I prefer
  #6
New Member
 
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 8
vitke is on a distinguished road
Thanks Bernhard! But I prefer to keep sharp knifes in their folders most of the time
vitke is offline   Reply With Quote

Old   August 30, 2007, 06:25
Default Hi, me again. I noticed that i
  #7
New Member
 
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 8
vitke is on a distinguished road
Hi, me again. I noticed that if I only modify the internalField, the boundary field of my Cp is not modified (of course) and becomes inconsistent. I'm not quite sure that these boundary values won't be used somewhere, so I'd be happier to make them consistent. Do I have to compute the boundary field separately, or is there finally a way to switch off the dimensions checking in the code, do the computation, and switch it back again? Bernhard, the link that you sent to me referes to this page.

Dragan
vitke is offline   Reply With Quote

Old   August 30, 2007, 06:35
Default It depends on what you want to
  #8
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,762
Rep Power: 21
hjasak will become famous soon enough
It depends on what you want to do:

- if you want to calculate the values by polynomials again, do the same as for internal field for all patches of the boundary field. You probably already have the "calculated" boundary condition so no problem there

- if you want to have the boundary value sate as the cell next to it, specify the zeroGradient patch field type for the Cp field at creation, calculate the internal field and call Cp.correctBoundaryConditions();

Enjoy,

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

Old   August 30, 2007, 07:58
Default Thanks Hrvoje. Dragan
  #9
New Member
 
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 8
vitke is on a distinguished road
Thanks Hrvoje.

Dragan
vitke 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
how to avoid self intersection:Proam bala CD-adapco 5 March 6, 2008 05:23
How to avoid interface separation? Fabian CFX 0 January 8, 2008 14:35
Dimensions Gustavo CFX 0 December 19, 2006 13:33
processors to avoid richard Main CFD Forum 4 March 7, 2006 16:22
how to avoid zero volume elements sameer CFX 1 February 2, 2006 20:10


All times are GMT -4. The time now is 10:00.