# Varying mass flow at an inlet boundary condition. Fuel mass flow.

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

 February 26, 2015, 05:25 #61 Senior Member   Join Date: Nov 2013 Posts: 1,916 Rep Power: 23 Ok, then your basic layout for the execute-at-end should be: - start with SUMMEDVOLUME=0 and SUMMEDFRACTION=0 - go through all fluid bodies. for each fluid body: - go through all cells. for each cell: - add the volume to SUMMEDVOLUME - add the co2 fraction to SUMMEDFRACTION - at the end, calculate SUMMEDFRACTION/SUMMEDVOLUME, and store that in a global variable. This is what I mean by describing what the code should do. Try to think like the computer, and list the steps that the computer should take. That is the real programming part. Finding out how to put this in a programming language is not the crucial part of programming. Can you understand the basic layout for the execute-at-end? And do you think it is correct? If so, try to translate this into code. At first, don't care if the computer does not understand what you want, we can help you with the exact syntax. And try to do something similar for the PROFILE-part.

 March 3, 2015, 01:58 UDF for mass flow rate varying with time #62 New Member   Nikhil P Join Date: Mar 2015 Posts: 4 Rep Power: 8 I am beginner in using UDF. i need to give a mass flow rate at inlet which is varying with respect to time. i have created an incomplete UDF. i have a function of which is a polynomial of order 6. can anyone help me with this. #include "udf.h" DEFINE_PROFILE(inlet_MF, thread, index) { real t; face_t f; begin_f_loop(f, thread) { for- /* for time = .0001s to .01410s with .0001 increment */ F_profile(f,thread,index)= -8E+10x6 + 3E+09x5 - 3E+07x4 + 185890x3 - 492.49x2 + 0.5817x - 4E-06 } } end_f_loop()

 March 3, 2015, 04:12 #63 Senior Member   Join Date: Nov 2013 Posts: 1,916 Rep Power: 23 Code: `for- /* for time = .0001s to .01410s with .0001 increment */` You don't need to set this in the UDF, you set the time in Fluent using the transient settings. Then, you can just use Code: `t=CURRENT_TIME` (and replace x by t in your code...) nikhilpolpakkara likes this.

 March 5, 2015, 00:19 #64 Senior Member   AH Join Date: Apr 2014 Posts: 225 Rep Power: 10 Dear Pakk Just to let you know that I am not ignoring your message. We are approaching end of year exams, difficult to find a computer. Just managed half and hour access this week. Regards.

 March 19, 2015, 23:26 udf for yransient mass flow inlet #65 New Member   Nikhil P Join Date: Mar 2015 Posts: 4 Rep Power: 8 Hello, I have been trying to simulate a transient mass flow rate condition. I have mass flow rate in terms of time as a 6th order polinomial equation . How can I give the udf for the same ? Please help

 March 20, 2015, 02:55 #66 Senior Member   Join Date: Nov 2013 Posts: 1,916 Rep Power: 23 See your question and my answer on 3 March. Weird... Why do you repeat this question, if you already have an answer? If the answer was not sufficient, then say so.

 March 20, 2015, 04:39 #67 New Member   Nikhil P Join Date: Mar 2015 Posts: 4 Rep Power: 8 Sorry that i repeated the same question, i will be more precise. #include "udf.h" DEFINE_PROFILE(inlet_mf, thread, index) { float t = CURRENT_TIME; face_t f; begin_f_loop(f, thread) { F_PROFILE(f, thread, index) = -(20000000000*t*t*t*t*t*t) + (700000000*t*t*t*t*t) - (8000000*t*t*t*t) + (46473*t*t*t) - (123.12*t*t) + (0.1454*t) - 0.000001; } end_f_loop(f, thread) } this is the udf i created. will this udf give me a mass flow rate at each .1 millisecond according to the profile thats mentioned? i am able to run the calculation but my solution is not converging. PS : the solution given last time was helpful.

 March 20, 2015, 04:52 #68 Senior Member   Join Date: Nov 2013 Posts: 1,916 Rep Power: 23 Don't ask us, just check this in your simulation results! Even if they are not converged, they show the mass-flow through your inlet.

 March 20, 2015, 04:55 #69 Senior Member   Join Date: Mar 2015 Posts: 892 Rep Power: 15 If your time step is 0.1 ms and your profile is updated at every time step then I'd expect the mass flow rate would be applied every 0.1 ms.

 March 20, 2015, 05:03 #70 New Member   Nikhil P Join Date: Mar 2015 Posts: 4 Rep Power: 8 thank you for the help

 October 30, 2017, 16:38 stop program by missed semicolons #71 New Member   mrwan Join Date: Dec 2015 Location: egypt Posts: 26 Rep Power: 7 #include "udf.h" DEFINE_PROFILE(vary,t,i) { real pressure; face_t f; begin_f_loop(f,t) { pressure = F_P(f,t); if(pressure <= 0) F_PROFILE(f,t,i) = 1; else F_PROFILE(f,t,i) = 0; } end_f_loop(f,t) } this is correct