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

variable inlet BC

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 31, 2015, 03:26
Default variable inlet BC
  #1
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
I d like to set the characteristic of the pump as an inlet boundary condition of a pipe system. The characteristic of the pump is known Q=f(dp) - mass flow is a function of pressure gradient. Pressure gradient is evaluated during the computation between inlet and outlet of the pipe system and this pressure is given back to the equation Q=f(dp) as an inlet boundary condition.
The problem is that in each iteration the dp is changed which leads to oscillations. It would be helpful to prescribe each 10 iterations dp=konstant. So dp would be changed only after the 10 iterations (and mass flow would be stabilized according to the equation Q=f(dp)). Cause if the dp is changed in each iteration the mass flow Q is unable to achieve the value given by the equation. However I cant find any way to keep any variable constant for 10 iterations. Any ideas?
Jiricbeng is offline   Reply With Quote

Old   March 31, 2015, 05:35
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,694
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Don't forget you can also specify this as dp=f(Q). So you can use pressure boundaries and have the pressure gradient a function of flow rate. Worth a try, it might be more stable.

I do not know of a nice way to access historical values of CEL expressions. Probably the best way of doing this is with user fortran.
ghorrocks is online now   Reply With Quote

Old   March 31, 2015, 06:00
Default
  #3
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
Yes, that is another but equivalent possibility. Nevetheless thank you. Allowing recursion in expressions would sort out such difficulties.
Jiricbeng is offline   Reply With Quote

Old   March 31, 2015, 07:00
Default
  #4
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
creating recursive variable is quite stable (i have used some during a while) but here the system is quite tricky...
I was thinking of something with a counter (+1 at each timestep), a clear signal (when counter reaches 10) and a single step function in your expression of Q.
But there was quite some problems to determine which expression or additional variable was refreshed first.
Thomas MADELEINE is offline   Reply With Quote

Old   April 3, 2015, 02:00
Default
  #5
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
Yes, the idea of the counter is on the front burner, I was trying to create a counter for the expressions, but the problem always ended by the demand on recursion. I ve already found some topics about additional variable but was not able to reasonably apply it. The possibilities of the additional variable seem to be quite limited. Can you give me please any clue how to use an additional variable as a recursive value?
Jiricbeng is offline   Reply With Quote

