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? - #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)
-
}
8 3859 gpraghuram 1,275
Recognized Expert Top Contributor
Hi,
In both the expressions you are assigning value to the float and i think it will be always true.
Since u AND both the float variables u are getting the error.
move both the assignments before if condition and check if u need to change the condition after this
Raghu
I think let me take you back. The line on which I want to apply heat has the following starting point (87.5, 126.162, 166.162) and end point (87.5, -877.92, 1170.25) . I have been adviced that what I have in my code is describing a point not a line, Do you know I develop equation of this line? If this is solved then I can move on to my previous question.
My equation of line is
x=87.5
y= 126.162-(1004.082)t
z=166.162-(-1004.088)t
and 0<<t<=1.
I want to develop a code that applies heat to this line.
JosAH 11,448
Recognized Expert MVP @tendolm
That's a finit line segment; what are the formulae for 'applying heat to a line'?
kind regards,
Jos
All this other information you are not familiar with is used in a computational fluid dynamics package (Fluent) where I am going to interprete my code. To assist me try to develop a code that assigns heat of 500W/m2 to the line in C++. If I get that one correct I can then make necessary changes to suit Fluent.
For exampleto apply heat to a point I use the code below.
#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);
y = -877.92;
z= 1170.25;
F_PROFILE(f, t, i) =500;
}
end_f_loop(f, t)
}
donbock 2,426
Recognized Expert Top Contributor
I'm not familiar with this fluid dynamics package. I can't help you until you tell me how this package expects you to specify a line. I can think of two mechanisms:
1. It understands lines; so you give it the equation of the line.
2. It only understands points, so you step through the line and apply heat to successive points along the line. There are an infinite number of points in a line segment, so you can only apply heat to a representative subset of the line.
It understand lines, and x is catered for in
x[ND_ND] and my problem is to take into account the values of z and y for the constant x.
Dear friends
I have put my problem only in C++ so that you can be able to assist me. Please may you help me to:
1.write corectly the formular to determining Atb. It is supposed to be
Atb = a0 + a1exp(-k/cos_thetaz); With what I have done am getting wrong answers.
2. for a given value of n be able to print a table of p ie value of (x,y,z), h, n,
3. develop a code such that for the same value of n, I can calculate h for different values of p(x,y,z) for example when x=
x=117.433
y=84.62-(1004.08180)n
z=124.621-(-1004.089)n
h=(Pb+Pgr)
x=87.5
y=73.837-(1004.087)n
z=113.837-(-1004.083)n
h=(Pgr+Pd)/2
#include <stdio.h>
main()
{
double x,y,z,n,h,p;
double BETA, AAZI, PHI, LTIME, SMER, LMER, N, ITIME, FTIME, LTUBE, IDTUBE, ODTUBE;
double THLCOEF, TCEF, ETAP, TCD, ATEMP, IAMC, CFFCT0, CFFCT1,CFFCTK,ALT, ALBEDO, FCS1, PI;
double B, P, E,E1,Tcorr, stime, del, omega, cos_theta1,cos_theta2, cos_theta3;
double cos_theta4, cos_theta5, cos_theta, theta, Ai, iam, cos_thetaz, Rb, Gon;
double a0c, a1c,kc, a0, a1, k, Atb, Gb, iamd,Pb, x1,x3, Z;
double f12, fcs, Atd, Gd, Pd, Ggr, Pgr, Pu;
double lower,upper,step;
double cos (), sin(), tan(), acos(), pow(), sqrt();
lower =0.0; /*lower value of n limit*/
upper =1.0; /* upper limit*/
step =0.1; /*step size*/
n=lower;
while (n<=upper)
{
x=87.5;
y = 126.1620 -(1004.0820*n);
z= 166.1620 -(-1004.0880*n);
p=(x,y,z);
BETA =45; /* defining constants*/
AAZI =15;
PHI= 43;
LTIME= 690.03;
SMER =90;
LMER =89.4;
N =234;
ITIME =690;
FTIME =790;
LTUBE= 1.8;
IDTUBE = 0.0192;
ODTUBE =0.0292;
THLCOEF= 0.9;
TCEF =0.98;
ETAP =0.856;
TCD =0.067;
ATEMP = 298.15;
IAMC = 3.8;
CFFCT0 =0.97;
CFFCT1 = 0.99;
CFFCTK = 1.02;
ALT =0.27;
ALBEDO = 0.5;
FCS1 = 0.5;
PI =3.141592;
B= 360*(N-81)/364;
P=PI/180;
E=9.87*sin(2*B*P)-7.53*cos(B*P)-1.5*sin(B*P);
E1= 4*(SMER-LMER);
Tcorr=E+E1;
stime = LTIME+Tcorr;
del = 23.45*sin(P*(360*(284+N)/365));
omega = (stime-720)/60*15;
cos_theta1 = sin(del*P)*cos(BETA*P)*sin(PHI*P);
cos_theta2 = sin(del*P)*sin(BETA*P)*cos(PHI*P)*cos(AAZI*P);
cos_theta3 = cos(del*P)*cos(PHI*P)*cos(BETA*P)*cos(omega*P);
cos_theta4 = cos(del*P)*sin(PHI*P)*sin(BETA*P)*cos(AAZI*P)*cos( omega*P);
cos_theta5 = cos(del*P)*sin(BETA*P)*sin(AAZI*P)*sin(omega*P);
cos_theta = cos_theta1-cos_theta2+cos_theta3+cos_theta4+cos_theta5;
theta = acos(cos_theta)*57.295779513;
Ai =tan(pow((theta/2)*P,IAMC));
iam = 1-Ai;
cos_thetaz = cos(del*P)*cos(PHI*P)*cos(omega*P)+sin(del*P)*sin( PHI*P);
Rb =cos_theta/cos_thetaz;
Gon = 1353*(1+0.033*cos(P*(360*N/365)));
a0c =0.4237-0.00821*((6-ALT)*(6-ALT));
a1c = 0.5055+0.00595*((6.5-ALT)*(6.5-ALT));
kc = 0.2711+0.01858*((2.5-ALT)*(2.5-ALT));
a0 = CFFCT0 *a0c;
a1 = CFFCT1*a1c;
k = CFFCTK *kc;
Atb = a0 + a1*pow(10,(-k/cos_theta));
Gb =Gon*Atb*cos_thetaz;
Pb=TCEF*ETAP*Gb*Rb*iam;
iamd =1-tan(pow(PI/6,IAMC));
x1= acos((ODTUBE-IDTUBE)/TCD);
x3 = acos((ODTUBE+IDTUBE)/TCD);
Z = sqrt(pow(TCD+ODTUBE*cos(PI+x1)- IDTUBE*sin(x1),2.)+
pow(ODTUBE*sin(PI+x1)-IDTUBE*sin(x1),2.));
f12 = 1*((PI-x1-x3)*IDTUBE+Z+(x3-x1)*ODTUBE-TCD*sin(x3))/(2*PI*IDTUBE);
fcs= FCS1 -f12;
Atd = .2710-.2939*Atb;
Gd = Atd*Gon;
Pd = TCEF*ETAP*iamd*Gd*fcs;
Ggr =ALBEDO*(Gb+Gd);
Pgr =TCEF*ETAP*iamd*Ggr*fcs;
Pu=Pb+Pd+Pgr;
h=Pb,
printf("\n%5.4f",Atb,n);
n=n+step;
}
} Sign in to post your reply or Sign up for a free account.
Similar topics |
by: flyaflya |
last post by:
I want to join some surfaces to a new big surface with alpha cannel, I want
the new surface has same pixels(inclue r,g,b and alpha value) as the pixels
on the source surfaces.
my code as follow:...
|
by: NM |
last post by:
Hello all,
I am supposed to do some mixed programming with c++ and fortran.
I was succeeful in exchanging the 2D arrays from fortran to c++ and the
other way, but was unable
to that same with...
|
by: ljlevend |
last post by:
I need a chart for plotting 3D surfaces. Ideally it would use OpenGL or
Direct3D and be written in 100% .NET. I thought I saw an add a while back
but now I can't find it. Anybody know of such a...
|
by: buchstaebchen |
last post by:
Hi folks,
I need advice in finding an appropriate python module for 3D surface
plots, such as for the visualization of wave-dynamics...I'd prefer
something capable of being embedded in wxpython...
|
by: bimalkumar |
last post by:
hi, can anybody tell me a very simple code to import a Excel sheet data to flux grid in visual basic
thanks
| |
by: frueh22 |
last post by:
Ok so I wanted to play a video from You Tube, well not only You Tube but other sites that you can watch videos. With You Tube I click to play the video, it shows it loading then goes straight to the...
|
by: mercerlady |
last post by:
When i am watching a Video on youtube, it stops and starts and stops and starts, so i emailed you tube and they said it may be my browser, so i Have Internet Explorer, i uninstalled and reinstalled,...
|
by: PhilC |
last post by:
'''
################################################
Task:-
to apply a translation array to an array
of 3D vertex coordinates to produce the
resulting location of each vertices.
Translation...
|
by: Jameson |
last post by:
ok...
This isn't working, and I dont know why, when I pass the resulting
surface to StretchRectangle I get the awsome "error in application"
haha... anyway. Is this not the right way (using...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |