Floating point exception

    • sam_5195

      Hello, I am trying to simulate flow over a solar structure. For the wind profile i have interpreted a udf. The flow direction is z, and the height is in y direction. Though i think the udf should work, initialization throws up a floating point exception. I am pasting the udf here:

      #include "udf.h"
      #include "math.h"
      DEFINE_PROFILE(velocity_profile, thread,index)
      real z[ND_ND];
      real x,y;
      face_t f;



      F_PROFILE(f,thread,index) = 47*pow(0.1*y,0.15);



      Thing is that if i change the "F_PROFILE(f,thread,index)" to y*y or something, it runs without any error. I am using k-epsilon realizable model and SIMPLE scheme with second order TKE and TDR while keeping most of the things as default. Any suggestion would be appreciated. Thanks

    • Karthik R


      I took your UDF and was able to successfully compile it. The problem does not seem to be with the UDF. 

      Floating point error generally refers to the fact that you have a really small or large value in one of your denominators and Fluent throws this message. Here are some pointers.

      • Could you please check your mesh quality?

      • What values are you using for your initialization?

      • Could you please share a few more details about your model?

      • What are your boundary conditions?

      • How does your geometry look like?

      • Where and how are you using the above profile?

      Thank you.

      Best Regards,


    • sam_5195

      Thanks for the reply. The mesh quality is

      "Mesh Quality:


      Minimum Orthogonal Quality = 1.06680e-01

      (To improve Orthogonal quality , use "Inverse Orthogonal Quality" in Fluent Meshing,

      where Inverse Orthogonal Quality = 1 - Orthogonal Quality)


      Maximum Aspect Ratio = 3.42408e+01"


      I am using hybrid initialization with 10 as number of iterations for initialization.


      The model is kind of like a blackboard or a pizza box with small thickness and large length surrounded by an even larger cuboidal enclosure. The dimensions are 10m x 3m x 4cm and tilted at 20 degrees wrt ground for the model without enclosure.


      For boundary conditions, the enclosure wall have roughness height of 0.1 and roughness constant of 0.5. At inlet i put the velocity specification method as components and put the x and y components as 0 and z velocity as the udf. Turbulent intensity is 5% and viscosity ratio is 10.


      i am attaching a picture of the solar model without the enclosure.

      I am using the above profile at inlet with flow in z direction which hits the above structure from the front.


      The error is:

      Initialize using the hybrid initialization method.


      Checking case topology...

      -This case has both inlets & outlets

      -Pressure information is not available at the boundaries.

      Case will be initialized with constant pressure


      iter scalar-0


      1 0.000000e+00

      2 0.000000e+00

      3 0.000000e+00

      4 0.000000e+00

      5 0.000000e+00

      6 0.000000e+00

      7 0.000000e+00

      8 0.000000e+00

      9 0.000000e+00

      10 0.000000e+00

      hybrid initialization is done.

      Error at host: floating point exception


      Error at Node 0: floating point exception


      Error: floating point exception

      Error: Object: #f



    • Karthik R


      Could you please share some screenshots of your mesh - both in the enclosure region as well as in the inlet regions?

      Also, from ANSYS meshing, can you check what your maximum mesh skewness value? Do you have any inflation mesh in your model? What settings did you use?

      Are you using wall function model or enhanced wall treatment?

      What are your boundary conditions? 

      Could you also explain your physical model here so we understand it better?

      Thank you.

      Best Regards,


    • Keyur Kanade
      Ansys Employee

      First solve only flow and check if it gives any error. 

      Then solve energy equations. 

      Also try to use first order for tke. 

      Also though mesh quality is ok, what is cell count?

      Is it possible for you to reduce problem to 2D?

    • sam_5195

      The maximum skewness is 0.48 with average of 0.25. I haven't used any inflation rather i used face meshing and edge sizing. The near wall treatment is kept to standard wall function. i tried the steps but all are okay. I am required to do the problem in 3d. What i don't get is that everything works fine if the expression doesn't have any log, pow or sin or any such function. I am interpreting the udf and not compiling, could that be in any way affecting the result? Also i don't have the microsoft visual installed on this computer which could be the reason that any of those functions aren't working. But since i am interpreting the udf, do i still need the ms visual for math.h. Is that the culprit here? and if i do have to install it, which version would be suitable for ansys 18.2?.Thanks.

      Edit: Turns out that installing visual c++ solves the problem

Viewing 5 reply threads
  • You must be logged in to reply to this topic.