CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   how to solve warning C4700 (http://www.cfd-online.com/Forums/fluent-udf/125640-how-solve-warning-c4700.html)

ahvz October 28, 2013 11:07

how to solve warning C4700
 
I tried to used the below code but I have faced with "warning"

warning C4700: uninitialized local variable 'thermosensor_temperature' used
warning C4700: uninitialized local variable 'thermosensor_temperature' used

how to solve this warning? any helps ?

what is the reason of this kind of warnings ?

regards,
Code:

/***********************************************************************
udfexample.c
UDF for specifying the heater
 ************************************************************************/


#include "udf.h"
/* Obtain the mean temperature at the location of thermocouple */
/* Thermocouple located at coordinates (x,y,z) = (-0.24,0.185,0.26) */
DEFINE_EXECUTE_AT_END(tsensor)  /* DEFINE_EXECUTE_AT_END is a general-purpose macro that is executed at the end of an iteration in a steady state run, or at the end of a time step in a transient run. You can use DEFINE_EXECUTE_AT_END when you want to calculate flow quantities at these particular times. Note that you do not have to specify whether your execute-at-end UDF gets executed at the end of a time step or the end of an iteration. This is done automatically when you select the steady or unsteady time method in your ANSYS FLUENT model*/
{
 real thermosensor_coordinate[ND_ND];
 real thermosensor_temperature;
 real xmin;
 real xmax;
 real ymin;
 real ymax;
 real zmin;
 real zmax;
 real x,y,z,nt;
 
 cell_t c;
 Domain *d;
 Thread *t;
 d = Get_Domain(1);
 xmin=-0.22;
 xmax=-0.26;
 ymin=0.183;
 ymax=0.188;
 zmin=0.25;
 zmax=0.27;
 /* Begin loop to determine the temperature at the centroid of cells near the thermocouple */
 thread_loop_c(t,d)
 {
 nt=0.0;
 begin_c_loop(c,t)
 {
  C_CENTROID(thermosensor_coordinate,c,t);
 
  x=thermosensor_coordinate[0];
  y=thermosensor_coordinate[1];
  z=thermosensor_coordinate[2];
 
 
  if ((x >= xmin) && (x <= xmax))
  {
  if ((y >= ymin) && (y <= ymax))
  {
    if ((z >= zmin) && (z <= zmax))
    {
    thermosensor_temperature=thermosensor_temperature + C_T(c,t); /* get thermocouple temperature */
    nt=nt+1.0;      /* count number */
    }
  }
  }
 }
 end_c_loop(c,t)
 }
 thermosensor_temperature=thermosensor_temperature/nt;
}
DEFINE_PROFILE(heater_bc,t,i)
{
 real cutoff_temperature;
 real thermosensor_temperature;
 real heater_on;
 real heater_off;
 
 face_t f;
 cutoff_temperature=295.15;
 
 heater_off = 0.0;
 heater_on = 22500.0;
 if (thermosensor_temperature<=cutoff_temperature)
 {
  begin_f_loop(f,t)
  {
  F_PROFILE(f,t,i) = heater_on;
  }
  end_f_loop(f,t)
 }
 else
 {
  begin_f_loop(f,t)
  {
  F_PROFILE(f,t,i) = heater_off;
  }
  end_f_loop(f,t)
 }
}



All times are GMT -4. The time now is 19:14.