Applying heat flux on a tube surface

Thread Solved
Reply

Join Date: Feb 2009
Posts: 9
Reputation: tendolm is an unknown quantity at this point 
Solved Threads: 0
tendolm tendolm is offline Offline
Newbie Poster

Applying heat flux on a tube surface

 
0
  #1
Mar 12th, 2009
I want to apply heat on a tube surface (3D). The heat is to be applied on a straight line on the tube. The equation of line is
x= 87.5
y = 126.1620 + (-1*1004.0820)
z= 166.1620 + (-1*-1004.0880)

Since x is constant is given asposition holder, real x[ND_ND];
For this constant value of x, heat is appiled on the line with the equation above. (If y and z are satisfied.
I have created my code below and when I try to interprete it, there is an error report:
Error line 16: invalid type for &&: float && float.
This is the line 16
((y = 126.1620 + (-1*1004.0820)) && (z= 166.1620 + (-1*
-1004.0880)));
How do I correct the error?

  1. #include "udf.h"
  2.  
  3. /* profile for heat flux*/
  4. DEFINE_PROFILE(heatflux_profile, t, i)
  5. {
  6. /* declaring variables */
  7. real x[ND_ND]; /* this will hold the position vector */
  8. real y;
  9. real z;
  10. face_t f;
  11.  
  12. begin_f_loop(f, t)
  13. {
  14. F_CENTROID(x, f,t);
  15. if
  16. ((y = 126.1620 + (-1*1004.0820)) && (z= 166.1620 + (-1*
  17. -1004.0880)));
  18. F_PROFILE(f, t, i) =500;
  19. else
  20. F_PROFILE(f,t,i)=350;
  21. }
  22. end_f_loop(f, t)
  23. }
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 71
Reputation: r.stiltskin is an unknown quantity at this point 
Solved Threads: 9
r.stiltskin r.stiltskin is offline Offline
Junior Poster in Training

Re: Applying heat flux on a tube surface

 
0
  #2
Mar 13th, 2009
Is this supposed to be C++ or is it some other language?
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 476
Reputation: nucleon has a spectacular aura about nucleon has a spectacular aura about 
Solved Threads: 91
nucleon's Avatar
nucleon nucleon is offline Offline
Posting Pro in Training

Re: Applying heat flux on a tube surface

 
0
  #3
Mar 13th, 2009
He's using a special header.

You do not want the semicolon at the end of the parenthesized portion of the if statement.

Other than that, it seems weird to be assigning y and z a constant value and then testing whether or not either are zero, which is what your code is doing.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,999
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 137
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: Applying heat flux on a tube surface

 
0
  #4
Mar 13th, 2009
Your "line equation" is wrong -- you have defined a point.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 71
Reputation: r.stiltskin is an unknown quantity at this point 
Solved Threads: 9
r.stiltskin r.stiltskin is offline Offline
Junior Poster in Training

Re: Applying heat flux on a tube surface

 
0
  #5
Mar 13th, 2009
Perhaps you intended a test for equality (==), rather than assigment (=). And why the unnecessarily confusing multiplication by -1 in the first expression and double negative in the second?
This seems to make more sense:
  1. if( (y == 126.1620 -1004.0820) && (z == 166.1620 + 1004.0880) ) {
  2. F_PROFILE(f, t, i) =500;
  3. else
  4. F_PROFILE(f,t,i)=350;
  5. }

But begin_f_loop(f, t) and end_f_loop(f, t) don't look like any kind of C/C++ syntax I've ever seen. What is that supposed to be doing? How is it a loop?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 9
Reputation: tendolm is an unknown quantity at this point 
Solved Threads: 0
tendolm tendolm is offline Offline
Newbie Poster

Re: Applying heat flux on a tube surface

 
0
  #6
Mar 13th, 2009
This code is developed in C++ and used in a computational fluid dynamics model (CFD), Fluent, and these other fetures are part of Fluent. If I get correct the part of stating my if condition then everything else will work.
If I do not use the if condition and apply only heat to the surface decribed by my line equation. I am able to interprete the code into Fluent. I have writen it as
begin_f_loop(f, t)
{
F_CENTROID(x, f,t);

y = 126.1620 + (-1*1004.0820);
z= 166.1620 + (-1*-1004.0880);
F_PROFILE(f, t, i) =500;

}
end_f_loop(f, t)
}
The oter part is teh same as the previous code. In C++ how do I set the condition if y and z are met.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 9
Reputation: tendolm is an unknown quantity at this point 
Solved Threads: 0
tendolm tendolm is offline Offline
Newbie Poster

Re: Applying heat flux on a tube surface

 
0
  #7
Mar 13th, 2009
How do I define a line in 3D
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 9
Reputation: tendolm is an unknown quantity at this point 
Solved Threads: 0
tendolm tendolm is offline Offline
Newbie Poster

Re: Applying heat flux on a tube surface

 
0
  #8
Mar 13th, 2009
Please assist me form the equation of line. The staring point is (87.5, 126.162, 166.162) and the end point is (87.5, 877.97, 1170.25)
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 9
Reputation: tendolm is an unknown quantity at this point 
Solved Threads: 0
tendolm tendolm is offline Offline
Newbie Poster

Re: Applying heat flux on a tube surface

 
0
  #9
Mar 13th, 2009
My equation of line is
x=87.5
y= 126.162-(1004.082)t
z=166.162-(-1004.088)t
and 0<=t<=1.
(0 is less or equal to t but t is less or equal to 1)

I want to develop a code that applies one value of heat on this line on a tube and another value on other parts of the tube
This code will then be intepreted in Fluent (computational fluid dynamics package) and used for numerical simulation of temperature change in the tube as a result of applied heat.
Please just assist develop this code in C ignoring parts involving Fluent language. If I get this correct in C then will make necessary changes to suit Fluent
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 71
Reputation: r.stiltskin is an unknown quantity at this point 
Solved Threads: 9
r.stiltskin r.stiltskin is offline Offline
Junior Poster in Training

Re: Applying heat flux on a tube surface

 
0
  #10
Mar 13th, 2009
You want to apply one value using the F_PROFILE function to points on your line, and another value using that function "everyplace else", but in C you must define points in terms of discrete values for x, y and z. (Unless there is some way to deal with continuous values in Fluent, but in that case your question is really how to write that in Fluent, not in C.)

Therefore, before we can give you the C code, you must provide ranges for x, y, and z, and you must provide increment sizes for x, y and z in order to compute discrete points in xyz space.

Also, you gave an interval [0,1] for t, but is that really relevant? I don't think you want a 4-dimensional (xyzt) loop. Don't you really want to leave t as a variable in the conditional expression, to be assigned explicit values elsewhere in the code or possibly at runtime?
Last edited by r.stiltskin; Mar 13th, 2009 at 10:43 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC