CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problem in interpreting and compiling C_VOF udf

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By obscureed
  • 1 Post By obscureed

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 2, 2018, 00:55
Default Problem in interpreting and compiling C_VOF udf
  #1
New Member
 
Diksha
Join Date: Mar 2017
Posts: 11
Rep Power: 9
Diksha is on a distinguished road
Dear All,

I am trying to initialise a liquid film using udf. However, it is not working. Please find the udf below:

/************************************************** *********************
UDF for initializing a thin layer of fluid at inlet section of tube
************************************************** **********************/
#include "udf.h"
DEFINE_INIT(liquid_layer,domain)
{
cell_t c; /* c identifies a particular cell within the domain */
Thread *t; /* t is a pointer to thread on which this condition is to be applied */
real xc[ND_ND]; /* the array xc holds the position of each cell */

/* looping over all cell threads in the given domain */
thread_loop_c(t,domain)
{
/* looping over all cells in all cell threads in the domain */
begin_c_loop_all(c,t)
{
C_CENTROID(xc,c,t); /* finds the coordinate position of the cell c and stores the coordinates in the xc array */
if ((xc[0] <= 0.225) && (xc[1] <= -0.00413972))
C_VOF(c,t) = 0;
}
end_c_loop_all(c,t)
}
}


1. When I tried to interprete it, I get the following error:

Error: E:\\Users\\user1\\Desktop\\Condensation_31Jan2018\ \liquidlayer.c: line 24: label "store_vof_norm" not found (pc=155).

2. I read that this error can be eliminated by compiling the udf. So I tried compiling it. While loading the libudf, the following is displayed:

Copied E:\Users\user1\Desktop\Condensation_31Jan2018/E:\Users\user1\Desktop\Condensation_31Jan2018\liqu idlayer.c to libudf\src
Creating user_nt.udf file for 3ddp_host ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v160\fluent"\fluent16.0.0\sr c\udf\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")# Generating ud_io1.h
Creating user_nt.udf file for 3ddp_node ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v160\fluent"\fluent16.0.0\sr c\udf\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")# Generating ud_io1.h

Done.

I guess there is no error in compiling step.

However, when i load the udf, i get error:

Opening library "E:\Users\user1\Desktop\Condensation_31Jan2018\lib udf"...
Error at host: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.

E:\Users\user1\Desktop\Condensation_31Jan2018\libu df\win64\3ddp_host\libudf.dll

Error at Node 0: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.


Error at Node 1: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.


Error at Node 2: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.


Error at Node 3: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.

E:\Users\user1\Desktop\Condensation_31Jan2018\libu df\win64\3ddp_node\libudf.dll
E:\Users\user1\Desktop\Condensation_31Jan2018\libu df\win64\3ddp_node\libudf.dll
E:\Users\user1\Desktop\Condensation_31Jan2018\libu df\win64\3ddp_node\libudf.dll
E:\Users\user1\Desktop\Condensation_31Jan2018\libu df\win64\3ddp_node\libudf.dll

Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).

The system cannot find the file specified.

E:\Users\user1\Desktop\Condensation_31Jan2018\libu df\win64\3ddp_host\libudf.dll
Error Object: #f



Can anyone please help?

3. Is it possible to fix volume fraction in only some cells all throughout computation, either by udf or any other way?

UPDATE: when i replaced C_VOF with C_T, the udf works fine.

Thank you for helping me..

Last edited by Diksha; February 2, 2018 at 05:11.
Diksha is offline   Reply With Quote

Old   February 2, 2018, 01:26
Default
  #2
New Member
 
Melvin Abraham
Join Date: Jan 2018
Location: India
Posts: 4
Rep Power: 8
Melvo is on a distinguished road
Am a rookie and i had a similiar problem when using my 6dof UDF. I changed the processing type to parallel and just interpreted it , didn't compile(You just need to do one of them) and it worked.

I would also suggest double checking the syntax as just a replacement of a "(" with "[" can ruin the entire code.

Hope this helps.
Melvo is offline   Reply With Quote

Old   February 2, 2018, 04:55
Default
  #3
New Member
 
Diksha
Join Date: Mar 2017
Posts: 11
Rep Power: 9
Diksha is on a distinguished road
Quote:
Originally Posted by Melvo View Post
Am a rookie and i had a similiar problem when using my 6dof UDF. I changed the processing type to parallel and just interpreted it , didn't compile(You just need to do one of them) and it worked.

