# Implementation of an expression with reference to an earlier timestep

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

 November 2, 2011, 05:45 Implementation of an expression with reference to an earlier timestep #1 New Member   Join Date: Jun 2011 Posts: 5 Rep Power: 8 Hi, i've got a problem I cannot solve with the cfx tutorials. In my simulation i have got several openings with loss coefficients. These loss coefficients depend on the mass flow and should change to achieve a certain mass flow. My idea ist to have a time dependent loss coefficient. so L(t=1)=L(t=0)+delta(L) and L(t=2)=L(t=1)+delta(L) every timestep the delta(L) is calculated with the actual mass flow which isn't a problem at all. But i don't know how to refer to an expression from an earlier time step. thank you for you help!

November 2, 2011, 21:54
#2
Super Moderator

Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 14,336
Rep Power: 110
Quote:
 But i don't know how to refer to an expression from an earlier time step.
You cannot.

If you know the mass flows then why not just apply a mass flow boundary?

 November 8, 2011, 04:07 #3 New Member   Join Date: Jun 2011 Posts: 5 Rep Power: 8 Thank you for your answer. I don't think I can apply a mass flow boundary condition to an opening. Even if it was possible, the idea is to simulate the dynamic behaviour of a system which tries to achieve a certain condition.

November 8, 2011, 05:20
#4
Super Moderator

Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 14,336
Rep Power: 110
Quote:
 I don't think I can apply a mass flow boundary condition to an opening
You can't. You make it an inlet or outlet.

I have no idea what your final sentence means.

 November 8, 2011, 05:44 #5 New Member   Join Date: Jun 2011 Posts: 5 Rep Power: 8 Sorry for my bad english. What I tried to say is the following: I want to have model with loss coefficients set for the openings. These loss coefficients can should be calculated at every timestep during my transient simulation. To do so I always need the loss coefficient from en earlier timestep. My idea was to export the value of the loss coefficient L(t=0) to an external data file. Then doing the calculation and having L(t=1) as an input for the next timestep. Is there an easy way to do so? thanks Last edited by MichaelN; November 8, 2011 at 08:44.

 November 8, 2011, 17:37 #6 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 14,336 Rep Power: 110 You will have to use fortran to read and write to the file, and if you are using fortran then you can simply store the old value so no need to write to a file. You have two options available: 1) User fortran 2) Use the trick which allows you to access scalars from previous time steps (do a search on the forum to find this) I think option 1 is best for your application based on what you have described.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post fu-ki-pa OpenFOAM 10 May 1, 2014 16:26 skabilan OpenFOAM Installation 3 July 28, 2009 00:35 allenzhao OpenFOAM Installation 127 January 30, 2009 20:08 Bruno Main CFD Forum 1 January 30, 2007 01:34 anne OpenFOAM Installation 8 June 15, 2006 09:27

All times are GMT -4. The time now is 14:20.