|
[Sponsors] |
![]() |
![]() |
#61 |
New Member
Farough
Join Date: Jul 2015
Posts: 5
Rep Power: 11 ![]() |
[QUOTE=singer1812;285581]
Hi Emund, I am reading through all these comments you have in this post and other posts. Found them pretty useful and i am wondering if you can help me with my problem: I am trying to get the temperature gradient (dT/dt) in my simulation using the previous temperate. First i define my variable (PreviousTemperature) as follow: LIBRARY: &replace ADDITIONAL VARIABLE: PreviousTemperature Option = Definition Tensor Type = SCALAR Units = [K] Update Loop = TRANS_LOOP Variable Type = Specific END END then after, i define my dT/dt as follows: (Temperature - PreviousTemperature)/dt dt is my timesteps. I am not sure what i am doing wring but my dT/dt goes to negative which doesn't make scene at all. Is that because of the way i define PreviousTemperature?? Highly appreciate your help. |
|
![]() |
![]() |
![]() |
![]() |
#62 |
Senior Member
Join Date: Jun 2009
Posts: 1,850
Rep Power: 33 ![]() |
For transient runs, you should be able to access the time derivative by using
Temperature.Time Derivative No need for a workaround, Hope it helps, |
|
![]() |
![]() |
![]() |
![]() |
#63 |
New Member
Farough
Join Date: Jul 2015
Posts: 5
Rep Power: 11 ![]() |
Thanks Opaque. I will try it and will see what happens. Does it even work for the first time step?
|
|
![]() |
![]() |
![]() |
![]() |
#64 |
New Member
Farough
Join Date: Jul 2015
Posts: 5
Rep Power: 11 ![]() |
Hi Opaque,
Your solution on time derivative of a variable like Temperature worked perfectly. Thanks for your help.... Now i am wondering if you/anybody else know how to take the Time Derivative of a CEL function???? |
|
![]() |
![]() |
![]() |
![]() |
#65 |
Senior Member
Join Date: Jun 2009
Posts: 1,850
Rep Power: 33 ![]() |
Create an algebraic additional variable
Insert AdditionalVariable ->MyAVCELFunc Activate Additional Variable in Domain panel Select Option = Algebraic Expression Additional Variable Value = MyCELFunc( .., .. , ...) Done.. If you need the Time Derivative, just reference it where needed as MyAVCELFunc.Time Derivative. |
|
![]() |
![]() |
![]() |
![]() |
#66 |
New Member
Farough
Join Date: Jul 2015
Posts: 5
Rep Power: 11 ![]() |
Awesome. Great help... Thanks for your quick reply Opaque.
|
|
![]() |
![]() |
![]() |
![]() |
#67 |
New Member
Join Date: Dec 2022
Posts: 29
Rep Power: 3 ![]() |
Hey, I am testing this 'Update Loop = TRANS_LOOP' method by trying to make a plot of oldVel = oldVel + 1 [m/s], which should start at oldVel = 0 and increase with 1 m/s at each iteration.
I am using Fluid Flow (CFX) in Workbench. I have added an AV called oldVel, added 'Update Loop = TRANS_LOOP', and have given it the value 0 [m/s]. If I run the solver with one iteration and open the .res file in CFX-PST I can see the oldVel value of 0 m/s has been saved. (see OutFile1) Then I open CFX-PRE and change ‘Add. Var. Value’ from 0 to ‘oldVel + 1 [m/s]’ in the Default Domain. And in Solver Control I change the Max. Iterations from 1 to 100. In CFX-SM I then select the .res file for the Initial Value 1 Settings. When I run I get the error: Error in subroutine GET_VARVX : OLD : Failure to get data area USER_AV1_FL1 GETVAR originally called by subroutine SU_DVAR_ZONE (see OutFile2) Does anyone know what is going on? I am new to CFX, so some help is very much appreciated. |
|
![]() |
![]() |
![]() |
![]() |
#68 | |
Senior Member
Join Date: Jun 2009
Posts: 1,850
Rep Power: 33 ![]() |
Quote:
Since you are new to Ansys CFX, it is best to explain what you are trying to achieve before getting into unsupported features. Perhaps there are better ways to achieve your goals w/o workarounds.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
![]() |
![]() |
![]() |
![]() |
#69 |
New Member
Join Date: Dec 2022
Posts: 29
Rep Power: 3 ![]() |
If only there was an 'initial value' box next to expression AV's
![]() In an expression I have I need to refer to the expression value of the previous iteration. Current value = previous value + slope*timestep (I've sent you a PM with more details. Let me know if you think I should add those details here) |
|
![]() |
![]() |
![]() |
![]() |
#70 |
Senior Member
Join Date: Jun 2009
Posts: 1,850
Rep Power: 33 ![]() |
You are describing where you are having problems, not what you are trying to achieve.
From the variable names used, it seems you are integrating in time explicitly using the first-order approximation. So you are trying to compute Value (t+dt) = Integral from t->t+dt of (whatever expression).dt Since there is no more context, it is impossible to know if you want to do this for a field variable, i.e. for each location within a domain or just a single value. The former is not a built-in functionality, the latter is easy to achieve using a monitored expression plus its statistics. Create a monitor point, say MyTimeIntExpr Select Option = Expression Set Expression Value = expression to be integrated Set Monitor Statistics Select Time Integral Set range of the time integral If you need the current Value at a given t to be used in another expression, you can create another monitored expression Create a monitor point, say MyProbeTimeIntExpr Select Option = Expression Set Expression Value = probe(Expression Value.Time Integral)@MyTimeIntExpr No need for workaround if the goal is a single valued result.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
![]() |
![]() |
![]() |
![]() |
#71 |
New Member
Join Date: Dec 2022
Posts: 29
Rep Power: 3 ![]() |
Thank you for your answer. I think your suggestions are for use of the expression in Post. I need them in Pre. I’m sorry I should have been more clear.
I am performing a Transient simulation of a Rigid Body which is submerged in water. The water flows in x-direction, and the Rigid Body is free to move in x-direction only. After some time, the Rigid Body has a certain velocity of VV [m/s]. At that moment I want to apply a Force in x-direction on the Rigid Body, which decelerates the Rigid Body. I have already build that with an if statement: External Force 1 = if(rbstate(Linear Velocity X)@Rigid Body 1 >= VV, ForceValue, 0 [N]). This works well so far. The change I want to make now, is to apply a gradual force on the Rigid Body once the velocity of VV has been reached instead of a sudden increase from 0 to ForceValue. Therefor I need to store the previous value of the force applied on the RB in x-direction (so a single value), such that I can increase it by slope*timestep at the next iteration. |
|
![]() |
![]() |
![]() |
![]() |
#72 | |
Senior Member
Join Date: Jun 2009
Posts: 1,850
Rep Power: 33 ![]() |
Quote:
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
![]() |
![]() |
![]() |
![]() |
#73 | ||
New Member
Join Date: Dec 2022
Posts: 29
Rep Power: 3 ![]() |
Hello Opaque, thanks again for your answer. I believe I read the relevant topics within the documentation guides (but it could be I do not know exactly what to look for), and looked for threads and tutorials which try to achieve something similar. The closest I got to a source which refers to a value from a previous timestep is this thread.
I understood you suggested me to create these monitor points and set monitor statistics within CFX-Pre. It is because I read that transient statistics data are not available for CEL expressions in Pre, that I assumed you believed I needed the expression values in Post. I have however tried if your suggestions can get me any closer to my goal, but without success. Quote:
Quote:
Error in subroutine GET_VARVX : OLD : Failure to get data area USER_AV1_FL1 GETVAR originally called by subroutine SU_DVAR_ZONE I wrote my initial post because I can’t find info about the above error. If you have any suggestions or alternatives based on the additional info I provided on December 29, I am really happy to hear it. |
|||
![]() |
![]() |
![]() |
![]() |
#74 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,816
Rep Power: 144 ![]() ![]() ![]() ![]() |
There is no information on the CFX error messages. You have to guess what it means. This is a bit silly, and a list of error codes and descriptions would be really helpful - but it does not exist.
Many of the applications discussed on this thread would appear to be better done using User Fortran rather than the TRANS_LOOP approach. Using unsupported features is often going to lead to inexplicable outcomes. At least with User Fortran you can control things. It does have a steep learning curve however.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
![]() |
![]() |
![]() |
![]() |
#75 |
New Member
Join Date: Dec 2022
Posts: 29
Rep Power: 3 ![]() |
I didn't find a solution for my problem using TRANS_LOOP or Fortran.
In the end I managed to add a gradual force on the Rigid Body by adding a damper force to the RB: x-component of External Force: -1*dampingcoefficient*rbstate(Linear Velocity X)@Rigid Body 1 Perhaps that helps someone in the future ![]() |
|
![]() |
![]() |
![]() |
![]() |
#76 |
New Member
David Dudli
Join Date: Oct 2020
Location: Switzerland
Posts: 8
Rep Power: 5 ![]() |
I managed to directly access the time derivative and the gradients by just typing
Code:
<Variable Name>.Time Derivative <Variable Name>.Gradient X ... Last edited by schnafkid; March 22, 2023 at 05:42. Reason: Spelling Errory |
|
![]() |
![]() |
![]() |
![]() |
#77 |
New Member
zh
Join Date: Oct 2023
Posts: 13
Rep Power: 2 ![]() |
Do you know how the traffic at the last time step in the ansys cfx is represented by additional variables?
I am doing windkessel boundary conditions, encountered difficulties, I hope you can help me, I will be very grateful! |
|
![]() |
![]() |
![]() |
![]() |
#78 |
New Member
zh
Join Date: Oct 2023
Posts: 13
Rep Power: 2 ![]() |
Do you know how the traffic at the last time step in the ansys cfx is represented by additional variables?
I am doing windkessel boundary conditions, encountered difficulties, I hope you can help me, I will be very grateful! |
|
![]() |
![]() |
![]() |
![]() |
#79 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,816
Rep Power: 144 ![]() ![]() ![]() ![]() |
I do not understand your question. Can you write your question again?
Is this question related to the rest of this thread? If it is a new question please start a new thread.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
![]() |
![]() |
![]() |
![]() |
#80 |
New Member
zh
Join Date: Oct 2023
Posts: 13
Rep Power: 2 ![]() |
I am doing the windkessel model with ansys cfx and need the derivative of the flow rate to the time, so, I want to know how to get the flow rate at the last time step.
|
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cel expressions | RAMAN6089 | CFX | 13 | November 30, 2009 23:17 |
junction box routine and CEL function | bornspur | CFX | 2 | February 3, 2009 02:24 |
Cel expressions for trasient problem | Jervds | CFX | 0 | March 4, 2008 10:03 |
Cel expressions Time dependent | Juan Maria Campos | CFX | 8 | December 27, 2007 18:16 |
CEL Expressions | Nick | CFX | 3 | September 25, 2007 14:54 |