Applying heat flux on a tube surface (3D)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tendolm
    New Member
    • Mar 2009
    • 6

    Applying heat flux on a tube surface (3D)

    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?

    Code:
    #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)
    }
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    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

    Comment

    • tendolm
      New Member
      • Mar 2009
      • 6

      #3
      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.

      Comment

      • tendolm
        New Member
        • Mar 2009
        • 6

        #4
        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.

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by tendolm
          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.
          That's a finit line segment; what are the formulae for 'applying heat to a line'?

          kind regards,

          Jos

          Comment

          • tendolm
            New Member
            • Mar 2009
            • 6

            #6
            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_profil e, 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)
            }
            Last edited by tendolm; Mar 13 '09, 09:06 AM. Reason: Had left out some information

            Comment

            • donbock
              Recognized Expert Top Contributor
              • Mar 2008
              • 2427

              #7
              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.

              Comment

              • tendolm
                New Member
                • Mar 2009
                • 6

                #8
                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.

                Comment

                • tendolm
                  New Member
                  • Mar 2009
                  • 6

                  #9
                  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,A LT, 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,ste p;
                  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*(36 0*(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(AAZ I*P)*sin(omega* P);
                  cos_theta = cos_theta1-cos_theta2+cos_ theta3+cos_thet a4+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(omeg a*P)+sin(del*P) *sin(PHI*P);
                  Rb =cos_theta/cos_thetaz;
                  Gon = 1353*(1+0.033*c os(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_th etaz;
                  Pb=TCEF*ETAP*Gb *Rb*iam;
                  iamd =1-tan(pow(PI/6,IAMC));
                  x1= acos((ODTUBE-IDTUBE)/TCD);
                  x3 = acos((ODTUBE+ID TUBE)/TCD);
                  Z = sqrt(pow(TCD+OD TUBE*cos(PI+x1)- IDTUBE*sin(x1), 2.)+
                  pow(ODTUBE*sin( PI+x1)-IDTUBE*sin(x1), 2.));
                  f12 = 1*((PI-x1-x3)*IDTUBE+Z+(x 3-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;
                  }
                  }

                  Comment

                  Working...