CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Changing Variable On-the-Fly (https://www.cfd-online.com/Forums/cfx/190206-changing-variable-fly.html)

Rodrigo Correa July 7, 2017 11:12

Changing Variable On-the-Fly
 
I’m trying to perform a CFX simulation and I would like to change a variable while the simulation is running (on-the-fly).

So far, I'm able to perform different simulations using the same definition file (.def) changing the input variable with the perl script.

However, It doesn't allow me to change that variable on the fly.

It seems that I need to go to user functions. Am I in the correct direction?

Could you give me some hints about it?

Many Thanks!




Opaque July 7, 2017 11:14

While monitoring the simulation using the ANSYS Solver Manager, you can "edit run in progress", change certain variables, and continue.

What variable do you need to change during the run?

What is the goal of changing the variable during the simulation?

Can it not be done automatically by the software?

Rodrigo Correa July 7, 2017 11:23

Thank you for your quick Reply!

I am about to run a Propulsion Simulation and I would like to perform the Continental method which means changing the Propeller frequency in order to guarantee the Equilibrium of Forces.

Therefore I start with my first Propeller frequency attempt and then I should correct it depending on the result of the Equilibrium of Forces (either increase or decrease it).

ghorrocks July 9, 2017 08:13

The usual way of doing this is to use a fixed frequency/speed, as that gives you a point on the propeller performance curve (torque versus frequency). You then do a second speed and get another point, and repeat, using frequencies determined by a root finding algorithm until you have the torque within an accuracy you are happy with.

You could do this using modify run in progress, but I see little advantage in it. You loose the previous data points, and you may wish to come back to them.

ThalesMachado July 9, 2017 08:44

Quote:

Originally Posted by ghorrocks (Post 656353)
The usual way of doing this is to use a fixed frequency/speed, as that gives you a point on the propeller performance curve (torque versus frequency). You then do a second speed and get another point, and repeat, using frequencies determined by a root finding algorithm until you have the torque within an accuracy you are happy with.

You could do this using modify run in progress, but I see little advantage in it. You loose the previous data points, and you may wish to come back to them.

In case, I want to modify run in progress, could I call a fortran subroutine, do the check for the equilibrium force, if not satisfied, send a new value of frequency back to CFX?

Rodrigo Correa July 9, 2017 15:32

Quote:

Originally Posted by ghorrocks (Post 656353)
The usual way of doing this is to use a fixed frequency/speed, as that gives you a point on the propeller performance curve (torque versus frequency). You then do a second speed and get another point, and repeat, using frequencies determined by a root finding algorithm until you have the torque within an accuracy you are happy with.

You could do this using modify run in progress, but I see little advantage in it. You loose the previous data points, and you may wish to come back to them.



The usual way you commented is called as English Method. This way I am able to do as I said before using a perl script to change a definition file (.def).

My question is more related with The Continental Method where the propeller frequency is varying up to the point where the equilibrium of forces is reached.

So, I would like to change the propeller frequency on-the-fly. Do you have any idea how to do it in CFX?

The user function seems to be the way to go, however I'm not sure about it.

Thank you for your help and comment!


Sent from my iPhone using CFD Online Forum mobile app

ghorrocks July 9, 2017 18:54

CFX does not appear to support editing CEL expressions when using edit the simulation in progress. So that means the "Continental Method" as you put it will not work. You will be forced to use the "English Method".

You could side-step this restriction using user fortran as Thales suggests.

Rodrigo Correa July 10, 2017 05:22

Thanks for sharing your experience!

I will keep trying it.
If I get a solution for that I post it here.

Opaque July 10, 2017 10:01

Not sure what your goal is, but I assume that both methods: Continental and English will produce exactly the same numbers, correct?

Those methods where the equilibrium point is obtained by effectively using a root finding, i.e. find x such f(x) = 0, must be used with a lot of care. These methods assume that evaluations of f(x) are extremely fast; otherwise, the calculation could become very expensive due to unnecessary iterations effort.

Adjusting a physical parameter based on incomplete information, i.e. non-converged information, may be subject to highly non-linear behavior you must deal with.

My 2 cents.

Opaque July 10, 2017 10:08

Duplicate of previous post

ThalesMachado July 11, 2017 08:05

Quote:

Originally Posted by Opaque (Post 656494)
Not sure what your goal is, but I assume that both methods: Continental and English will produce exactly the same numbers, correct?

Those methods where the equilibrium point is obtained by effectively using a root finding, i.e. find x such f(x) = 0, must be used with a lot of care. These methods assume that evaluations of f(x) are extremely fast; otherwise, the calculation could become very expensive due to unnecessary iterations effort.

Adjusting a physical parameter based on incomplete information, i.e. non-converged information, may be subject to highly non-linear behavior you must deal with.

My 2 cents.

Both methods have the same goal, however the British simulation is performed twice: for a RPM under the propulsion point and for a RPM above the propulsion point, therefore through interpolation we get our point of interest.
The Continental has the goal to avoid two simulations, for that we need to correct the RPM during the simulation.

ghorrocks July 11, 2017 18:28

I think you would be wise to pay attention to Opaque's warning. The approach is risky. Also the extra cost of doing full simulations is not high in most cases - if you use previous simulations as initial conditions for the next simulation it should converge quickly as the simulations should not be very different from each other.

But it is your simulation so you can do it any way you like.

Opaque July 12, 2017 11:32

Careful in interpreting your goals.

The goal of any simulation is to obtain meaningful results in the minimal amount of "wall clock time". It may be that a single simulation with adjusting RPM will produce the results you want in 1000 iterations, but two of them at fixed RPM will produce the results in 200 iterations each.

I agree it would take a time to setup 2 of them, monitored and compute the final result; however, you may have finished the task earlier than the other simulation.

Rodrigo Correa July 12, 2017 11:40

In order to check it one could try both methods. Therefore the need of changing the variable on-the-fly.

Anyhow, thanks for all the comments!


All times are GMT -4. The time now is 22:25.