CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > STAR-CCM+

Field Function relating to temperature. Please Help

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

Like Tree1Likes
  • 1 Post By rwryne

Reply
 
LinkBack Thread Tools Display Modes
Old   February 6, 2012, 18:34
Default Field Function relating to temperature. Please Help
  #1
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road


So I'm fairly knew to StarCCM and I need to set up my initial conditions such that my wall temperature changes linearly from one end to the other. I believe I have to write a field function to do this but. Unfortunately I have zero experience in writing programs/codes and I have no idea how to write field function formula for my problem.

Wont someone be kind enough to help me write a field function?

My problem statement is a fluid flowing through a pipe, length say 1m and the temperature of the wall varies through the length.

From L=0 to L=.5 I need my wall temp to be at 150C. From L=.5 to L=.75, the wall temp needs to drop from 150C to 70C, linearly. Similarly, from L=.75 to L=1m, the wall temp needs to drop from 70C to 35C, linearly as well.

Can someone please help me with this??
Many thanks in advance!

Last edited by kj878; February 7, 2012 at 12:32.
kj878 is offline   Reply With Quote

Old   February 7, 2012, 00:04
Default
  #2
Member
 
sanjay's Avatar
 
aerosapien
Join Date: Sep 2010
Posts: 59
Rep Power: 6
sanjay is on a distinguished road
why don't you work out an tutorial in CCM+, it might help you.

regards
www.aerosapien.blogspot.com
sanjay is offline   Reply With Quote

Old   February 7, 2012, 01:38
Default
  #3
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road
Quote:
Originally Posted by sanjay View Post
why don't you work out an tutorial in CCM+, it might help you.

regards
www.aerosapien.blogspot.com
that was the first thing I did was to find tutorials that I could use to relate to my work. however, I was able to find a good tutorial on field functions. If you could direct me to one, it would be greatly appreciated.
THanks!
kj878 is offline   Reply With Quote

Old   February 7, 2012, 07:10
Default
  #4
Member
 
Join Date: Feb 2011
Location: DE-PB
Posts: 56
Rep Power: 6
willimanili is on a distinguished road
You can easily create an Surface Standard Deviation report for your boundary and the value for which you would like to calculate the variance. So with this report you have already the standard deviation. Now create your own field function which gives you the square of the reports result ( the definition should be kind of: pow($SurfaceStandardDeviationReport,2) ). Now you can create an report which gives you the result for your fieldfunction which is the variance you are searching for.

Last edited by willimanili; February 7, 2012 at 08:27.
willimanili is offline   Reply With Quote

Old   February 7, 2012, 12:30
Default
  #5
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road
Quote:
Originally Posted by willimanili View Post
You can easily create an Surface Standard Deviation report for your boundary and the value for which you would like to calculate the variance. So with this report you have already the standard deviation. Now create your own field function which gives you the square of the reports result ( the definition should be kind of: pow($SurfaceStandardDeviationReport,2) ). Now you can create an report which gives you the result for your fieldfunction which is the variance you are searching for.
Thank you for your input but I'm afraid you misunderstood my problem statement.
I dont need a statistical report such as calculating the variance or the standard deviation. but I need to set the initial conditions of the walls in my pipe certain values.

the question I have is, how can I set the wall temperatures such that it changes linearly from one end to the other.

more specifically, if I have a wall 1m long, I need:
From L=0 to L=.5 I need my wall temp to be at 150C. From L=.5 to L=.75, the wall temp needs to drop from 150C to 70C, linearly. Similarly, from L=.75 to L=1m, the wall temp needs to drop from 70C to 35C, linearly as well.

Thanks anyway for your help, but it wasn't what I was looking. (at least now I know how to calculate the SD and the variance.)
kj878 is offline   Reply With Quote

Old   February 7, 2012, 13:44
Default
  #6
Super Moderator
 
