How to:
(1) assign an ansys workbench parameter to a scheme variable in fluent.
(2) assign a periodic mass flow condition at an ansys workbench parameter, in fluent.
I came across this problem while working on a periodic inlet/outlet problem in fluent. I needed to define the mass flow condition as a parameter, so that I could test different flowrate. Here is the solution that has worked for me: I used the instructions here (https://www.computationalfluiddynamics.com.au/how-can-i-drive-fluent-udf-parameters-directly-from-ansys-workbench/) to create a scheme variable in fluent, then used the scheme variable to define the mass flow condition in a TUI command.
steps are:
1. initialise the scheme variable in fluent. in the TUI window in fluent type, give the variable a meaningful name. here I've called it schemdot
(rp-var-define 'schemdot 1.1 'real #f)
2. check the scheme variable exists with this command. It should return 1.1 as it was assigned that in the previous step:
(%rpgetvar schemdot)
3. create your input parameter. in the tree, click on boundary conditions, parameters...
3. once the parameter exists, click on edit. click "more", click "use in scheme procedure". click "select" button next to the input parameter box at the top. highlight your input parameter.
4. click OK, and return to the main "use in scheme procedure" window. In the scheme procedure box, type:
(lambda (param) (rpsetvar 'schemdot param))
5. click define button.
6. check that it has worked by repeating step 2. above. the scheme variable should now return the value of the parameter as you have set it, rather than 1.1 from when the scheme variable was initially defined in step 1.
7. I then used a TUI command to set the periodic mass flow condition usinng the scheme variable. in the tree, under solution, calculate activites, execute commands, change defined commands to 1 to ungrey the option. check the tickbox active. enter the TUI command:
define/periodic-conditions/massflow-rate-specification? (%rpgetvar 'schemdot) , , , , , ,
this then tells fluent to set the periodic mass flow rate, using the scheme variable, that's based on the workbench parameter. The execute commands setting is just a convienient (if inefficienct) way to ensure the command is entered automatically during the simulation. Set the number of iterations to ten. the comma's emulate pressing enter in the TUI: in the perioidic mass flow conditions, the "pressure gradient" is iterated as part of the solution process. So it's important that the TUI command doesn't reset it to 0 or a constant because then your constantly interupting the soltuion process and it will never solve.
note that I am using a version of fluent currently that is about 3 years old. I believe there are easier ways to do what I've just described, in the more modern versions of fluent.
verify at the end of the simulation that the input parameter matches the mass flowrate in the model. I am doing this by setting another, ordinary, outlet parameter, measuring mass flows. (I have just started using periodic settings, but I'm finding that 1e-3 residuals don't necessarily mean convergence !)
No comments:
Post a Comment