compiling fails: UDF for extracting mixture fraction data
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" 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 |
#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. |
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 |
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! |
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.
|
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:) |
All times are GMT -4. The time now is 10:22. |