|
[Sponsors] |
March 23, 2015, 05:54 |
|
#41 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Those are the same equations as in your first post of this thread which you've already coded for...
|
|
March 27, 2015, 01:08 |
|
#42 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Thanks for the reply. I was out of station for 3 days..
In every parers they have mentioned the same formula to find out the f_viscous. Still I am not getting an idea to find free stream value of f_viscous. Please help. Thanks |
|
March 27, 2015, 01:22 |
|
#43 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Ok, I misunderstood your question then if you're searching for a different equation for the f_viscous function of the free stream. I'm not familiar with the details of shock waves; good luck!
|
|
March 27, 2015, 05:43 |
|
#44 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Ok ill find out that later..
This is my entire code for detection of shock sensor. this is compiling well but not yielding results.. Any help would appreciated. Code:
#include "udf.h" #include "math.h" #include "sg.h" #include "mem.h" #define gamma 1.4 #define temp_infi 288.15 #define rho_infi 1.225064 #define pre_infi 101325 #define u_infi 248.0514708 #define R 287 #define M_infi 0.729 #define a 340.26 DEFINE_ADJUST(shock_sen,d) { Thread *t; cell_t c; real del_s; real del_h; real del_u_bar; real aa, bb, cc, dd, ee; real f_shock, shock_sensor; real d_wave; d_wave=0; /* Shock sensor */ thread_loop_c(t,d) { begin_c_loop(c,t) { aa=((C_P(c,t))/C_R(c,t))-(pre_infi/rho_infi); bb=((C_U(c,t)*C_U(c,t))+(C_V(c,t)*C_V(c,t))+(C_W(c,t)*C_W(c,t)))/2; del_h=((gamma/(gamma-1))*aa)+(bb-(u_infi*u_infi/2)); cc=2/((gamma-1)*M_infi*M_infi); dd=pow((C_P(c,t)/pre_infi), ((gamma-1)/gamma))-1; ee=((C_V(c,t)*C_V(c,t))+(C_W(c,t)*C_W(c,t)))/(u_infi*u_infi); del_u_bar=C_U(c,t)-u_infi*(sqrt(1+(2*del_h/u_infi*u_infi)-(cc*dd)-ee)+1); f_shock=((C_U(c,t)*C_P_G(c,t)[0]) + (C_V(c,t)*C_P_G(c,t)[1]) + (C_W(c,t)*C_P_G(c,t)[2]))/(a*(NV_MAG(C_P_G(c,t)))); if(f_shock>=1) { shock_sensor=f_shock; d_wave+=(-(C_R(c,t))*del_u_bar*(C_DUDX(c,t)+C_DVDY(c,t)+C_DWDZ(c,t))); C_UDMI(c,t,1)= shock_sensor; } } end_c_loop(c,t) } printf("The wave drag = %g\n", d_wave); } shivakumar |
|
March 27, 2015, 05:49 |
|
#45 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Not yielding any results (solver crashes/diverges) or not the results you're expecting? Please provide details... we don't have your results on our screens.
|
|
March 27, 2015, 05:56 |
|
#46 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Its not yielding any results and solver is not crashing... When I tried with the execute on demand macro it doesnt and in the contour plots also its giving max and min value zero....
|
|
March 27, 2015, 05:59 |
|
#47 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
So the text "The wave drag = " never shows up in the screen?
|
|
March 27, 2015, 06:03 |
|
#48 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
thank u for the reply.. you're right. Its not showing
|
|
March 27, 2015, 06:04 |
|
#49 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
What if you replace that by the more correct
Code:
Message("The wave drag = %g\n", d_wave); |
|
March 27, 2015, 06:12 |
|
#50 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
||
March 27, 2015, 06:18 |
|
#51 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
First of all: be more exact. You say:
Quote:
But if my guess that it shows zero everywhere is correct: In your code, if you don't have a shock wave (f_shock<1), the UDM is never changed. So this shows that in your problem, f_shock is smaller than 1 everywhere. I don't know if this means that you miscalculated f_shock, or that your problem simply does not have shockwaves. |
||
March 27, 2015, 06:26 |
|
#52 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Sorry I forgot to post that pic earlier....Its transonic case M=0.729.. It has a shock wave..
|
|
March 27, 2015, 06:32 |
|
#53 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
Try to replace the line Code:
if(f_shock>=1) Code:
if(2>=1) |
||
March 27, 2015, 06:47 |
|
#54 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
thank you for the reply. I just replaced the code which you have given and the solution is progressing but the message " The wave drag" is not showing after each iteration...!!!
|
|
March 27, 2015, 06:49 |
|
#55 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Still no change in the contour plot. Its complete red..
|
|
March 27, 2015, 06:54 |
|
#56 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
First of all: be aware that my suggestion was not a suggestion to solve your problem. It was a suggestion to find out more about your problem.
And you say your user defined memory 1 is zero everywhere? That should only be the case when the velocity is zero everywhere, or when the pressure gradient is zero everywhere. Plot them to be sure. And if "The wave drag" is no longer shown, the problem might be that your UDF code is no longer executed. Is it still attached at the right place? Did the compilation give errors that you did not notice? |
|
March 27, 2015, 06:57 |
|
#57 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Finally got error like this
FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. |
|
March 27, 2015, 07:02 |
|
#58 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Ok. I tried earlier adding another if-else statement when it is less than one or zero. but still getting the same.. I observed there are no compilation errors
|
|
March 28, 2015, 22:32 |
|
#59 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The fatal error, "ACCESS_VIOLATION", may suggest that you're trying to access a variable that doesn't exist. I've read that the gradients are not evaluated for the first iteration and only exist from the second iteration onward. You're calling C_P_G from the start of the first iteration (before the solver is called), run the UDF after the first iteration (or set C_P_G to zero/otherwise for the first iteration).
|
|
March 31, 2015, 02:09 |
|
#60 |
Senior Member
Join Date: Mar 2013
Location: B'lr
Posts: 130
Rep Power: 13 |
Thanks for the reply 'e'.. I have set value to zero, its running smoothly.
There are slight modifications which are need to be included in the code. Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |