Fluids

Fluids

use of temperature and mass fraction gradients in UDF

    • Raiq33
      Subscriber
      Hi,Currently, I'm using non-premixed combustion model and aiming to modify some equations using UDF. In this modification, I need to use the temperature and mass fraction gradients. It is true that there are macros for these gradients but when I included them in the UDF file, I got errors. nIn the UDF manual, I found a code ( showgrad.c), which can be used to show the available gradients in my model. When I used that code, the available gradient variables for my particular case and data files are pressure and velocities gradients.My question is how I can use the temperature gradient ?.For the mass fraction gradient, it is written in the UDF manual that the mass fraction gradient is available only for the density-based solver and to use it in the pressure-based solver, I need to set the rpvar 'species/save-gradients? to #t. Hence, I typed in the text command the followingnn(rpsetvar 'species/save-gradients? #t)nnbut unfortunately, nothing has changed. So, is there any way to make the mass fraction gradient available in my model?Thanks in advance for your help. n
    • YasserSelima
      Subscriber
      Hello,ntype (rpgetvar 'species/save-gradients?) and see if you get true (#t) or not ... nAlso if you want to recall gradient of any variable, save it to C_UDSI and then you can recall the gradient by C_UDSI_G ... don't forget to disable solving the UDS associated with this variable.nAnd for the temperature, yes you can use the temperature gradient ... C_T_G(c,t)nn
    • Raiq33
      Subscriber
      thanks for your reply. nI typed (rpsetvar 'species/save-gradients? #t) in the console but nothing has changed. I do not know if there is another way to make the mass fraction gradient available in the model or not. n
    • YasserSelima
      Subscriber
      (%rpgetvar 'species/save-gradients?) .. this should give you the value of the variable . See if it is true or falsen
    • Raiq33
      Subscriber
      nAs expected, the value of the variable is false. Then, when I used the following command, (rpsetvar 'species/save-gradients? #t), the value of the variable becomes true. After that, I used the showgrad.c code to show the available gradients in my model but the gradient of species mass fraction was not one of the available gradient variables for my case and data files. nI'm totally confused. n
    • YasserSelima
      Subscriber
      run one iteration / timestep and checkn
    • Raiq33
      Subscriber
      This is what I did. n
    • YasserSelima
      Subscriber
      Not sure why ... now you have to go with solution of UDS ... nUse Define_AdjustnLoop through all threads and cellsnSave the mass fraction into C_UDSI(c,t,i)nNow you can call the gradient from any other function using C_UDSI_G(c,t,i) ... this will have 2/3 components in x, y and z direction.nDon't forget to increase the number of user defined scalar and disable solving the equationn
Viewing 7 reply threads
  • You must be logged in to reply to this topic.