Field Function relating to temperature. Please Help
:confused:
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! 

Quote:
THanks! 
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.

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.) 
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 
Quote:
Many many thanks! I will try this right away. 
Quote:
Let me know if there are any issues! Ryne 
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. :/ 
Quote:
If so, did you make sure to clear the current solution and hit Solution>Initialize? 
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? 
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. 
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! 
All times are GMT 4. The time now is 20:19. 