CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

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

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 26, 2015, 06:25
Default
  #61
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   March 3, 2015, 02:58
Default UDF for mass flow rate varying with time
  #62
New Member
 
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11
nikhilpolpakkara is on a distinguished road
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()
nikhilpolpakkara is offline   Reply With Quote

Old   March 3, 2015, 05:12
Default
  #63
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   March 5, 2015, 01:19
Default
  #64
Senior Member
 
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0
visitor is on a distinguished road
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.
visitor is offline   Reply With Quote

Old   March 20, 2015, 00:26
Default udf for yransient mass flow inlet
  #65
New Member
 
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11
nikhilpolpakkara is on a distinguished road
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
nikhilpolpakkara is offline   Reply With Quote

Old   March 20, 2015, 03:55
Default
  #66
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   March 20, 2015, 05:39
Default
  #67
New Member
 
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11
nikhilpolpakkara is on a distinguished road
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.
nikhilpolpakkara is offline   Reply With Quote

Old   March 20, 2015, 05:52
Default
  #68
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   March 20, 2015, 05:55
Default
  #69
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
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.
`e` is offline   Reply With Quote

Old   March 20, 2015, 06:03
Default
  #70
New Member
 
Nikhil P
Join Date: Mar 2015
Posts: 4
Rep Power: 11
nikhilpolpakkara is on a distinguished road
thank you for the help
nikhilpolpakkara is offline   Reply With Quote

Old   October 30, 2017, 17:38
Default stop program by missed semicolons
  #71
New Member
 
mrwan
Join Date: Dec 2015
Location: egypt
Posts: 27
Rep Power: 10
mrwan is on a distinguished road
#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
mrwan is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 14:20.