Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Define source term in udf without using zone ID

    • Ramesh Chandra Mishra
      Subscriber

      Hi

      I am writing a UDF to specify the source term but not using any zone ID, rather I am using co-ordinates of the zone in my code which is as follows:

      DEFINE_SOURCE(Pollutant_3, c, t, dS, eqn)
      {
      real x[ND_ND];
      real source;
      C_CENTROID(x, c, t);
       
      if (x[0] >= 111.0 && x[0] <= 123.0 && x[1] >= 0.0 && x[1] <= 0.45 && x[2] >= 90.0 && x[2] <= 126.0) //Modify the release source mzhang
      {
      source = NO2;
      }
      else
      {
      source = 0;
      }
       
      dS[eqn] = 0;
      return source;
      }
      So do I need to mention about the same in my GUI too and if yes where, because i dont have a zone where i can specify these details.
    • Rob
      Forum Moderator

      You still need to hook the UDF into the cell zone(s), it's covered in the manual. I'm assuming NO2 is defined somewhere? 

      As a more general comment, if source is REAL define it as 0.0    It shouldn't cause any problems but is something I've always been pulled up on. 

    • Ramesh Chandra Mishra
      Subscriber

      Hi Rob

      Just want to confirm if you are saying I should initialize source to 0.

      Secondly, my initial query , I don't have a cell zone in my mesh, that is the reason I was defining it in UDF. If you say that hooking UDF is mandatory, so I am thinking of creating a region and then initialize and patch the user defined source. Will that work? I mean will it take the patched pollutant as the source term?

    • Ramesh Chandra Mishra
      Subscriber

      Rob

      Apart from the above query, I am facing one more issue. I need to run this simulation on a cluster. So how will this patching work? Because UDF compilation has to be done on a cluster. And without compiling and initializing , I can't patch the source to the region. Can we do it through TUI commands in journal file.

      If yes, can you please let me know the commands.

    • Rob
      Forum Moderator

      A source term is a continuous addition (or removal) of something from a cell zone in the model. A patch is a one off value added (typically) at the beginning of the run. 

      If there is no cell zone you can't interact with it as there isn't anything to interact with - Fluent needs the mesh to know there's something there! 

Viewing 4 reply threads
  • The topic ‘Define source term in udf without using zone ID’ is closed to new replies.