Old   April 3, 2015, 03:46
Default
  #6
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
i used quite a while ago.... from what I remember:
the additional variable are calculated at each time step (don't know if it is before or after expression)
EX expression
AV additional variable

EX counter = AV Counter
AV Counter = EX counter + 1

normally it should work...

I will search if I find my old work to help...
Thomas MADELEINE is offline   Reply With Quote

Old   April 14, 2015, 05:04
Default
  #7
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
I returned to this issue and I am still not sure whether this is feasable. Lets say the mass flow given at the inlet is an expression:

if(each tenth iteration, Q=f(dP), constantQ)
*note:each tenth iteration can be writen as int(Curent Iteration Number/10) = Curent Iteration Number/10

Q=f(dP) is no problem. But constantQ should be the additional variable. ConstantQ must be a function of an expression which gives the new value only at the tenth iteration. The trouble is that "if" statement requires also false variant. The aim is actually prescribe that if each 10th iteration is not achieved constantQ = constantQ... moreover you need an expression to initialize it.. cannot figure it out.
Jiricbeng is offline   Reply With Quote

Old   April 14, 2015, 06:06
Default
  #8
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
I would choose an step function to avoid the ifnot

something like
10iteration = current iteration number - int(current iteration number/10)*10

Q = step(10iteration-9.5)*functionQ(dP) + step(9.5-10iteration) * Q

if you want to avoid a direct loop you have to create an additional variable constantQ, initialize it with a run (2 timestep are enough) and then do something like:
constantQ = Q
Q = step(10iteration-9.5)*functionQ(dP) + step(9.5-10iteration) * constantQ

I think this should work
Thomas MADELEINE is offline   Reply With Quote

Old   April 14, 2015, 09:47
Default
  #9
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
Thank you very much for your suggestion. However I came across the following caution:

The parameter 'Mass Flow Rate' in object '/FLOW:Flow Analysis 1/DOMAINefault Domain/BOUNDARY:inlet/BOUNDARY CONDITIONS/MASS AND MOMENTUM' is defined to be "Single Valued" but it depends on the following field valued variables: , QmAdVariable.

I prescribed the massflow rate to be the QmAdVariable.
QmAdVariable is defined according to the above mentioned equation QmAdVariable = step(10iteration -9.5)*functionQ(dP) + step(9.5-10iteration) * QmAdVariable. Even if I used another expression Qmm = QmAdVariable, the caution is still the same. It seems you cannot set additional variable as a boundary condition...The dimensions are fine as I debugged it.
Jiricbeng is offline   Reply With Quote

Old   April 14, 2015, 10:27
Default
  #10
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
Well it is only a caution... does this run anyway ?

Sorry I didn't made myself clear.
I would set the equation in a expression (Ex) and only use the additional variable (AV) to avoid the warning of recursivity:

AVconstant Q = Ex Q
Ex Q = step(10iteration-9.5)*functionQ(dP) + step(9.5-10iteration) * AVconstantQ

You can use the expression to define your inlet.
And make sure this system is correct by creating a monitor point to follow the evolution of your expression during the run.
Thomas MADELEINE is offline   Reply With Quote

Old   April 15, 2015, 02:57
Default
  #11
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
I am sorry for misunderstanding, it is not a caution it is a restriction (there is a "red cross") and I cannot run the solver.
I amended the algorithm according to your suggestion and the restriction is still the same. Obviously the boundary condition cannot depend on an additional variable which leads to an unsolveability of this problem...
Jiricbeng is offline   Reply With Quote

Old   April 15, 2015, 03:56
Default
  #12
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
Ex Q is supposed to be an expression, if you use it to define the inlet you shouldn't have any problem (maybe a wanring about recursivity on expression)

Last edited by Thomas MADELEINE; April 15, 2015 at 03:57. Reason: coma is important here ^^
Thomas MADELEINE is offline   Reply With Quote

Old   April 15, 2015, 04:56
Default
  #13
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
No no no, even if I use the expression EX Q as an inlet condition, the error is still presented. It seems that CFX checks the dependancy through the expressions - in case of boundary conditions CFX has problem that the expression is a function of the additional variable.
Jiricbeng is offline   Reply With Quote

Old   April 15, 2015, 05:04
Default
  #14
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
ok sorry I did not know that...
So can you delete the AV and use only expression ?

Q = step(10iteration-9.5)*functionQ(dP) + step(9.5-10iteration) * Q

You should have a warning about a expression referencing to itself... but maybe it can work...
Thomas MADELEINE is offline   Reply With Quote

Old   April 15, 2015, 05:28
Default
  #15
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
I of course did not know about this treason either. By deleting the additional variable and having the recursion in expression itself we get back to the original problem, recursion in an expression is problem and does not allow you to run the solver. The error is:

Bad expression value 'Q' detected in parameter 'Mass Flow Rate' in object '/FLOW:Flow Analysis 1/DOMAINefault Domain/BOUNDARY:inlet/BOUNDARY CONDITIONS/MASS AND MOMENTUM'.
CEL error:
A cyclic dependency between expressions has been detected while processing the expression assigned to 'Mass Flow Rate'.
The cycle detected is as follows (there may be others):
Q -> Q.

Even if you suppress the message the solver fails. I think the ideas have just been run out, haven´t they?
Jiricbeng is offline   Reply With Quote

Old   April 15, 2015, 05:42
Default
  #16
Senior Member
 
Thomas MADELEINE
Join Date: Oct 2014
Posts: 126
Rep Power: 11
Thomas MADELEINE is on a distinguished road
Sorry for not understanding before.

Well I am quite out of ideas now...
I will continue to think about it but i would not expect miracle...
Sorry again
Thomas MADELEINE is offline   Reply With Quote

Old   April 15, 2015, 05:52
Default
  #17
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,694
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
User fortran.
ghorrocks is online now   Reply With Quote

Old   April 15, 2015, 07:09
Default
  #18
Senior Member
 
Jiri
Join Date: Mar 2014
Posts: 214
Rep Power: 13
Jiricbeng is on a distinguished road
To Thomas MADELEINE:
You do not have to feel sorry . Thank you anyway!

To ghorrocks:
I know you´ve already mentioned this possibility but I actually do not know how to grasp it. I went through help but I do not know how to apply it, is there any tutorial with explanation of the user fortran?
Jiricbeng is offline   Reply With Quote

Old   April 15, 2015, 07:17
Default
  #19
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,694
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
There are a few examples of user fortran in the CFX documentation. I have never tried to do something like what you propose so cannot help you in detail, but hopefully something like a user CEL function might work.
ghorrocks is online now   Reply With Quote

Old   March 25, 2016, 12:25
Default
  #20
New Member
 
Join Date: Oct 2014
Posts: 5
Rep Power: 11
maciekstp is on a distinguished road
Hello,
Jiricbeng, did you manage to write this Fortran function? I will be grateful if someone could post example of such a routine. In my case, mass flow at inlet is dependent on output expression (Heat flux in a heat exchanger). I did it in CEL Expressions but I am getting error that there is a cyclic dependency. So, I assume that I have to use user fortran. Ansys documentation is not very helpful for a person without experience in Fortran, so I will appreciate any help.
maciekstp is offline   Reply With Quote

Reply

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
How can I fix a local coordinate system to the inlet phys-zephyr STAR-CCM+ 3 May 8, 2014 05:46
Variable Velocity Inlet magnitude and direction Brendan FLUENT 0 March 24, 2014 06:24
Variable Inlet Boots Electric CFX 1 December 2, 2013 16:16
Spatially and temporally variable inlet cfd_user2011 OpenFOAM 1 June 22, 2011 12:35
variable pressure at inlet boundary Stephanie Siemens 3 August 23, 2008 06:04


All times are GMT -4. The time now is 18:44.