## Fluids

Topics relate to Fluent, CFX, Turbogrid and more

#### Problem while using expressions

• epanunzio
Subscriber

Hi all,

I'm working on a transient simulation in Fluent (R2020 R2). The goal is to predict the time needed to heat up a plate with water, considering the transient phase of the water heating process too.

Let's say that I have 10 kW of power to heat up the water (heat capacity c), a "virtual tank" of 10 kg (which is not present in the simulation but I think I should take into account the total water quantity inside the heater) and a water mass flux of 0.1 kg/s.

For a certain dt, I imagine the process as:

• 0.1*dt kg of water returns into the heater at the exit of the plate, at a temperature Tcold. This temperature is the average over the outlet boundary.
• the previous water mixes inside the tank, reaching an equilibrium temperature;
• the heater gives energy to the total mass of water, raising its temperature to Thot;
• the heater pumps out 0.1*dt kg of water at temperature Thot. This Thot is used as boundary condition over the inlet.

To recap, water inlet temperature is a function of the water outlet temperature, mass flux and heater power.

So, a general expression of Thot is = (Thot(timeStep-1)*10 kg + Tcold*0.1*dt kg)/(10+0.1*dt)kg + 10 kW*dt/((10+0.1*dt)kg * c

From the theory this should work, but in practice I don't understand what Ansys is picking up as Thot(timeStep-1) and Tcold. Below, I attach a picture that shows the expression with the "expected" result, starting from Thot = Tcold = 293.15 K:

• KR
Hello:
How are you picking up the temperature in the previous time-step (t-1)? I think you may need to use a UDF.
• epanunzio
Subscriber
Hi Kremella the temperature T(t-1) is the T average over the inlet. After all, I don't see any difference compared to the expression example that ANSYS user guide provides at this link and that I used as a starting point:
5.4.3. Controlled Outlet Temperature (ansys.com)
The fact is that my Tadjust is correct when I update its value inside the expression editor (293.155 K), but the actual inlet temperaure after one iteration is 293.268 K while should be equal to Tadjust.

• Rob
Ansys Employee
Try MassAve rather than Average. I'm not sure how the latter is derived.
• DrAmine
Ansys Employee
Transport Quantities:-> Use Mass Weighted Average! (even if the example is not using it).
Is not 100% like the method in the example: I do not understand the process you are describing but maybe I am tired and should start the weekend. Moreover if you want to access value of previous time step: you require UDF for now (we will make that better) or using some UDM kind of patching workaround.
• epanunzio
Subscriber
Hi Rob, Hi DrAmine I haven't tried "Mass Weighted Average" instead of "average" yet. What I did is to test the method described with a stationary analysis and... it worked! Unfortunately, what I'm looking for is not a steady analysis with adjustable inlet condition, but a true time-dependent boundary condition, so I think I will go through the UDF.
I will update you in case the mass weighted average works with an unsteady analysis.
Regards Enrico
• KR
Hello:
If you wish to obtain the data at a previous time step, you will need to use a UDF. As Amine mentioned, we may be able to use Fluent Expressions for this in the future (not at this point).
Karthik

• DrAmine
Ansys Employee
:)
• epanunzio
Subscriber
Little update: I can confirm that the steady example case is working because the previous temperature is accessible only in terms of iteration. Since a steady case works with iterations, the approach seen in section 5.4.3 of Ansys User Guide is ok. In order to work with an unsteady case, the "max iteration/time step" value MUST be equal to 1 to emulate a steady analysis in terms of iteration - temperature accessibility. The problem is that only one iter/time step is not sufficient to ensure stability...
Thanks for all you support by the way.
Regards Enrico
• DrAmine
Ansys Employee
Yes that is probably the reason.
You are welcome