|
[Sponsors] |
Varying mass flow at an inlet boundary condition. Fuel mass flow. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 22, 2014, 06:28 |
Varying mass flow at an inlet boundary condition. Fuel mass flow.
|
#1 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Sirs:
Can anyone explain how I can set this up. I am a beginner in this field, so will need a step by step approach. Need to for an example to set an on/off of fuel gas mass flow rate. On/off at 5 seconds intervals. If it is through UDF, please explain how. Note: I got a reply before on this subject, but can not find thread. Thanks. AH |
|
April 24, 2014, 22:42 |
|
#2 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Just add as many "else if" you need to this example from Ansys Fluent UDF Manual 15.0:
2.3.19.11. Example 9 - Mass Flow Rate UDF for the Mass Flow Inlet This UDF is used to provide a time-varying specification of the mass flow rate. This boundary condition can be applied using a DEFINE_PROFILE UDF. #include "udf.h" DEFINE_PROFILE(inlet_mf,th,i) { face_t f; begin_f_loop(f,th) { if(CURRENT_TIME <= 5.0) F_PROFILE(f,th,i) = 1.0; else if(CURRENT_TIME <=10.0 && CURRENT_TIME >5.0) F_PROFILE(f,th,i) = 0.0; else if(CURRENT_TIME <=15.0 && CURRENT_TIME >10.0) F_PROFILE(f,th,i) = 1.0; else if(CURRENT_TIME <=20.0 && CURRENT_TIME >15.0) F_PROFILE(f,th,i) = 0.0; else F_PROFILE(f,th,i) = 1.0; } end_f_loop(f,th); } |
|
April 28, 2014, 09:15 |
setting up
|
#3 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Mac
thank you for your reply. Being a beginner, I will be asking more questions. How to put it into practice? 1. In the define drop down menu, I can see functions>Interpret or Compiled or Manage. What do I choose? I assume interpreter. 2. If Interpreter, where do I past the suggested code? can this be done in a word file and saved in a specific format? 3. What is the boundary condition name which I will be entering in the "Mass flow Inlet" boundary condition? 4. What is the subroutine code name or file name which I need to enter in the Interpreted UDF menu, , Browse ..? 5. In the suggested code, I need to have some think like "mass = 0.001". This will be read in the boundary condition menu of mass flow inlet of for an example 0.001 kg/s. Thanks |
|
April 28, 2014, 10:29 |
|
#4 | |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Quote:
|
||
April 29, 2014, 05:49 |
Capturing the result of varying outlet boundary condition
|
#5 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Mac
Thank you for your help, also went through the manuals just like you have mentioned. Now I have run the model. Now that I have this varying inlet condition. The resulting outlet boundary condition will naturally vary. Its a pressure outlet boundary condition, let us call it X-Out. I understand that there is a way of capturing this varying boundary condition on a graph. The graph needs to plot pressure at X-Out versus time. Can you please or anyone show how this can be done. Thanks again. |
|
September 11, 2014, 07:23 |
A C routine for a non return valve
|
#6 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear friends:
On similar lines to what is shown below. I have now another boundary condition. An inlet which needs to allow air to flow into the container, when there is a pressure drop below zero gauge pressure. Another words, a non-return valve. Is there another routine in C language that I need to apply? Will this C routine be in a separate file to the one shown below (which is for another boundary condition of mass flow inlet)? Thanks. |
|
September 11, 2014, 12:20 |
|
#7 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Hi AH,
I'm not sure I have a good understanding of your problem. A pressure drop between what and what? But the general answer is that all your routines can be in the same udf file. You will probably have to use a DEFINE_EXECUTE_AT_END macro with face loops in order to check the pressure drop between 2 boundaries (I guess). The result of this calculation will serve in a conditional statement within a DEFINE_PROFILE macro. Sorry I don't have time to show you an example. Look in the UDF guide, you can find UDF examples with multiple macros that are coupled. |
|
September 15, 2014, 05:21 |
problem description sketch
|
#8 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Macfly
thank you for your reply. I am not familiar with C language. Also, just started learning CFD. Have attached a problem description, and would appreciate if a procedure is entered in the C language example dated 24th of April. Thanks. |
|
September 15, 2014, 08:15 |
|
#9 | |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Quote:
If you are starting learning, the UDF Guide is your best reference in order to learn the basics, not the forum. You will never get answers in the forum that are as clear as the UDF Guide (for the basics). Good luck |
||
September 15, 2014, 15:12 |
|
#10 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
If you give it your best shot, don't succeed, and post your effort here, people will be willing to help you understand what you did wrong and improve your code, so the next time you can do it yourself. |
||
September 16, 2014, 07:14 |
|
#11 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Pakk
Thank you for your advise. It is perfectly normal to ask a question. We are on this site from different levels of experience and are here to share our experience. Yes, I have been trying and will continue to search for a solution. Thanks. |
|
September 16, 2014, 10:14 |
|
#12 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
It is no problem that you asked a question. Up to and including your message of September 11, 2014 12:23, all your questions were fine. And then macfly gave you an answer to show you which direction you should go.
Nobody expects you to understand everything immediately, and it is ok to come back with further questions, especially because you mentioned you just started learning CFD and are not familiar with C language. But when you say "Have attached a problem description, and would appreciate if a procedure is entered in the C language example dated 24th of April.", you give the impression that you don't want to understand CFD or C, that you don't want to learn anything, but that you want macfly to write a UDf that you can use so you don't have to program anything. That is not asking questions. That is asking somebody else to do your work. I assume that you did not mean to be rude, but this is how your message was received, at least by me. |
|
October 13, 2014, 05:13 |
|
#13 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear sirs/madams:
I have made an attempt to write a C udf to loop over a cell face. With a condition if the pressure falls bellow zero, 1 will be the value for the boundary inlet. Else if, the pressure on the cell face is greater than 100, then the boundary inlet will be zero. Trying to create a non return valve. Question assuming the SECOND part of this code is correct, how will I specify what cell face number? There are hundreds of cells? #include "udf.h" DEFINE_PROFILE(inlet_mf,th,i) { face_t f; begin_f_loop(f,th) { if(CURRENT_TIME <= 5.0) F_PROFILE(f,th,i) = 1.0; else if(CURRENT_TIME <=10.0 && CURRENT_TIME >5.0) F_PROFILE(f,th,i) = 0.0; else if(CURRENT_TIME <=15.0 && CURRENT_TIME >10.0) F_PROFILE(f,th,i) = 1.0; else if(CURRENT_TIME <=20.0 && CURRENT_TIME >15.0) F_PROFILE(f,th,i) = 0.0; else F_PROFILE(f,th,i) = 1.0; } end_f_loop(f,th); } /*second part. The following lines are to monitor pressure on a specific face pressure and loop over it with conditions. DEFINE_PROFILE(vary,th,i) { C_P(c,t) begin_f_loop(f,t) { pressure = F_P(f,t) if(pressure <= 0) F_PROFILE(f,th,i) = 1; else if(pressure > 1000) F_PROFILE(f,th,i) = 0; } end_f_loop(f,t) } |
|
October 13, 2014, 06:23 |
|
#14 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Hi visitor,
I don't understand your question: where do you want to specify a cell face number? For your code, the line 'C_P(c,t)' should be removed, and you need to choose to call the thread "th" or "t", but not use both to refer to the same thing, that won't work. |
|
October 13, 2014, 07:09 |
|
#15 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Pakk
Thank you for your reply. 1- Deleted C_P(c,t). 2- Replaced th with t. 3- Regarding where to specify the cell number? Anywhere as long as the specific cell number is read in the body fluid. Let us say I want the code to read pressure in cell number 100. How can I specify this. 4- Also, one more concern, I am concerned about running in parallel processors. Thanks in advance for your explanation. Regards. --------- #include "udf.h" DEFINE_PROFILE(inlet_mf,th,i) { face_t f; begin_f_loop(f,th) { if(CURRENT_TIME <= 5.0) F_PROFILE(f,th,i) = 1.0; else if(CURRENT_TIME <=10.0 && CURRENT_TIME >5.0) F_PROFILE(f,th,i) = 0.0; else if(CURRENT_TIME <=15.0 && CURRENT_TIME >10.0) F_PROFILE(f,th,i) = 1.0; else if(CURRENT_TIME <=20.0 && CURRENT_TIME >15.0) F_PROFILE(f,th,i) = 0.0; else F_PROFILE(f,th,i) = 1.0; } end_f_loop(f,th); } /*second part. The following lines are to monitor pressure on a specific face pressure and loop over it with conditions. DEFINE_PROFILE(vary,t,i) { begin_f_loop(f,t) { pressure = F_P(f,t) if(pressure <= 0) F_PROFILE(f,t,i) = 1; else if(pressure > 1000) F_PROFILE(f,t,i) = 0; } end_f_loop(f,t) } |
|
October 13, 2014, 07:14 |
|
#16 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I am sorry, but I still don't understand.
I see no need to specify a cell number anywhere, I don't know why you would want to specify a cell number anywhere, I don't know which function the cell number should have in your code, I don't know where (in the code) you would want the cell number to be... What is wrong with the code that you supplied? What is the thing you want to add by including a cell number? |
|
October 13, 2014, 07:57 |
|
#17 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Sirs/Madams:
Thanks again. In a large body of fluid, as an example in the sketch I have uploaded in previous postings. Pressure can slightly vary in the enclosed body of fluid, depending on location. I will carry on searching through manuals, if anyone can help thanks in advance. Dear Pakk, thanks again. |
|
October 13, 2014, 11:39 |
|
#18 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
||
October 14, 2014, 09:21 |
|
#19 |
Senior Member
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0 |
Dear Mac
Thanks. Added: - real pressure; face_t f; Hope it will work when I get to the uni computer lab. Regards. -------------------------- 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 if(pressure > 1000) F_PROFILE(f,t,i) = 0; } end_f_loop(f,t) } |
|
October 14, 2014, 09:33 |
|
#20 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
I think you should add a condition if 0<pressure>1000.
Also I don't understand where you want to apply these 2 profiles: you'd better to attach some pictures of your domain/boundary conditions. |
|
|
|
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 |