CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Periodic channel flow with time dependent mass flow rate (http://www.cfd-online.com/Forums/fluent/117519-periodic-channel-flow-time-dependent-mass-flow-rate.html)

QBeast May 9, 2013 19:59

Periodic channel flow with time dependent mass flow rate
 
Dear fluent users,

I am using a translational periodic channel configuration to explore a specific Reynolds number range, here I am constrained with the periodicity to reduce cells number and keep the computation affordable but the issue is about accessing the mass flow rate targeted value which must be achieved by the pressure gradient, looking at the GUI I see no UDF hook available to set a time dependent mass flow rate ? the problem doesn't occur with velocity inlet BC but for the periodic channel of interest I have searched the forum and found this thread (guys are debating the issue and no definitive solution found):

http://www.cfd-online.com/Forums/flu...flow-rate.html

I would like to know if it is possible to do it using journal file reading?

I've found this document gathering some fluent tips, in pages 48, 49 the author shows a kind of work around for variables lacking udf hooks but this needs the very exact variables name:

http://willem.engen.nl/uni/fluent/do...ips-Tricks.pdf


I am not sure about this, but I am tempted to use a DEFINE_ADJUST to patch periodic faces cells and force their mass flow rate modification (this is surely too simple to get the job done) but the solver would keep looking to satisfy the target mass flow rate value....

time dependent mass flow rate across periodic channel flow?


thanks in advance, need your help guys

best regards.

sbaffini May 10, 2013 02:36

1 Attachment(s)
I have this UDF that i never even tried to test because i don't actually need it (yet).

It basically is (intended to be) a workaround for the fact that a fixed mass flow rate can't be used in the Fractional step method (NITA).

So what i try to do is implementing a PID controller which time step by time step tries to fix the mass flow rate at the desired value by adjusting the forcing in the domain.

What you can try to do is to modify in time the desired value for the mass flow rate (which instead i assumed constant here) and try to figure out the best setting for the PID controller.

The UDF is intended for the parallel Fluent but, it should work for serial too if you modify the following lines:

#if RP_NODE
m_new=PRF_GRSUM1(massflow);
e_new=(m_des-m_new)/(m_des);
F_new=F_old+e_new*k_new+e_old*k_old;
#endif

with:

e_new=(m_des-m_new)/(m_des);
F_new=F_old+e_new*k_new+e_old*k_old;

However, i hope it is VERY CLEAR that i really never tried this UDF and some additional work could be required.

QBeast May 10, 2013 10:07

Dear Paolo,

Thanks for the quick reply, I am examining the file you sent me line by line, I have only one concern about the solver being constrained with the mass flow value condition across the periodic boundaries, I'm trying to make periodic boundary conditions using velocity_inlet / pressure outlet inthis sequential order:

in a DEFINE_ADJUST macro:


1. perform first time iteration

2. loop over outlet boundary nodes
2.1 get nodes values of P,U,V,W from outlet boundary (I think using a plane )
2.2 patch the inlet with P,U,V,W of outlet boundary kept from the previous time step

3. perform next iteration

4. set new x-velocity U=Uprevious+deltaU to shift it up at the inlet and accordingly update the mass flow target value the solver have to meet for pressure outlet boundary

I'm having an issue figuring out how to patch the inlet value of P,U,V,W with those of the previous state of the outlet boundary, in other words how to completly clone (if possible) the outlet boundary cells faces or cells on the inlet plane?

these are previous calculated mean field variables from the outlet I wanna patch the inlet with

C R M1(c,t)
C P M1(c,t)
C U M1(c,t)
C V M1(c,t)
C W M1(c,t)



thanks helping

regards

sbaffini May 10, 2013 13:14

Dear Saad,

i want to stress some points:

1) The concept behind my UDF is that of a forcing, varying in time trough a control process (a PID), and trying to achieve the desired mass flow rate. This is exactly the same thing done by Fluent for fixed mass flow rates with periodic boundary conditions. However, the iterative method used by Fluent is intended to work within outer iterations, which are not present with the NITA approach. Also, i think that my approach is more representative of an actual device trying to control the mass flow.

2) My UDF is intended to work with periodic boundary conditions already set-up in Fluent, but with the pressure gradient equal to zero. Instead, the forcing is provided by you trough the DEFINE_SOURCE part of the UDF which has to be activated for the cell_zone(s) between the two periodic faces. I want to highlight the fact that it is still Fluent handling the periodicity, the UDF only handles the forcing driving the flow.

3) I understand some influence from what you have read in the post you cited above. Forget it. Periodicity is periodicity. If you use velocity-inlet/pressure outlet or any combination of pressure-inlet/pressure-outlet that's not periodicity and the UDF above will not apply (actually, in that case, you can just provide a proper time dependent profile trough an UDF).

4) I don't think i understand why you want to perform the mapping of velocity variables from outlet to inlet (which is actually what periodicity already do, just it does it in both direction). However, if you want to pursue this path, you have to consider that the full set of flow variables is not generally available on interior face threads or even domain boundaries, so the most practical option is to use the variables in the c0 cells (which are always available) of the given faces to be mapped.

5) I already wrote the kind of mapping UDF you are talking about (but without mass flow control, i have to merge the two after the test of the latter) and i use it to map, for each time step, the velocity field from an auxiliary domain to the inlet of my principal domain. This is useful in LES to specify a proper inflow condition. However, the mapping from a face which is in the same domain of your inlet can be a true pain in the ass unless the two faces are really far away. As a matter of fact, despite some fancy paper published with OpenFOAM on the subject, it has no clear advantage at all.


All times are GMT -4. The time now is 08:31.