CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

how to solve warning C4700

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ahvz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2013, 11:07
Default how to solve warning C4700
  #1
Senior Member
 
Moha
Join Date: Mar 2013
Location: EU
Posts: 103
Rep Power: 0
ahvz is on a distinguished road
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)
 }
}
Oula likes this.
ahvz is offline   Reply With Quote

Old   October 29, 2018, 12:24
Default
  #2
Member
 
Oula
Join Date: Apr 2015
Location: United Kingdom
Posts: 81
Rep Power: 11
Oula is on a distinguished road
Hi ahvz

did you managed to solve this problem. Could you please share you experience?

Regards
Oula
Oula is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[CGNS] CGNS converters available mbeaudoin OpenFOAM Meshing & Mesh Conversion 137 December 14, 2018 05:20
[swak4Foam] wmake groovyBC in OpenFOAM 1.7 ? randomid OpenFOAM Community Contributions 1 August 27, 2010 06:15
Can anybody help me to solve the list errors while compiling Openfoam 15 on Opensuse 103 32bit coompressor OpenFOAM Installation 0 November 12, 2008 20:53
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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