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

Additional variable at a previous timestep for use in CEL

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2024, 11:36
Default Additional variable at a previous timestep for use in CEL
  #1
New Member
 
Join Date: Apr 2022
Posts: 25
Rep Power: 4
3nhu1 is on a distinguished road
Hello,

Please could I ask for some assistance, and thank you especially for all the help previously in the last few months

I have a previous boundary condition implemented that had a 2 element windkessel (see picture).
It required me to create an additional variable for pressure at the previous timestep i.e. P(t-1)
What we had done for this was create an additional variable called pprev. Set it to scalar. In the default domain Modified field, pprev was activated as an Algebraic Equation and set to Pressure.
This additional variable in the expression could then be used in the expression for the pout boundary condition using the final equation for P(t) in the picture by calling for P(t-1) as areaAve(pprev)@out1 (the model has multiple outlets that does similar)

I now need to implement a 3 element windkessel (see 2nd picture). The methodology is fairly similar, but I'm having some difficulty as it requires creating an additional variable for flow rate Q at the previous timestep i.e. Q(t-1).
Mainly as there is no global variable for flow. (Although density is constant in the model).
A colleague suggested using velocity. First I have checked and tried the 2 inbuilt functions, and by using a normal velocity at outlet give a reasonable answer.

Additional variable
NormalVelocity = VelDotn
and
CEL
VelDotn = (Velocity u*Normal X + Velocity v*Normal Y + Velocity w*Normal Z)

Then option 1 for q -
areaInt(NormalVelocity)@OutAorta
and option 2 for q -
Qout_option5=areaAve(NormalVelocity)@OutAorta * area()@OutAorta

Option and Option 2 are equal and very similar to the massflow()@OutAorta / Density when post processed.

Knowing this - What would be a reasonable way to implement Q(t-1)?


Ref 2017 Acedo- Optimisation of a windkessel system for arterial simulation (thesis)
Attached Images
File Type: jpg 2EWK.jpg (131.9 KB, 10 views)
File Type: jpg 3EWK.jpg (154.4 KB, 6 views)
3nhu1 is offline   Reply With Quote

Old   February 22, 2024, 18:06
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,719
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
This thread may be interesting: derivative in CEL expressions

As you have got an expression which gives you the flow rate from the velocity, haven't you got an approach which will work for getting Q(last time step)?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   February 23, 2024, 05:54
Default
  #3
New Member
 
Join Date: Apr 2022
Posts: 25
Rep Power: 4
3nhu1 is on a distinguished road
Thank you! That thread looks very helpful and has some ccl I can look at
3nhu1 is offline   Reply With Quote

Old   February 24, 2024, 08:18
Default
  #4
New Member
 
Join Date: Apr 2022
Posts: 25
Rep Power: 4
3nhu1 is on a distinguished road
Think I've managed to make it work

[Option 1]

q(t-1) = areaInt(NormalVelocity)@OutAorta

where
Additional variable: NormalVelocity = VelDotn
&
CEL: VelDotn = (Velocity u*Normal X + Velocity v*Normal Y + Velocity w*Normal Z)


[Option 2]
q(t-1) = qprev
where
Additional variable: qprev = qout0
&
CEL: qout0 = -massFlow()@OutAorta/1060 [kg/m^3]


Also I didn't realise - but after reading the threads I need to put the unsupported setting
"update Loop = TRANS_LOOP"
The results look very wrong otherwise.

The results for option 1 and 2 are slightly different with different sys/dias 126/65 vs 117/54 (not sure why?, although do still need to run it for more cycles as not fully stabilised yet) but both produce realistic looking pressure curves for a 3EWK at the aorta. Which is right - not sure. For now I will use option 1 as I need to use this variable for multiple outlets and I think it saves me creating multiple additional variables which 2 requires.

Also from the thread referenced above:
A value at a previous timestep can also be obtained in this manner, which I think is the more supported way to do this https://forum.ansys.com/forums/topic...-a-cel-in-cfx/
E.g. Previous Pressure = (areaAve(Pressure )@OUTLET-(Pressure.Time Derivative*dtstep))
Attached Images
File Type: jpg 3EWK_pressurecurve.jpg (15.3 KB, 5 views)
3nhu1 is offline   Reply With Quote

Old   February 29, 2024, 05:58
Default
  #5
New Member
 
Evelyn
Join Date: Mar 2021
Posts: 20
Rep Power: 5
Yanlu is on a distinguished road
Quote:
Originally Posted by 3nhu1 View Post
Hello,

Please could I ask for some assistance, and thank you especially for all the help previously in the last few months

I have a previous boundary condition implemented that had a 2 element windkessel (see picture).
It required me to create an additional variable for pressure at the previous timestep i.e. P(t-1)
What we had done for this was create an additional variable called pprev. Set it to scalar. In the default domain Modified field, pprev was activated as an Algebraic Equation and set to Pressure.
This additional variable in the expression could then be used in the expression for the pout boundary condition using the final equation for P(t) in the picture by calling for P(t-1) as areaAve(pprev)@out1 (the model has multiple outlets that does similar)

I now need to implement a 3 element windkessel (see 2nd picture). The methodology is fairly similar, but I'm having some difficulty as it requires creating an additional variable for flow rate Q at the previous timestep i.e. Q(t-1).
Mainly as there is no global variable for flow. (Although density is constant in the model).
A colleague suggested using velocity. First I have checked and tried the 2 inbuilt functions, and by using a normal velocity at outlet give a reasonable answer.

Additional variable
NormalVelocity = VelDotn
and
CEL
VelDotn = (Velocity u*Normal X + Velocity v*Normal Y + Velocity w*Normal Z)

Then option 1 for q -
areaInt(NormalVelocity)@OutAorta
and option 2 for q -
Qout_option5=areaAve(NormalVelocity)@OutAorta * area()@OutAorta

Option and Option 2 are equal and very similar to the massflow()@OutAorta / Density when post processed.

Knowing this - What would be a reasonable way to implement Q(t-1)?


Ref 2017 Acedo- Optimisation of a windkessel system for arterial simulation (thesis)
https://www.researchgate.net/publica...l_in_ANSYS-CFX
__________________
biofluid mechanics;Hemodynamics
Yanlu is offline   Reply With Quote

Old   February 29, 2024, 06:03
Default
  #6
New Member
 
Evelyn
Join Date: Mar 2021
Posts: 20
Rep Power: 5
Yanlu is on a distinguished road
Quote:
Originally Posted by singer1812 View Post
Actuallly you can get the derivative from last time step to current time step via use of additional variables settings. If you create an additional variable of the velocity, and add the term using ccl in the ADDITIONAL VARIABLE term:

Update Loop = TRANS_LOOP


This will cause that variable to take the old value of the velocity. You can use it to create your derivative.
You can refer to this answer.
__________________
biofluid mechanics;Hemodynamics
Yanlu is offline   Reply With Quote

Reply


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
Additional variable Luigi CFX 9 March 26, 2019 16:51
solidification viscosity governed through an additional variable l.te CFX 8 September 13, 2012 19:19
emag beta feature: charge density charlotte CFX 4 March 22, 2011 09:14
use additional variable for CO concentration MinJaeHong CFX 0 August 25, 2008 05:14
GETVAR SUBROUTINE for additional variable in CFX Tuks Main CFD Forum 0 November 8, 2005 06:13


All times are GMT -4. The time now is 10:35.