
[Sponsors] 
February 6, 2012, 18:34 
Field Function relating to temperature. Please Help

#1 
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
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. 

February 7, 2012, 00:04 

#2 
Member
aerosapien
Join Date: Sep 2010
Posts: 59
Rep Power: 7 

February 7, 2012, 01:38 

#3  
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
Quote:
THanks! 

February 7, 2012, 07:10 

#4 
Member
Join Date: Feb 2011
Location: DEPB
Posts: 56
Rep Power: 6 
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. 

February 7, 2012, 12:30 

#5  
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
Quote:
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.) 

February 7, 2012, 13:44 

#6  
Super Moderator
Ryne Whitehill
Join Date: Aug 2009
Posts: 313
Rep Power: 10 
Quote:
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> 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 xdirection, and the numbers for L are in meters. Just to show where I got values below, Slope of Seg B: (70150)/(.75.5) = 320 Slope of Seg C: (3570)/(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 Last edited by rwryne; February 7, 2012 at 17:16. Reason: spelling 

February 7, 2012, 16:46 

#7  
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
Quote:
Many many thanks! I will try this right away. 

February 7, 2012, 17:17 

#8 
Super Moderator
Ryne Whitehill
Join Date: Aug 2009
Posts: 313
Rep Power: 10 

February 7, 2012, 18:38 

#9  
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
Quote:
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. :/ 

February 7, 2012, 22:37 

#10  
Super Moderator
Ryne Whitehill
Join Date: Aug 2009
Posts: 313
Rep Power: 10 
Quote:
If so, did you make sure to clear the current solution and hit Solution>Initialize? 

February 8, 2012, 03:39 

#11 
Member
Join Date: Feb 2011
Location: DEPB
Posts: 56
Rep Power: 6 
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 xaxis parallel to the tube length? Does the origin of the coordinate system fits your test condition? 

February 8, 2012, 12:50 

#12  
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
Quote:
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:
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. 

February 8, 2012, 17:13 

#13 
New Member
kj878
Join Date: Feb 2012
Posts: 10
Rep Power: 5 
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! 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
LiencubiclowRemodel  nzy102  OpenFOAM Bugs  14  January 10, 2012 09:53 
latest OpenFOAM1.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 