Fluids

Fluids

accessing particle diameter in define adjust

Tagged: 

    • satri
      Subscriber

      How can i access particle diameter in define adjust function?

      dp=P_INIT_DIAM(p) 

      i tried using this command i keep getting error.

    • DrAmine
      Ansys Employee

      You will need to loop over all injections and from that you loop over all particles.

      Why do you require that in a DEFINE_ADJUST?

    • satri
      Subscriber

      i have dp as a parameter that needs to be used in the define adjust. when i do multiple diameter runs I need to change this in the define adjust function as and when necessary. (i was trying various other methods)

      (This is not the best of the ideas but i thought this would work, i still get problems with this. not sure why the compiler does it )

      I have written an execute on demand to rewrite the define adjust function file (with different particle diameter values) when I run it. But unfortunately, when I write the file it writes the file twice onto the same file

      This prints the contents of the file twice. I don't have multiple injection loops. At a time I inject one particle diameter but after that is done I need to change the diameter and re-run the iterations and inject different diameters.

      this is what i want to achieve but when I write define adjust I get the contents of the file printed twice. (I even used fseek to write the file even then the file gets printed twice. how to get rid of this double printing (i am running this in serial, not in parallel mode)

    • DrAmine
      Ansys Employee

      I won't comment on your UDF/ Routine as I do not debug Routines or UDF on this forum.  (Double printing means for me the node and the host are printing). I do not understand why you need to print anything into a file. Get_Input_Pramater function can help you to access the input parameter value of interest.

    • satri
      Subscriber

       

      Never mind I found another method to solve my problem. but what I want to mention is printing double is still a problem (if I print the contents of two files into one file). I don’t know why ansys c compiler does that even though I don’t run in parallel. 

      what i am trying above has nothing to do with any physics of the problem i was just trying to use the c program to help in automating some mundane tasks.

       

    • satri
      Subscriber

      my other solution works but not always. it's simple while loop to copy the contents of one file and paste it in the file of adjust function this works for a few rounds and then stops why does this happen? it's a very simple copy-and-paste operation? what is wrong with the compiler of Ansys. Please let me know how to fix it. 

    • DrAmine
      Ansys Employee

      Which Ansys C compiler? Are you working on Windows? You can there user Visual Studion. On Linux standard compiler is GCC so not Ansys C compiler.

      If you are using a new Ansys Fluent version and even if you are running on single node that is still parallel and you will have HOST and NODE0 so both will try to write to a file.

    • DrAmine
      Ansys Employee

      Also please have a look into chapper Parallel Consideration when reading and writing Files in the Ansys Fuent Customization Manual.

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