CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Changing Variable On-the-Fly

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2017, 11:12
Default Changing Variable On-the-Fly
  #1
New Member
 
Rodrigo
Join Date: Jul 2015
Posts: 18
Rep Power: 11
Rodrigo Correa is on a distinguished road
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!



Rodrigo Correa is offline   Reply With Quote

Old   July 7, 2017, 11:14
Default
  #2
Senior Member
 
Join Date: Jun 2009
Posts: 1,857
Rep Power: 33
Opaque will become famous soon enough
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?
Opaque is offline   Reply With Quote

Old   July 7, 2017, 11:23
Default
  #3
New Member
 
Rodrigo
Join Date: Jul 2015
Posts: 18
Rep Power: 11
Rodrigo Correa is on a distinguished road
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).
Rodrigo Correa is offline   Reply With Quote

Old   July 9, 2017, 08:13
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   July 9, 2017, 08:44
Default
  #5
New Member
 
Thales
Join Date: Jul 2017
Posts: 4
Rep Power: 9
ThalesMachado is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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?
ThalesMachado is offline   Reply With Quote

Old   July 9, 2017, 15:32
Default
  #6
New Member
 
Rodrigo
Join Date: Jul 2015
Posts: 18
Rep Power: 11
Rodrigo Correa is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
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
Rodrigo Correa is offline   Reply With Quote

Old   July 9, 2017, 18:54
Default
  #7
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   July 10, 2017, 05:22
Default
  #8
New Member
 
Rodrigo
Join Date: Jul 2015
Posts: 18
Rep Power: 11
Rodrigo Correa is on a distinguished road
Thanks for sharing your experience!

I will keep trying it.
If I get a solution for that I post it here.
Rodrigo Correa is offline   Reply With Quote

Old   July 10, 2017, 10:01
Default
  #9
Senior Member
 
Join Date: Jun 2009
Posts: 1,857
Rep Power: 33
Opaque will become famous soon enough
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 is offline   Reply With Quote

Old   July 10, 2017, 10:08
Default
  #10
Senior Member
 
Join Date: Jun 2009
Posts: 1,857
Rep Power: 33
Opaque will become famous soon enough
Duplicate of previous post
Opaque is offline   Reply With Quote

Old   July 11, 2017, 08:05
Default
  #11
New Member
 
Thales
Join Date: Jul 2017
Posts: 4
Rep Power: 9
ThalesMachado is on a distinguished road
Quote:
Originally Posted by Opaque View Post
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.
ThalesMachado is offline   Reply With Quote

Old   July 11, 2017, 18:28
Default
  #12
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   July 12, 2017, 11:32
Default
  #13
Senior Member
 
Join Date: Jun 2009
Posts: 1,857
Rep Power: 33
Opaque will become famous soon enough
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.
Opaque is offline   Reply With Quote

Old   July 12, 2017, 11:40
Default
  #14
New Member
 
Rodrigo
Join Date: Jul 2015
Posts: 18
Rep Power: 11
Rodrigo Correa is on a distinguished road
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!
Rodrigo Correa is offline   Reply With Quote

Reply

Tags
cfx-pre, changing variable, fortran, user function

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing a variable (turbulence dissipation rate) formolation m.beh Fluent UDF and Scheme Programming 6 November 7, 2016 05:53
changing scheme variable with UDF? Wagemakers FLUENT 17 September 30, 2015 14:34
Variable name for heat flux peterle CFX 4 February 13, 2014 02:21
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 04:35
variable viscosity -NOT! George Bergantz Main CFD Forum 15 September 19, 2000 14:28


All times are GMT -4. The time now is 06:43.