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

Temperature dependent property

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2007, 16:51
Default I'm trying a few things as a b
  #1
Member
 
Ken Darcovich
Join Date: Mar 2009
Location: Ottawa, Canada
Posts: 31
Rep Power: 17
kdarc is on a distinguished road
I'm trying a few things as a beginner, imitating an example from the programming manual, but don't seem to understand where the problem is arising:

in my createFields.H file I have :

volScalarField alpha_ht
(
IOobject
(
"alpha_ht",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
T
);

the parameter alpha_ht is meant to replace DT in laplacianFoam, as a heat transfer parameter that is temperature dependent.

in the app.C file, I have:

volScalarField alpha_ht = 181.0/((2606.0-0.21*T)*(1074.0 - 0.046168*T));

This is an expression for the temperature dependent DT parameter, just in front of the code for the PDE solve statement.

Can I use the variable T above, or does it need to be referenced in another way?



I in the 0/ directory I have an alpha_ht file, with initial statements:

dimensions [0 2 -1 0 0 0 0];

internalField uniform 4.0E-05;


Is this the source of the problem? I was thinking that the 0/alpha_ht file is a kind of dummy initialization, and the alpha_ht field would be overwritten by the code from the app.C file. ??

the run-time error is reported as:

--> FOAM FATAL ERROR : LHS and RHS of - have different dimensions
dimensions : [0 0 0 0 0 0 0] - [0 0 0 1 0 0 0]

makes no sense to me.

Any guidance most appreciated.

thanks.
kdarc is offline   Reply With Quote

Old   March 26, 2007, 17:16
Default Dear Ken, How can this erro
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Dear Ken,

How can this error not make sense to you: it says the dimensions of the terms in the differential equation you are trying to solve do not match.

In your constructor, you have made the dimensions of alpha_ht identical with the dimensions of T, which MUST be wrong.

Furthermore, you now have 2 field variables, both called alpha_ht, probably in different scopes. Further from that, you have specified alpha_ht file in the zero directory, but your constructor clearly says IOobject::NO_READ, meaning the field WILL NOT BE READ. The file will get ignored.

This sounds like nightmarish sloppy coding or maybe you are not sure what you'd like to do in the first place.

Guidance:
1 figure out what you want to do: create a field in the code or read it in
2 establish only a single variable called alpha_ht and initialise it in the right way (read from a file, calculated from your formula, or made to be identical to T
3 work out what the dimensions of alpha_ht should be for your equation to make physical sense.

Once you get this far, you will be able to answer questions on where alpha should come from, how you wish to construct and initialise it. We can then talk syntax etc. I would also encourage you to have a look at the existing OpenFOAM examples and see how (easily) this kind of thing is done.

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

Old   March 27, 2007, 15:57
Default The hurdles outlined above hav
  #3
Member
 
Ken Darcovich
Join Date: Mar 2009
Location: Ottawa, Canada
Posts: 31
Rep Power: 17
kdarc is on a distinguished road
The hurdles outlined above have been overcome.

the main rookie errors were:

1. not understanding that declaring alpha_ht in two places is fatal

2. not grasping that OF is worse than the old DDR border patrols when it comes to dimensional consistency...

in light of No. 2, I have:

>>>
dimensionedScalar a1 ("a1",dimensionSet(0, 0, 0, -1, 0, 0, 0),0.21);
dimensionedScalar a2 ("a2",dimensionSet(0, 0, 0, -1, 0, 0, 0),0.046168);
dimensionedScalar a3 ("a3",dimensionSet(0, 2, -1, 0, 0, 0, 0),181.0);

....

alpha_ht = a3/((2606.0-a1*T ) *(1074.0 - a2*T ));
<<<

the dimensionedScalar declarations seemed necessary to get the expression to match the declared dimensions of alpha_ht.

Is there any way possible to just write the expression for alpha_ht that produces a "number", (ie; we tried T.value(), didn't work, seems the .value() thing won't work on volScalarFields... )

The expression is somewhat artificial, it's a stat. regression expression for a coefficient, that gives the coeff. in the units it requires, but the a1,a2,a3 values inside it are purely empirical.

Is there some way of simplifying the expression for alpha_ht to a single line of code??

thanks,
Ken
kdarc is offline   Reply With Quote

Old   March 27, 2007, 16:21
Default Sure, You can circumvent di
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Sure,

You can circumvent dimensional checking if you wish to do so. Let's first make the field with the right dimensions:

volScalarField alpha_ht
(
IOobject
(
"alpha_ht",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("at", your_dimensions_here, 0),
);


Now, you can set the internal and boundary field separately


alpha_ht.internalField() = a3/((2606.0-a1*T.internalField() ) *(1074.0 - a2*T.internalField()));
alpha_ht.boundaryField() = a3/((2606.0-a1*T.boundaryField() ) *(1074.0 - a2*T.boundaryField()));


You can be even more clever, using, e.g. a zero gradient boundary condition to get the patch values etc, but this should do the job for the moment. Note how I have specified the field to be no-read and no-write and associated it with the mesh: this means you can merrily do field calculus with it, like for example evaluating its gradient

Enjoy,

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

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time Dependent Temperature Dependent BC Analysis RP Main CFD Forum 1 March 28, 2008 01:22
Geometrical dependent physical property Jiri Novak FLUENT 4 October 24, 2005 12:08
to take K & Cp as temperature dependent kishore rathore FLUENT 1 February 17, 2004 04:33
Time Dependent property S Rhie Phoenics 2 August 28, 2001 12:12
Property variation with temperature G.Balakrishnan FLUENT 1 December 16, 2000 06:51


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