We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Gradient of temperature in momentum source term while using solidification/melting with VOF

    • Dubey92
      Subscriber

      I am trying to model laser melting. I have written 4 separate UDFs(4 separate C files) for energy term and the 3 momentum terms. When I run the simulation only with the energy source term, the simulation runs fine. Next, when I add the 3 momentum terms also, I face problem. In the momentum source terms, I need the gradient of temperature. I am using FLUENT 2020 R2. My basic doubts are:

      1. Since I have written momentum source terms in separate C files from that of energy, will I be able to access C_T_G(c,t)?
      2. I read somewhere that "Keep temporary solver memory from being freed?" is not available in FLUENT 2020 R2 and also not for multiphase flows if I am using Fluent in parallel.
      3. If both of the above are not possible, what is the way to get access to temperature gradient? Can it be done using UDSI and then getting its gradient, UDSI_G?

      Any help is much appreciated.

      Thanks

    • Rob
      Forum Moderator
      Not seen any issues with the gradient retention. Have you tried the command? It's fairly routine so we'd have heard from commercial users and colleagues by now.
      Regarding the segmentation violation, run one iteration before you set up the source terms. You may be calling values before they exist in the solver memory: initialisation sets up the cell values, I'm not sure it also calculates the gradients.
    • Dubey92
      Subscriber
      Thanks for your reply. I have two source terms in the momentum equation. One uses temperature gradient and the other does not. The one which does not require temperature gradient is working fine. When I add the other term which requires temperature gradient, I try to access directly using C_T_G(c,t), then it shows segmentation fault.
      Regarding the command, yes I have tried solve/set/expert but the major issue is that the question which it asks is Linearize Mass Transfer UDF?? instead of "Keep temporary solver memory from being freed?
      Am I committing some mistake in running the command?
    • Amine Ben Hadj Ali
      Ansys Employee
      Where are u trying to access C_T_G?
    • Amine Ben Hadj Ali
      Ansys Employee
      Okay in momentum sources terms you require to keep memory from being freed otherwise you cannot access gradient of temperature in source term for U, for example.
    • Rob
      Forum Moderator
      You need to keep going through that list. The third question is to keep the temporary data.
    • Dubey92
      Subscriber
      @Rob Thanks for your reply. I am a new user do didn't know that I have to keep going through that list and stopped after not seeing the freeing memory question the first time itself. So will it be yes for first two questions also?
    • Dubey92
      Subscriber
      Thanks for your reply. Now I understand that. Also, somewhere I found a piece of code to allocate memory for temperature gradient, C_T_G(c,t). The lines are:
      Alloc_Storage_Vars(domain, SV_T_RG, SV_T_G, SV_NULL);
      T_derivatives(domain);
      .........
      your code....
      .........
      Free_Storage_Vars(domain, SV_T_RG, SV_NULL);
      Free_Storage_Vars(domain, SV_T_G, SV_NULL);

      Can you please tell if this works?
    • Dubey92
      Subscriber
      Thanks for your reply. I am a new user do didn't know that I have to keep going through that list and stopped after not seeing the freeing memory question the first time itself. So will it be yes for first two questions also?
    • Amine Ben Hadj Ali
      Ansys Employee
      I won't comment that piece of code. As new user I will rather stick to the default workflow to get gradients and that is meant with keep memory from being freed
    • Amine Ben Hadj Ali
      Ansys Employee
      If you are using the pieces of lines you are referring to: do not use that expert command under TUI. Bad to have it on where you are calculating the gradients and allocating them in the UDF. You see: better to stick to default workarounds as newbie.
    • Dubey92
      Subscriber
      Got it. Thanks a lot. My simulation is running now.
    • Rob
      Forum Moderator
      that depends what else you have set, I'd suggest accepting the defaults until you know what you're doing!
    • Dubey92
      Subscriber
      Thanks a lot for your reply.
    • Amine Ben Hadj Ali
      Ansys Employee
      Good that it works. Topic resolved then!
Viewing 14 reply threads
  • The topic ‘Gradient of temperature in momentum source term while using solidification/melting with VOF’ is closed to new replies.