Fluids

Fluids

UDF DEFINE SOURCE: Temperature stays constant after the heat source is put at 0

    • charlotteroels
      Subscriber

      Hi,

      I am currently implementing a heat source using the UDF macro DEFINE SOURCE for heating up a simple square surface (2D model). Now, I am facing the problem that my temperature remains constant after the source is turned off. Even with limits under convection conditions the temperature isn't going down, which seems strange.

      What could be the reason for this?

      I already verified with the UDF macro DEFINE EXECUTE AT END that my heat source is effectively off at the correct timing. Also clearly visible in the internal report (see attachment). Does this have to do with dS[eqn] still running somewhere? Any tips would be most welcome.

      In attachment I have made a simplified example to illustrate which coding structure I am using. UDMI(c,t,27) variable you can see as a rate constant. You can assume the heat will reach a peak at 0.5 and go down quickly as soon as 0.8 reaches. Which is not the problem for discussion.

    • Rob
      Ansys Employee
      Please repost the images as staff are not permitted to open or download attachments.
    • charlotteroels
      Subscriber
      Dear Rob, my apologies. I was not aware of this.
    • DrAmine
      Ansys Employee
      UDM 10 is a "constant" so UDM 5 will be a constant too right? That value returned is equal to UDM 5 which is not changing if set to UDM 10*s_tot.. You see I am starting imaging what might happen because the information you provided is very limited!..
    • charlotteroels
      Subscriber
      First of all, thank you for your reply.
      Since this is part of a bigger coding (which I cannot share due to embargo on my thesis), I will try to explain the general working principle/idea in general:
      PS: I don't have any UDM10 into my code but I suppose you where aiming on UDM27.
      The idea is to use the DEFINE SOURCE UDF to regulate the heat coming from a square surface. Since by using DEFINE SOURCE instead of DEFINE PROFILE you can call every cell centroid and store a source in the C_CENTROID variable for each iteration. I prefer this kind of UDF since you can control exactly what energy you put into the cells separately.
      The S_tot variable is the total heat input I want to give into my surface. S_tot is indeed a constant. I multiply this with UDM 27, which is related to another DEFINE EXECUTE AT END which uses the time variable CURRENT_TIME and C_T(c,t). So UDM 27 gives you a certain rate (which is time and temperature dependent) and can be seen as a rate that generates a exothermal reaction where the heat goes up and down. So the UDM 27 itself will not be a constant but will be doing a kind of polynomial function. I have linked the UDF into the source term (energy) and adapted to the asked source units [W/m^3].
      Since I use the source output as an input for another UDF I store the source output in UDM5 to use it later.
      I use the CURRENT_TIME indirectly into the source equation by UDM27, is this correct? So I differentiate on UDM27, which is a 'rate', indirectly linked to temperature and time.. Do you know if the source maybe needs to be directly dS/dt equation? with dt = time related with for example CURRENT_TIME?
      In the coding picture I also tried to change the if statement with (source < 10) instead of UDM5. But it also gives the same output.
      I hope this gives you enough information to give me some advice. If I find the correct solution, I will post it here.
      Thank you



    • Rob
      Ansys Employee
      The source will be hooked up to a cell zone, so check that. I'd check the S_tot value too, my coding is pretty poor and I'm not sure if C will interpret the "e" as an exponent or natural log function.
    • DrAmine
      Ansys Employee
      Sorry still not clear. If you want to create a rate you should rather divide by time step size. I will do the calculate of rate in a define adjust. You should know that source is what really matters and not the coefficient of linearization so please check the value behind source so UDM 5.
Viewing 6 reply threads
  • You must be logged in to reply to this topic.