|
[Sponsors] |
March 2, 2015, 00:51 |
pulsating pressure flow-udf
|
#1 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
hi all
i am working on transient analysis on 3 cylinder diesel engine exhaust manifold.it contains 2 inlets and 1 outlet.The firing order is 1-2-3.For the first firing it will goes to 1st inlet and 2nd and 3rd firing it will goes to 2nd inlet.Here the problem is for the first 0.02s the first inlet should opens,next 0.04th second second inlet should open and for next 0.06th second again second inlet has to open.for this i have written udf file files for inlet 1 and inlet 2,but these are not working correctly.please help me. inlet 1 udf file #include"udf.h" DEFINE_PROFILE(unsteady_pressure_in1,thread,positi on) { int n=1; face_t f; real t=CURRENT_TIME; begin_f_loop(f,thread) { if (t==n*0.02) { F_PROFILE(f, thread, position) = 9884.55; } n=n+3; } end_f_loop(f, thread) } for 2nd inlet udf file #include"udf.h" DEFINE_PROFILE(unsteady_pressure_in2,thread,positi on) { int i=1; face_t f; real t=CURRENT_TIME; begin_f_loop(f,thread) { if(t>=(i+1)*0.02 && t<=(i+3)*0.02) { F_PROFILE(f,thread,position)=9884.55; } i=i+3; }end_f_loop(f,thread) } my email varanasi.anandarao2013@vit.ac.in && num 9677108743 |
|
March 2, 2015, 04:03 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Please be more clear. What is wrong? The code does not compile? If so, which compile errors are given? The code compiles, but gives errors when you run? If so, which errors do you get? You don't get errors when you run, but the results are clearly wrong? If so, what is clearly wrong about it?
|
|
March 3, 2015, 01:07 |
pulsating pressure flow -udf
|
#3 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
sorry for sending private message.
code was compiled but results were wrong.here i a am attaching the profile for inlet 1,how it should come.but the results are showing constant pressure at inlet with earlier code . |
|
March 3, 2015, 07:20 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
I'll focus on this code part, for the first inlet:
Code:
begin_f_loop(f,thread) { if (t==n*0.02) { F_PROFILE(f, thread, position) = 9884.55; } n=n+3; } end_f_loop(f, thread) -Starting at the first cell face of the inlet, check if the time is exactly equal to n*0.02=0.02 seconds. If it is, set the pressure to 9884.55 Pa, otherwise (so even if it is one microsecond later) do nothing. -Then, increase n by 3, so n becomes 4. I really don't know why you do this, what is the function of n??? -Anyway, then go back to the second cell face, and check if the time is exactly equal to n*0.02=0.08 seconds. If it is, set the pressure to 9884.55 Pa, otherwise (so even if it is one microsecond later) do nothing. -Then, again increase n by 3, so n becomes 7. -Go back to the third cell face, check if the time is exactly equal to n*0.02=0.14 seconds. And so on. So you have written a UDF that effectively does nothing. Only if the simulation time is exactly a multiple of 0.02 seconds, then maximally one cell could have a different pressure for that one time step, but this effect is so minimal that you probably will not see it even if it happens. |
|
March 3, 2015, 23:57 |
pulsating pressure flow -udf
|
#5 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
thank you for your valuable suggestion.
still i am able to write the code for the above figure,if possible can you write the code for that.it will be very helpful for my project. |
|
March 4, 2015, 02:56 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
Yes, I can write the code for you.
But I am doing something more valuable: I am trying to help you understand the code. This will be helpful not only for your current project, but also for all your future projects. If you understand what is wrong with your current code, it should be easy for you to repair. Just give it a try. The more you try, the more I will help. |
|
March 8, 2015, 02:23 |
pulsating pressure flow analysis
|
#7 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
thank you sir for your suggestion.
I have tried in mat lab for the inlet 2 programme ,but up to 2 cycles the result came, for the next iterations its not working. actually this is the sequence,how it works inlet 1 inlet 2 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 so on so on can you help me. inlet 2 p_max = 135325; %Peak total pressure (Pa) p_min = 0; %Lowest pressure (Pa) range = p_max-p_min; p_amp = range/2; %mean total pressure amplitude (Pa) rpm = 1500; ang_vel = 2*3.14*rpm/60; time_period = 0.04; %(60/rpm)/2; %Time period (sec) %pulse_time_period = 0.01; max_time = 8*time_period; time_step = 0.0025; ti = 0:time_step:max_time; %ti_pulse = 0.01:time_stepulse_time_period; n=1; j=1; k=0.01; for i=1:numel(ti) if ((ti(i) >= k && ti(i) < (k+0.02))) p(i) = p_amp .* sin((ang_vel*ti(n))); n=n+1; if ( ang_vel*ti(n)>= 3.14) % || ti(i)== (k+0.02)) n=1; k=k+0.02*j; j=1.5; end %elseif (ti(i) == (k+0.02)) % p(i)=0; else p(i)=0; n=1; j=1; end end plot(ti,p); grid on; |
|
March 8, 2015, 02:26 |
pulsating pressure flow -udf
|
#8 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
inlet1
0.02 0.08 0.14 0.2 0.26 ...... inlet2 0.04 0.06 0.1 0.12 0.16 0.18 0.22 0.24 0.28 0.30 ..... |
|
March 10, 2015, 02:16 |
|
#9 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
please any one help me in writing the programme.
|
|
April 1, 2015, 03:12 |
udf
|
#10 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
hello pakk
i have written the code but in residual monitors profile was not coming correctly. |
|
April 1, 2015, 03:15 |
udf
|
#11 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
by using ansys help .i have wrote in matlab and converted in C.
IN ANSYS help they given the udf for 2d geometry.whether the same format will work for 3d geometry or not?????? |
|
April 1, 2015, 03:17 |
udf
|
#12 |
New Member
Join Date: Feb 2015
Posts: 11
Rep Power: 11 |
these are programmes in C for both inlets.please suggest me it is right or wrong
/* exhaust_inlet.c Inlet pressure at exhaust */ #include"udf.h" #define P_MAX 34000 //peak input pressure (Pa) #define ANG_VEL 157.796 //Angular velocity (rad/s) DEFINE_PROFILE(exhaust_profile_1,t,i) { face_t f; real ti = CURRENT_TIME; int j=1,n=1,theta=1; //n=0 begin_f_loop(f,t) { theta = ANG_VEL*ti; F_PROFILE(f,t,i)= P_MAX * sin(theta); if(theta >= (j*3.14)) { j=j+1; n=n*(-1); } if(j%3 ==0) { F_PROFILE(f,t,i)=0; } } end_f_loop(f,t) } DEFINE_PROFILE(exhaust_profile_2,t,i) { face_t f; real ti = CURRENT_TIME; int j=1,n=1,theta=1; //n=0 begin_f_loop(f,t) { theta = ANG_VEL*ti; F_PROFILE(f,t,i)= 0; if(theta >= (j*3.14)) { j=j+1; n=n*(-1); } if(j%3 ==0) { F_PROFILE(f,t,i)=P_MAX * sin(theta); } } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Review: Reversed flow | CRT | FLUENT | 1 | May 7, 2018 05:36 |
Non-steady flow simplified for use in Vissim | steamerandy | Main CFD Forum | 0 | October 31, 2011 21:08 |
UDF to define or adjust pressure??? | engahmed | FLUENT | 0 | July 6, 2010 17:19 |
Fluent 5.2, UDF and Pressure BC's | Alfonso Ferrandez | FLUENT | 0 | May 4, 2000 07:02 |
Hydrostatic pressure in 2-phase flow modeling (CFX4.2) | HB &DS | CFX | 0 | January 9, 2000 13:19 |