I would also suggest double checking the syntax as just a replacement of a "(" with "[" can ruin the entire code.

Hope this helps.
Hi Melvin,

Thank you for helping. I interpreted it using parallel itself, but did not work. Do you have any idea why C_T works and not C_VOF?
Diksha is offline   Reply With Quote

Old   February 5, 2018, 06:59
Default
  #4
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi Diksha,

I am confused by the "libudf not found" error during loading, because (as you say) there seemed to be no problem in compiling. Also, it sounds like you can get the UDF to compile and load when you use C_T instead of C_VOF. This is very confusing, and I have no clear recommendation for how to clarify this. Maybe ignore it and it will go away? (Be careful, though, that you actually get a new libudf when you re-compile. Sometimes, when there are compilation problems, the old libudf stays in place. One failsafe measure is to unload the libudf and delete the entire libudf directory. (Make sure you have the source code safely in the working directory, of course.)

I would not recommend using interpreted UDFs except as a last resort.

But the fundamental question: why does C_VOF not work, when C_T does work? This is clear: C_VOF(c,st) must refer to a subthread in a multiphase model, whereas C_T(c,t) refers to the superthread. (Actually, C_VOF might need to be a secondary-phase subthread.) Your loop "thread_loop_c(t,domain)" gives you the superthread. Look in the Customization Manual for THREAD_SUB_THREAD or DOMAIN_SUB_DOMAIN. I think one way forward (assuming you have only two VOF phases: one primary and one secondary) is to declare another thread pointer:
Thread *st;
and then inside the "thread_loop_c" loop:
st = THREAD_SUB_THREAD(t,1); /* not safe for solid zones? */
...
C_VOF(c,st) = ...;

Please try this and tell us how it goes.
Ed
anuarun likes this.
obscureed is offline   Reply With Quote

Old   February 5, 2018, 07:12
Default
  #5
New Member
 
Diksha
Join Date: Mar 2017
Posts: 11
Rep Power: 9
Diksha is on a distinguished road
Hello Ed,

Thank you for your reply.

I managed to get my udf running. I interpreted it in Ansys Fluent 18 and it worked. No need to compile.

And you are right, I edited the previous udf to cater for sub-domains for the secondary phase.

Thanks
Diksha is offline   Reply With Quote

Old   February 5, 2018, 07:17
Default
  #6
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
One really useful piece of advice for UDFs is to be paranoid when you try to access solution variables. I wish the official examples used a more robust style.

For example, if you are about to use C_T(c,ct), then check that it is actually available, with something like this:
Code:
  if(NNULLP(THREAD_STORAGE(ct,SV_T))) {
    /* safe to use C_T(ct,*) */
    begin_c_loop(c,ct) {
      ... something involving C_T(c,ct) ...
    } end_c_loop(c,ct)
  }else{
    Message0("Problem with C_T not allocated for thread %d.\n",THREAD_ID(ct));
  }
You can find some obscure errors this way. So, for example, many variables are not available in solid zones. Sometimes, some UDFs can be called before all the variables have been allocated!

For different variables, you need to find the equivalent of SV_T, perhaps by experimentation, or (better) by hunting through the standard header files. (Look for the definition of C_T etc.) There you will find SV_UDM_I for User-Defined Memories. There are some confusing possibilities for VOF: probably SV_VOF, but maybe SV_VOF_NORM -- probably for a different model setting. But then, when you are being paranoid as above, you will get a comprehensible error message if you get it wrong. If you are not paranoid, you may need to recover from, and then investigate, a Segmentation Violation.
anuarun likes this.
obscureed is offline   Reply With Quote

Old   February 5, 2018, 07:25
Default
  #7
New Member
 
Diksha
Join Date: Mar 2017
Posts: 11
Rep Power: 9
Diksha is on a distinguished road
Indeed very useful advice. Thanks..
Diksha is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF neither compiling nor interpreting. shan12 Fluent UDF and Scheme Programming 0 August 14, 2016 05:05
UDF compiling and Interpreting error aduramolasode95 Fluent UDF and Scheme Programming 3 April 19, 2016 21:09
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 00:53
compiling problem of a mass transfer udf majid_kamyab FLUENT 9 October 15, 2014 10:18
something wrong when compiling udf, however the code is correct when interpreting richard ben Fluent UDF and Scheme Programming 7 May 11, 2013 07:36


All times are GMT -4. The time now is 00:22.