Now really how to avoid the dimensions

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

 August 29, 2007, 06:38 Hi all I need to compute so #1 New Member   Dragan Vidovic Join Date: Mar 2009 Posts: 17 Rep Power: 10 Sponsored Links 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?

 August 29, 2007, 06:51 First, dimensions are there fo #2 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,802 Rep Power: 24 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

 August 29, 2007, 13:14 Thanks Hrvoje for your answer. #3 New Member   Dragan Vidovic Join Date: Mar 2009 Posts: 17 Rep Power: 10 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!

 August 29, 2007, 15:31 Hi Dragan! What Hrv didn't #4 Assistant Moderator   Bernhard Gschaider Join Date: Mar 2009 Posts: 4,008 Rep Power: 43 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

 August 29, 2007, 15:49 You take the fun out of being #5 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,802 Rep Power: 24 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

 August 30, 2007, 04:12 Thanks Bernhard! But I prefer #6 New Member   Dragan Vidovic Join Date: Mar 2009 Posts: 17 Rep Power: 10 Thanks Bernhard! But I prefer to keep sharp knifes in their folders most of the time

 August 30, 2007, 06:25 Hi, me again. I noticed that i #7 New Member   Dragan Vidovic Join Date: Mar 2009 Posts: 17 Rep Power: 10 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

 August 30, 2007, 06:35 It depends on what you want to #8 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,802 Rep Power: 24 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

 August 30, 2007, 07:58 Thanks Hrvoje. Dragan #9 New Member   Dragan Vidovic Join Date: Mar 2009 Posts: 17 Rep Power: 10 Thanks Hrvoje. Dragan

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post bala Siemens 5 March 6, 2008 05:23 Fabian CFX 0 January 8, 2008 14:35 Gustavo CFX 0 December 19, 2006 13:33 richard Main CFD Forum 4 March 7, 2006 16:22 sameer CFX 1 February 2, 2006 20:10