CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   Implementation of an expression with reference to an earlier timestep (http://www.cfd-online.com/Forums/cfx/93983-implementation-expression-reference-earlier-timestep.html)

MichaelN November 2, 2011 06:45

Implementation of an expression with reference to an earlier timestep
 
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!

ghorrocks November 2, 2011 22:54

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?

MichaelN November 8, 2011 04:07

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.

ghorrocks November 8, 2011 05:20

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.

MichaelN November 8, 2011 05:44

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

ghorrocks November 8, 2011 17:37

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.


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