|
[Sponsors] |
compiling fails: UDF for extracting mixture fraction data |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 17, 2015, 12:21 |
compiling fails: UDF for extracting mixture fraction data
|
#1 |
New Member
Torsten
Join Date: Jun 2015
Posts: 4
Rep Power: 11 |
Hello everyone,
I am working on implementing a UDF to postprocess my combustion data. I want to extract the mixture fraction data in combination with the corresponding z-coordinate of my oven (rotary kiln). I think I have a script that would give me my data, but I am having trouble compiling it into fluent. I do have Microsoft Visual Studios installed... Heres my Code: Code:
#include "udf.h" #include "sg_mem.h" DEFINE_ON_DEMAND(mixture_fraction) { Domain *d; cell_t c; Thread *t; d = Get_Domain(1); float x[3]; thread_loop_c(t,d) /*loop over all cell-threads in the domain*/ { begin_c_loop(c,t) /*loop over all cells in the cell-threads*/ { if (C_FMEAN(c,t) >= 0.058) /*stoiciometric criterion*/ { C_CENTROID(x,c,t); C_UDMI(c,t,0) = C_FMEAN(c,t); C_UDMI(c,t,1) = x[2]; /*coordiantes of checked cells saved*/ } } end_c_loop(c,t) } } error C2143 mistake in syntax: ";" is missing in front of "typ" error C2065 "x": not declared error C2109: index requires an array or a pointer Sadly I cant even find my syntax mistake here... Its my first UDF, I really do not have an eye for this, yet. :/ Thanks for your help! Nekro |
|
June 17, 2015, 12:52 |
|
#2 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
#include "udf.h"
#include "sg_mem.h" DEFINE_ON_DEMAND(mixture_fraction) { Domain *d; cell_t c; Thread *t; real x[3]; d = Get_Domain(1); thread_loop_c(t,d) /*loop over all cell-threads in the domain*/ { begin_c_loop(c,t) /*loop over all cells in the cell-threads*/ { if (C_FMEAN(c,t) >= 0.058) /*stoiciometric criterion*/ { C_CENTROID(x,c,t); C_UDMI(c,t,0) = C_FMEAN(c,t); C_UDMI(c,t,1) = x[2]; /*coordiantes of checked cells saved*/ } } end_c_loop(c,t) } } It works now: You must declare your variables before starting your code. |
|
June 18, 2015, 07:46 |
|
#3 |
New Member
Torsten
Join Date: Jun 2015
Posts: 4
Rep Power: 11 |
Hello upeksa, thanks for your answer.
I tried compiling the script with your change but it still doesnt work somehow... In fact I am getting an additional error: "C2275: "real": unvalid usage of this typ as an expression I thought if I say "float" that I do declare my variable right there... Is that incorrect? Do you have more suggestions? Thanks Nekro |
|
June 20, 2015, 07:56 |
|
#4 |
New Member
Torsten
Join Date: Jun 2015
Posts: 4
Rep Power: 11 |
Hm so nobody here has seen a similar problem?:/
I feel like it almost must be something with the compiling problem, but I am not experienced enough to know what to change. The UDF itself is pretty simple and I keep starring at it without knowing what else could be wrong concerning the syntax.... I m glad for any hint! |
|
June 22, 2015, 05:03 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You can use float, but make sure you define it before you assign something to d. The important change that upeksa made was not changing "float" to "real", but moving the line up.
|
|
June 22, 2015, 08:37 |
|
#6 |
New Member
Torsten
Join Date: Jun 2015
Posts: 4
Rep Power: 11 |
Ohhhh wow.
Thank you so much pakk that you explained this nooby mistake to me = ) Thats awesome - it reads in the file! You just made my day! Thank you |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fluent udf, saving data in udf | mohsen zendehbad | Fluent UDF and Scheme Programming | 15 | June 14, 2017 00:23 |
UDF DPM_BC with F_UDMI not storing data | balki | Fluent UDF and Scheme Programming | 3 | June 6, 2016 23:10 |
multiphase turbulance case floating error | harsha_kulkarni | OpenFOAM Running, Solving & CFD | 3 | February 18, 2016 06:06 |
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem | Attesz | OpenFOAM Meshing & Mesh Conversion | 12 | May 2, 2013 11:52 |
mixture fraction | Sheng Chen | Main CFD Forum | 0 | October 6, 2004 02:33 |