Fluids

Fluids

Topics relate to Fluent, CFX, Turbogrid and more

FLUENT UDF EXECUTION WHILE USING THE COUPLED SOLVER

    • ag1991
      Subscriber
      Hi,nI am conducting a TRANSIENT simulation where the usage of COUPLED SOLVER is mandatory, as the mesh is an overset one.nThe point is, I need to perform some computations within a UDF file which includes the so called DEFINE_PROFILE macro, which is actually adressed to a certain boundary whose static pressure is prescribed. In other words, I need the solver, for each time step, to compute every inner iteration this DEFINE_PROFILE macro, as it will calculate a newer value for static pressure on that boundary.nHowever, I have started seeing how wrong things are happening, for instance, I have included a 'counter' variable within this DEFINE_PROFILE macro which should be incremented by one for every iteration within the time step. Unfortunately, this counter only takes value of 1, rather than the actual number of iterations.nI would then like to ask you if while using COUPLED SOLVER, the DEFINE_PROFILE macro is only computed once before starting the P-V coupling iterative loop. I have tested this same UDF on a SEGREGATED SOLVER (SIMPLE) and it worked fine, with the counter taking the total number of iterations. According to Fluent UDF Guide the sequential algorithm should be the same for these two solvers but I would like someone to confirm me this.nnThanks.n
    • YasserSelima
      Subscriber
      Define profile is called once every time step. If you want to call it every iteration, use Define_ADJUST macro. nDefine Adjust macro is called every iteration. And you can recall the function by its name from there .. nHowever, I do not recommend updating the profile every timestep. The solution will not be stable and probably it will not converge.n
    • ag1991
      Subscriber
      Thanks for your response, YasserSelima. So, to sum up, let us say that COUPLED SOLVER only calls once the DEFINE_PROFILE macro per each time step whilst the SEGREGATED SOLVER does it every inner iteration within the time step? Am I right?nThe problem is, if I use DEFINE_ADJUST in order to actually call it every inner iteration, as you proposed, there is no possible prescription of pressure for the concerned boundary face. As far as I am concerned, DEFINE_PROFILE is the only macro capable to assign a certain value to all cells from a certain boundary thread. On top of that, in Fluent's GUI, you will see how you must select the DEFINE_PROFILE macro that is created specifically for that boundary on bondary conditions settings-->pressure outlet; whilst DEFINE_ADJUST is simply hooked without any assignment at all, hence leaving that pressure outlet value on bondary conditions settings-->pressure outlet with its default 0 Pa constant value (which ultimately will yield a prescribed 0 Pa pressure on that boundary).nFurthermore, as I conducted this same simulation (without an overset mesh) through the usage of SEGREGATED SOLVER (Simple) I could see how it converged satisfactorily, changing every inner iteration the pressure value according to my DEFINE_PROFILE macro, I believe if the URF are well posed and the expected pressure changes are not too large the simulation can indeed converge well.nAny other ideas?nRegardsnn
    • Rob
      Ansys Employee
      DEFINE_PROFILE should be updated at the beginning of the time step, if the profile changes during the time step it could cause the solver to fail. The question then is, why do you need to change the profile within a time step? nModels that work without and don't work with overset tend to be down to the overset mesh, and checking for orphan cells is a good starting point. Looking at the flow just before divergence is also a good trick for identifying problem areas. n
    • ag1991
      Subscriber
      Hi Rob, I need to change the pressure profile within the time step because it depends on the current flowrate value through that outlet, it is a kind of 'resistance boundary condition'. I know this could seem unstable from a numerical viewpoint but hopefully, the numerical solver will converge to a certain solution after 20-30 inner iterations. In this way, it is possible to see how the pressure update on that boundary undergoes almost no changes once the solution is definetly convering (from 20th iteration on). All this can be observed in a segregated solver simulation without the usage of an overset mesh.nAnyway, I would like also to post here a picture from the iterative algorithm used on ANSYS FLUENT for both solvers, as you'll se, theoretically, DEFINE_PROFILE shall be updated every inner iteration. This is what actually makes me wonder what's happenning in there, since the same UDF code works perfectly with a segregated solver simulation.nn
    • Rob
      Ansys Employee
      Checknhttps://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v211/en/flu_udf/UDFx1-170002.9.htmlnSo, the profiles are called in the same way. Did you repeat the two runs without using overset? Note, PBCS may require the courant number to be altered as the default of 200 is fairly optimistic in many cases. n
    • DrAmine
      Ansys Employee
      DEFINE_PROFILE as already mentioned gets updated at the top of every time step + every N iterations (Profile Update Interval). This is also mentioned in the documentation. So it gets updated every outer iteration. Can you verify on non-overset case (PS: Overset can be used with 21R1 with Segregated Solver).n
    • ag1991
      Subscriber
      Rob and DrAmine, I have just checked that I unconciously hit somehow the 'Update Interval' button and lowered it from 1 to 0. This was the reason for the profile to be updated every time step regardless of inner iterations.nThank you, it is also good to know ANSYS Fluent has also allowed the use of segregated solvers with overset mesh.n
    • YasserSelima
      Subscriber
      Hello ag1991,nEvery function could be recalled by its name inside the UDF. So, if you define a profile and called the function my_pressure_profile, you can call it from inside define adjust simply write my_pressure_profile();nJust note, to make sure it works right, you need to get the domain and get the thread by its id.
    • ag1991
      Subscriber
      Hello YasserSelima,nI didn't know that. This procedure might become handy for certain situations. That being said, I think if I called that function my_pressure_profile(...) from a DEFINE_ADJUST, entering as inputs of the function the domain and the boundary thread id, I am afraid that the value assigned to that boundary would be overwritten by the value you leave as default on Fluent GUI, under Boundary Conditions and Pressure Outlet.nRegardsn
    • YasserSelima
      Subscriber
      In your define profile above, you entered a thread ... ignore it.nIn the define profile function nd = Get_Domain(1);nth = LOOKUP_THREAD(d, thread_id);nThen assign your profile to the thread th ... thread_id is the id of this boundary, you can get it fro boundary conditions in the GUInnNow when you call this function from any function, it will assign profile to the thread th ... n
Viewing 10 reply threads
  • You must be logged in to reply to this topic.