Ryne Whitehill
Join Date: Aug 2009
Posts: 313
Rep Power: 9
rwryne is on a distinguished road
Quote:
Originally Posted by kj878 View Post
Thank you for your input but I'm afraid you misunderstood my problem statement.
I dont need a statistical report such as calculating the variance or the standard deviation. but I need to set the initial conditions of the walls in my pipe certain values.

the question I have is, how can I set the wall temperatures such that it changes linearly from one end to the other.

more specifically, if I have a wall 1m long, I need:
From L=0 to L=.5 I need my wall temp to be at 150C. From L=.5 to L=.75, the wall temp needs to drop from 150C to 70C, linearly. Similarly, from L=.75 to L=1m, the wall temp needs to drop from 70C to 35C, linearly as well.

Thanks anyway for your help, but it wasn't what I was looking. (at least now I know how to calculate the SD and the variance.)

Youll just need to use some embedded if statements. I assume you know the syntax, but just in case:

Code:
<Test Condition> ? <statement if true> : <statement if false>
The easiest way to do this without making a super long single field function is to make 4 field functions:

TempSegA : for first piece
TempSegB : for second piece
TempSegC : for third piece
TempAll : sum of above, appled as IC.

Make sure the units for all of the above field functuions are temperature.

I am assuming L is in the x-direction, and the numbers for L are in meters.

Just to show where I got values below,

Slope of Seg B: (70-150)/(.75-.5) = -320
Slope of Seg C: (35-70)/(1-.75) = -140

TempSegA function:
$Position[0] < 0.5 ? 423.15 : 0
TempSegB function:
$Position[0] > 0.5 ? $Position[0] <=0.75 ? 423.15 -320*($Position[0]-0.5) : 0 : 0
TempSegC function:
$Position[0] > .75 ? $Position[0] <=1? 343.15 -140*($Position[0]-0.75) : 0 : 0


TempAll function:

$TempSegA + $TempSegB + $TempSegC

Now set TempAll as your IC and initialize
kj878 likes this.

Last edited by rwryne; February 7, 2012 at 17:16. Reason: spelling
rwryne is offline   Reply With Quote

Old   February 7, 2012, 16:46
Default
  #7
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road
Quote:
Originally Posted by rwryne View Post
Youll just need to use some imbedded if statements. I assume you know the syntax, but just in case:

Code:
<Test Condition> ? <statement if true> : <statement if false>
The easiest way to do this without making a super long single field function is to make 4 field functions:

TempSegA : for first piece
TempSegB : for second piece
TempSegC : for third piece
TempAll : sum of above, appled as IC.

Make sure the units for all of the above field functuions are temperature.

I am assuming L is in the x-direction, and the numbers for L are in meters.

Just to show where I got values below,

Slope of Seg B: (70-150)/(.75-.5) = -320
Slope of Seg C: (35-70)/(1-.75) = -140

TempSegA function:
$Position[0] < 0.5 ? 423.15 : 0
TempSegB function:
$Position[0] > 0.5 ? $Position[0] <=0.75 ? 423.15 -320*($Position[0]-0.5) : 0 : 0
TempSegC function:
$Position[0] > .75 ? $Position[0] <=1? 343.15 -140*($Position[0]-0.75) : 0 : 0


TempAll function:

$TempSegA + $TempSegB + $TempSegC

Now set TempAll as your IC and initialize
PERFECT!
Many many thanks!
I will try this right away.
kj878 is offline   Reply With Quote

Old   February 7, 2012, 17:17
Default
  #8
Super Moderator
 
Ryne Whitehill
Join Date: Aug 2009
Posts: 313
Rep Power: 9
rwryne is on a distinguished road
Quote:
Originally Posted by kj878 View Post
PERFECT!
Many many thanks!
I will try this right away.
There are probably a few small issues, you should be able to work them out. I am very much a "test as you write it" type of coder, and I did not test these.

Let me know if there are any issues!

-Ryne
rwryne is offline   Reply With Quote

Old   February 7, 2012, 18:38
Default
  #9
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road
Quote:
Originally Posted by rwryne View Post
There are probably a few small issues, you should be able to work them out. I am very much a "test as you write it" type of coder, and I did not test these.

