| | |
Applying heat flux on a tube surface
Thread Solved
![]() |
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
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?
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?
C++ Syntax (Toggle Plain Text)
#include "udf.h" /* profile for heat flux*/ DEFINE_PROFILE(heatflux_profile, t, i) { /* declaring variables */ real x[ND_ND]; /* this will hold the position vector */ real y; real z; face_t f; begin_f_loop(f, t) { F_CENTROID(x, f,t); if ((y = 126.1620 + (-1*1004.0820)) && (z= 166.1620 + (-1* -1004.0880))); F_PROFILE(f, t, i) =500; else F_PROFILE(f,t,i)=350; } end_f_loop(f, t) }
•
•
Join Date: Feb 2009
Posts: 71
Reputation:
Solved Threads: 9
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:
But
This seems to make more sense:
C++ Syntax (Toggle Plain Text)
if( (y == 126.1620 -1004.0820) && (z == 166.1620 + 1004.0880) ) { F_PROFILE(f, t, i) =500; else F_PROFILE(f,t,i)=350; }
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? •
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
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
The oter part is teh same as the previous code. In C++ how do I set the condition if y and z are met.
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)
}
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Feb 2009
Posts: 71
Reputation:
Solved Threads: 9
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?
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.
![]() |
Other Threads in the C++ Forum
- Previous Thread: problem in makefile
- Next Thread: windows api help
| Thread Tools | Search this Thread |
action api array auto based beginner binary bitmap c++ c/c++ calculator challenge char class classes code coding compile console conversion count createcopyofanyfileinc delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game garbage givemetehcodez graph gui hmenu homeworkhelp homeworkhelper iamthwee ifstream input insert int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node noob output parameter pointer primenumbersinrange problem program programming project python random read recursion reference rpg sockets string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






