|
[Sponsors] |
June 18, 2015, 11:27 |
Mean vorticity field
|
#1 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Hello,
I am new to UDF scripts and I have tried to make a script using UDF manual, and FLUENT does not complain when I interpret but I don't know if the script is correct. I have a LES simulation and want to make a contour plot of mean vorticity and I don't have any velocity fields from time steps. So I have to make a UDF script in order to get mean vorticity field of velocity fields. The script is as follows #include "udf.h" enum{ VORT }; DEFINE_ON_DEMAND(vorticity_on_demand) { Thread*t; cell_t c; face_t f; Domain *domain; domain = Get_Domain(1); thread_loop_c(t,domain) { begin_c_loop(c,t) { C_UDSI(c,t,VORT) = (C_DWDY(c,t)-C_DVDY(c,t)) + (C_DWDX(c,t)-C_DUDZ(c,t)) + (C_DVDX(c,t)-C_DWDY(c,t)); } end_c_loop(c,t) } } When I interpret, I can't see the vorticity in the contour list and don't know how to make it. Last edited by Martin1; June 18, 2015 at 15:54. |
|
June 19, 2015, 04:35 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
First of all: you want to put the data in a User Defined Memory (UDM), not a User Defined Scalar.
So: 1. Change the code (replace UDSI by UDMI). 2. Add a user defined memory. (In the menu Define->User Defined->Memory) 3. Run your udf (Define->User Defined->Execute on Demand) 4. Plot User Defined Memory 1. And please don't open four threads for the same problem, that does not really help... |
|
June 19, 2015, 04:54 |
|
#3 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Thank you for your reply. What about the mean value of vorticity? Right now I am integrating over time but I don't have a velocity field of time steps. And when I run without t it complains. Also is define_on_demand appropriate to use
|
|
June 19, 2015, 05:09 |
|
#4 | ||||
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
Quote:
Quote:
Quote:
|
|||||
June 19, 2015, 05:16 |
|
#5 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
I have run my simulations in LES but I only have instantaneous values of vorticity, I want average values instead.
regarding t, if it is not time, then I don't understand what it is, it says that it is pointer threads, but what does that mean? Also right now I loop over cells, do I have to loop over faces as well? Sorry for not being clear, I am very new to this. |
|
June 19, 2015, 05:24 |
|
#6 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Maybe there is an easier way to show the average value of vorticity but I don't know what.
|
|
June 19, 2015, 05:25 |
|
#7 | |||
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
Quote:
Quote:
|
||||
June 19, 2015, 05:29 |
|
#8 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Ok that explained a lot, then cells are definitely appropriate.
Then I only have the averaging left, but is there different macros to use for different averaging? Am i not averaging now? |
|
June 19, 2015, 05:30 |
|
#9 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Thank you so much pakk for your time, it cleared things up
|
|
June 19, 2015, 05:32 |
|
#10 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
I think I need surface averaging
|
|
June 19, 2015, 05:38 |
|
#11 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Or I am not sure, I mean I just want the average value, mean value. I don't know which types it exist or which one to use.
|
|
June 19, 2015, 05:49 |
|
#12 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Do you know what the difference is between time-averaged, volume-averaged and LES-averaged?
|
|
June 19, 2015, 05:52 |
|
#13 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Yes I know that and LES-averaged is what I want.
|
|
June 19, 2015, 06:09 |
|
#14 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
OK, good that you know it now.
In that case, probably, you don't need to do anything special. As far as I know, if you use LES in fluent, your 'normal' flow properties are actually the 'LES-averaged' flow properties. (I have never done LES in Fluent, so don't take my word for it, but search the Manual to be sure.) Instead of writing this UDF, you could have just plotted the contours of "vorticity magnitude". Actually, this is better, because what you are calculating in the UDF is actually the divergence of the vorticity, (which should always be zero), because you entered the equation wrong, I had not noticed that before. |
|
June 19, 2015, 06:13 |
|
#15 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
No the vorticity magnitude in LES is not averaged, its instantaneous.
|
|
June 19, 2015, 06:14 |
|
#16 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
How is that equation wrong?
|
|
June 19, 2015, 06:20 |
|
#17 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
I believe I already said that. You wrote the divergence of the vorticity, while you want the magnitude. |
||
June 19, 2015, 06:24 |
|
#18 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
Yes you are probably right. But the vorticity magnitude shows instantaneous values and that is not what I want. I want to compare the LES solutions to RANS solutions, so I can't compare RANS against instantaneous solutions
Ok How do I get the magnitude? |
|
June 19, 2015, 06:27 |
|
#19 |
Member
Martin
Join Date: May 2015
Posts: 30
Rep Power: 11 |
I don't see how that is divergence
|
|
June 19, 2015, 06:37 |
|
#20 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
You are correct: it is not divergence, I was wrong. As far as I know, the thing you wrote down does not have a proper name. Why don't you just write down what vorticity is, and what the magnitude of vorticity therefore is? That should make it immediately clear. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
write a UDF to give a velocity boundary condition at an interior face | Tharanga | Fluent UDF and Scheme Programming | 19 | August 5, 2018 05:29 |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
fluent udf problem: write specific data for every iteration in a file. | nnvoro | Fluent UDF and Scheme Programming | 1 | May 27, 2013 16:26 |
How to write UDF to achieve phase chang | dunga82 | Fluent UDF and Scheme Programming | 0 | May 6, 2013 09:50 |
how to write a 3D linear temperature of UDF | venus | FLUENT | 1 | October 28, 2008 03:46 |