Let me know if there are any issues!

-Ryne
Hey, I just typed the code and tried it and I'm not sure its working correctly.

The wall temperature is dropping to 0 Kelvin everywhere.

ps. I already had the walls divided into three separate regions so I assigned the field function to the corresponding wall section. since the 1st segment is always 150C, i just assigned it as a constant.
next two segments, i assigned their individual field function respectively but its results as 0. :/
kj878 is offline   Reply With Quote

Old   February 7, 2012, 22:37
Default
  #10
Super Moderator
 
Ryne Whitehill
Join Date: Aug 2009
Posts: 313
Rep Power: 9
rwryne is on a distinguished road
Quote:
Originally Posted by kj878 View Post
Hey, I just typed the code and tried it and I'm not sure its working correctly.

The wall temperature is dropping to 0 Kelvin everywhere.

ps. I already had the walls divided into three separate regions so I assigned the field function to the corresponding wall section. since the 1st segment is always 150C, i just assigned it as a constant.
next two segments, i assigned their individual field function respectively but its results as 0. :/
You made sure to apply these field functions as the temperature for these boundaries, right?

If so, did you make sure to clear the current solution and hit Solution->Initialize?
rwryne is offline   Reply With Quote

Old   February 8, 2012, 03:39
Default
  #11
Member
 
Join Date: Feb 2011
Location: DE-PB
Posts: 56
Rep Power: 6
willimanili is on a distinguished road
First of all sry for the misunderstanding, but it thought you where asking for the temperature variance at your walls.

So Ryne gave you already the solution. By the way good advice to use more than one long fielfunction.

Check the coordinate system where the fieldfunctions are corresponding to. Is it at the right position? Is the x-axis parallel to the tube length? Does the origin of the coordinate system fits your test condition?
willimanili is offline   Reply With Quote

Old   February 8, 2012, 12:50
Default
  #12
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road
Quote:
Originally Posted by willimanili View Post
First of all sry for the misunderstanding, but it thought you where asking for the temperature variance at your walls.

So Ryne gave you already the solution. By the way good advice to use more than one long fielfunction.

Check the coordinate system where the fieldfunctions are corresponding to. Is it at the right position? Is the x-axis parallel to the tube length? Does the origin of the coordinate system fits your test condition?
Ya I read the original post and changed the wording a bit, I can see why someone could sees as if I was looking for The variance.


Ya the coordinate system is kinda of messed up. The origin is located at L/2. So 1st segment would be from -.5 to 0, second from 0 to .25 and the last bit .25 to 5. But I changed the field function coding accordingly.

Quote:
Originally Posted by rwryne View Post
You made sure to apply these field functions as the temperature for these boundaries, right?

If so, did you make sure to clear the current solution and hit Solution->Initialize?
Yes and Yes.
I will try to work on it more a little bit and see if I can get it to work.
Right now Im just running my analysis with the three sections assigned with an average constant temperature. But in order to get a more accurate result, I want to need to have a wall section where the temperature drops, as is in real life.


For those who are wondering, I am trying to melt/solidify a fluid going through a pipe and measure the shear force from the fluid while going through the said pipe.
It is to simulate a process called Pultrusion, where there are materials being pulled through a die, melted to consolidated and weld the materials together and freeze it in the die to form the shape of the said die.
kj878 is offline   Reply With Quote

Old   February 8, 2012, 17:13
Default
  #13
New Member
 
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5
kj878 is on a distinguished road
finally got it!

it was a combination of bunch of syntax mistakes and funky coordinate system that threw me off.

took me 3 days figure out how to write :/

thanks everyone!
kj878 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
LiencubiclowRemodel nzy102 OpenFOAM Bugs 14 January 10, 2012 09:53
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
Version 15 on Mac OS X gschaider OpenFOAM Installation 120 December 2, 2009 11:23
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


All times are GMT -4. The time now is 09:35.