|
[Sponsors] |
Varying mass flow at an inlet boundary condition. Fuel mass flow. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 26, 2015, 06:25 |
|
#61 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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, 02:58 |
UDF for mass flow rate varying with time
|
#62 |
New Member
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11 |
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, 05:12 |
|
#63 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Code:
for- /* for time = .0001s to .01410s with .0001 increment */ Then, you can just use Code:
t=CURRENT_TIME |
|
March 5, 2015, 01:19 |
|
#64 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
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 20, 2015, 00:26 |
udf for yransient mass flow inlet
|
#65 |
New Member
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11 |
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, 03:55 |
|
#66 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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, 05:39 |
|
#67 |
New Member
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11 |
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, 05:52 |
|
#68 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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, 05:55 |
|
#69 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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, 06:03 |
|
#70 |
New Member
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11 |
thank you for the help
|
|
October 30, 2017, 17:38 |
stop program by missed semicolons
|
#71 |
New Member
mrwan
Join Date: Dec 2015
Location: egypt
Posts: 27
Rep Power: 10 |
#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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Boudaries for bouynat driven flow with additional mass flux at inlet | Charon | CFX | 2 | April 27, 2013 09:02 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 04:32 |
velocity calculations in mass flow inlet boundary condition | montazer1012 | FLUENT | 1 | October 18, 2010 04:11 |
Mass flow boundary condition | Renato. | Main CFD Forum | 0 | July 21, 2006 23:07 |
New topic on same subject - Flow around race car | Tudor Miron | CFX | 15 | April 2, 2004 07:18 |