Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Can you parametrize mass flow rate input in Periodic boundary conditions in Fluent?

    • Madhu_Kalyan
      Subscriber

      If you can do it then kindly guide me through the steps to do it. I learnt from some other forums that it can be done using a code but it wasn't clear on how it can be done. If you know the answer then please share it since I have to do close to 100 simulations on a single geometry and it would be of great help if I could get to parametrise the mass flow rate

    • RK
      Ansys Employee
    • Madhu_Kalyan
      Subscriber
      Thank you RK for your response but sadly I don't have an account to read what's given there since I use the student version. If there is any other way can you please guide me?
    • Madhu_Kalyan
      Subscriber
      Hello RK. I have gone through the documentation and it specifies nowhere that I can parameterize the mass flow rate. Kindly tell me if it is possible or not at least, so that I don't have to waste my time going through everything.
    • Amine Ben Hadj Ali
      Ansys Employee
      You can do it in the way: you create an Expression based input parameter. When it comes to providing the mass flow rate you tell Fluent to compute the expression there and pick-up the value. Other ways will use Scheme code.
    • Madhu_Kalyan
      Subscriber
      Thank you DrAmine. I tried to use the scheme code but I couldn't understand what was going on. Can you please elaborate if it isn't too much trouble. Also in the periodic dialogue box there isn't an option to enter an expression
    • Amine Ben Hadj Ali
      Ansys Employee
      You create the expression outside but use the value in the field via Calculation Activity.
    • Madhu_Kalyan
      Subscriber
      Ok.thanks for the help. I will let you know after I try it
    • Amine Ben Hadj Ali
      Ansys Employee
      Welcome!
    • Madhu_Kalyan
      Subscriber
      Dear DrAmine I have tried the Scheme procedure as given below
      (lambda (value )
      (ti-menu-load-string (format #f "/solve/set/under-relaxation/pressure ~g" value)))
      Now my problem is that, how can I assign the mass flow rate to this variable lambda? Kindly help me
    • Amine Ben Hadj Ali
      Ansys Employee
      You found an example for pressure under relaxation and you to apply it directly for your massflow. You cannot use that construct as it is intended as scheme based input parameter but the massflow under periodic does not allow that (as far as I remember)

      1/Create one expression and make it your input parameter
      2/per TUI: find the whole command to setup the massflow
      3/once Fluent ask you for value you compute the return value of the expression

      Steps 1 to 3 can be coded as calculation activity.
    • Madhu_Kalyan
      Subscriber
      I have tried the above steps. In the parameter box I have created a variable with the name mdot with the value 0. then I tried the following in the TUI. I tried to write mdot when fluent asked me to enter the mass flow rate but it just returned an error

      /define/periodic-conditions> massflow-rate-specification
      Enter Mass Flow Rate(Kg/s) [0.005] mdot

      Error: eval: unbound variable
      Error Object: mdot
      Invalid real.
    • Amine Ben Hadj Ali
      Ansys Employee
      you need to evaluate mdot and to write mdot
    • Amine Ben Hadj Ali
      Ansys Employee
      Example: (pick-a-real "/define/named-expression/compute mdot" 3) assuming mdot is the name of the Expression! Does it all make a sense?
    • Madhu_Kalyan
      Subscriber
      I apologize for bothering you so much. But m dot is a number I want to give directly as an input to the periodic boundary. How do you propose I write an expression for it and then evaluate it? I am very much confused by this

    • Madhu_Kalyan
      Subscriber
      I got it upto this point.
      /define/named-expressions> compute
      available-list: (mdot)
      select-to-edit/delete ["mdot"] mdot

      --------------------------
      Expression Value Unit
      --------------------------
      mdot 0 []
      --------------------------

      What can I do after this?
    • Amine Ben Hadj Ali
      Ansys Employee
      Create an Fluent Expression for mdot. 5.1. Introduction to Expressions (ansys.com) (In Fluent "type F1", a browser opens, add a new window and click then on the link)
    • Madhu_Kalyan
      Subscriber
      Ok. I will go through it and let you know after I tried it out. Thank you so much
    • Amine Ben Hadj Ali
      Ansys Employee
      Welcome
    • Madhu_Kalyan
      Subscriber
      Dear DrAmine
      I have successfully created a named expression and was able to make it into a parameter as shown in the below figure. I computed it as u told me to from the TUI. Now I am unable to get this into a parameter for the periodic mass flow. Kindly help me.

    • Amine Ben Hadj Ali
      Ansys Employee
      I think you kindly ask me to assume your task :)


    • Amine Ben Hadj Ali
      Ansys Employee
      I already shared what do above: (pick-a-real "/define/named-expression/compute mdot" 3) whenever you are asked to change the mass flow rate in the periodic panel using TUI command. You will end up with long command which needs to be executed every N iterations or time step size or only at the beginning of the run. If you are working under the Workbench you might use Automatic modify case to adjust the mdot for every design point by using a Pre-Initialization modification.
    • Madhu_Kalyan
      Subscriber
      . Sorry but that wasn't my intention. I am in a kind of hurry and wasn't able to fully sit down and learn all of the basics. THis is also not my main problem. I am trying to get the help I can for this simple 2D problem so that I can apply it to a much larger problem. That is why I have been troubling you so much. It's not like I am not trying anything but it's just that it is so new to me that I haven't been able to keep up. Also there is one more anomaly in the periodic BC which I have been giving my 100% to figure out. The mass flow average temperature suddenly dips down during heating for first few mm and then it tries to cover up the difference by giving a sudden spike upwards for the last few mm. I can elaborate you on this but since this thread is concerned with parametrization I will not trouble you with that. If you are willing to help me a bit more I would greatly appreciate the help and will also think of a way to put the detailed steps in the web so that others might not need to go through this trouble again. So its your call.
      And regarding my effort for this, I have been exploring all the options in the TUI but I couldn't find them and scheme programming is still very confusing to me. Only after doing this I have asked for your help. I truly apologise If you feel that you are spoonfeeding me but one way or other I will figure it out, rather I have to.
    • Amine Ben Hadj Ali
      Ansys Employee
      Actually that is now simple given the Quick Search Tab Function in Fluent. First of all let Fluent record TUI Commands by starting Journal under File Menu. Afterwards use the search bar to find periodic and then you will find your way. You will end up with something like
      /define/periodic-conditions/massflow-rate-specification? 5 0. 0.5 2 300 1. 0. 0. The fist value corresponds to mdot. Now one needs to return the value of the expression: You need to test if the return value is what you expect:
      (pick-a-real "define/named-expressions/compute mdot" 4) is working for me and return the value I input

      So the whole command will be then /define/periodic-conditions/massflow-rate-specification? (pick-a-real "define/named-expressions/compute mdot" 4) 0. 0.5 2 300 1. 0. 0. With that command you can use to adjust the run every iteration or to adjust at the beginning.
    • Madhu_Kalyan
      Subscriber
      I will try it and let you know. I think it is starting to get more and more clear. Thank you
    • Madhu_Kalyan
      Subscriber
      So, I have successfully created the expression "mdot" and assigned it the units and value in its definition as 0.05[kg s^-1]. I have done this part "/define/periodic-conditions/massflow-rate-specification? 5 0. 0.5 2 300 1. 0. 0" correctly. I have also verified by using "define/named-expressions/compute mdot" and it returned the value 0.05 kg/s. "mdot" shows up in the workbench 'parameter set' window and I tried to change the value of mdot by adding more cases over there and simulate it. But the mass flow rate did not change for each case and it was the same thing that I put in the periodic dialog box for the first case. So this confirms that the parameter I have created wasn't accepted as the parameter for the massflow rate in the periodic condition. Can you tell me what I have done wrong? I have created a journal file too and tried to edit in that but it seems I have to read the journal file every time I have to change my mass flow rate or put in the TUI commands to change the mass flow rate. Either I am understanding it wrong or I am not using it the right way. Can you clarify?

    • Rob
      Forum Moderator
      Where in this command is the reference to mdot? "/define/periodic-conditions/massflow-rate-specification? 5 0. 0.5 2 300 1. 0. 0"
    • Amine Ben Hadj Ali
      Ansys Employee
      Read carefully my solution...
    • Madhu_Kalyan
      Subscriber
      I have read the solution and I was successfully able to assign the variable mdot to the periodic mass flow rate. But whenever I change the parameter in the workbench it is not updating the massflow rate unless I go back into the setup and put the command again to initialize. I tried to record a journal file but to make it read in the next case also I need to open the fluent tab. I am attaching the image for reference. Initially, I ran a case with a mass flow rate of 0.005 kg/s and I changed the mdot value to 0.02 in this tab and updated it but the result was showing that the old mass flow rate has been used to calculate and the change hasn't been reflected. Kindly point out my mistake and I will search for the solution


    • Madhu_Kalyan
      Subscriber


    • Madhu_Kalyan
      Subscriber
      I finally found a solution and I don't know whether it is correct or not. The forum admins can clarify if anything is wrong or missing but it worked for me.
      After making the zones periodic, click on Named Expressions in the Setup and create a variable. In my case, it was created as "mdot" with an arbitrary value say "1" with the unit specified as "[kg s^-1]" and check the "Use as parameter" box at the bottom. It should look something like the image below.

      Then give the command "define/named-expressions/compute mdot. The slashes can always be avoided if you typed enter in the place of the slash. This command is to just check whether the variable is added and compute the value you give.
      The next step is to go to the "calculation activities" tab and select "Create/edit" in the "execute commands" sections. Define a command by putting this line - define/periodic-conditions/massflow-rate-specification? (pick-a-real "define/named-expressions/compute mdot" 4) . The number of iterations can be set at any number but for safe side keep it anything between 1 to 10. This means that the command is going to get executed thereby assigning the mass flow rate to the simulation every n iterations. I checked it with multiple values and it did not change the end result when it converged. I also checked the result of these simulations with the original simulation having no parameters for mass flow rate and the values checked out. The image is given below.
      I tried various other methods and this is the closest I have gotten to solve it. Now I can change the mdot value in the workbench parameter and the simulations are done with correct values as intended.

      The Forum coordinators are welcome to give any input to this method and I thank DrAmine for being patient and guiding me through this.
      Cheers
Viewing 30 reply threads
  • The topic ‘Can you parametrize mass flow rate input in Periodic boundary conditions in Fluent?’ is closed to new replies.