read volume fraction for a coordinate
Dear All,
I need to write a UDF code that reports volume fraction value for a coordinate ( or could be a node ) within a two-phase flow problem at a certain time, I have the following code, I have two issues: 1) I don't know how to make the UDF print the result at the console, is " printf" the correct way to request the UDF to print to the console? 2) Is this the right way to set up the time? How can I request to report the volume fraction at end of each time step? #include "udf.h" DEFINE_ON_DEAMND(volume_fraction) { real current_time; current_time=CURRENT_TIME; real volume_fraction; Domain *mixture_domain; mixture_domain=Get_Domain(1); cell_t c; thread *t; thread **pt; volume_fraction=c_VOF(c,pt[1]); } printf("\n volume_fraction % g",volume_fraction) Truly appreciate any advice. |
you may try this code, COMPILE IT, allocate 2 user defined variables in fluent GUI so you can plot vol_frac distribution along the domain
Code:
#include "udf.h" |
also you may try something like this, to write to file
Code:
#include "udf.h" |
Thanks, AlexanderZ for your help, this is very helpful.
Would you also know how this code can be used to print the volume fraction in only one certain point (with given coordinate values of x,y,z ). I looked into the C_CETROID and Grid variables but couldn't make it to specify a point. Here is how I tried to specify a point : real xc[ND_ND]; C_CENTROID(xc,cell,cell_thread); I think I need to use an "if" statement here to specify the point location? Thanks Henry |
last code will look like this:
Code:
#include "udf.h" |
Very Helpful Alexander Z, thanks for your support.
|
AlexanderZ
I am working on a 2 phase flow model and following all steps to generate the air fraction which is a bubble inside a channel. Then patch, initialize, and check contours for air phase, fluent doesn't show the air bubble. I am not sure what I do wrong but I have done this before and I did not have a problem with this part. Please let me know if you can help, this is very frustrating. Thanks Hanry |
initialize first, than patch, make sure you are not initializing case after patching it
|
AlexanderZ,
I truly appreciate your help, one small mistake made me redo the model many times.:D Thanks again. |
UDF compiling Error
Dear AlexanderZ,
It is been a while I see this error and have been looking to fix it, some says it is a visual studio issue, I would like to ask if you know how to make the files compiled, I get this error for compiling, the interpreting has its own issues, so it would be great if I could compile the files instead, but here it goes : The error in windows : The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64). |
Code:
The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64). compile UDF file |
Does that mean my code has issues?
I have tried to compile simple files, still get the same error. Thanks Hanry |
What do you suggest I should do ?
|
This is not the error that you see when you try to compile ;this is the error when you try to load. (read it!)
Look at the error(s) when you compile. |
Hi PAKK,
I agree, it is the error when loading, but does that mean the code has an issue that its why it is not compiling? Thanks Hanry |
It literally says that the code is not compiled. It does not say the reason, that's why I tell you to look what happens when you try to compile. There you should see the reason.
|
All times are GMT -4. The time now is 23:30. |