-
-
November 2, 2018 at 5:12 pm
jmt714
SubscriberHi!
I am trying to compile the following UDF:
#include "udf.h" int last_ts = -1; DEFINE_GRID_MOTION(mitral_movement,domain,dt,time,dtime) { Thread *tf = DT_THREAD(dt); /* zone */ face_t f; /* faces*/ Node *v; real NV_VEC(axis), NV_VEC(dx); real NV_VEC(origin); double displ[105] = {-2.31110880000000e-05, -5.78353680747664e-05, -5.87595468992113e-05, -6.46174026334990e-05, -0.000103825859674563, -0.000217079075525136, -0.000256401435192825, -0.000275866756577904, -0.000358596163999863, -0.000308366495539297, -0.000319002682794429, -0.000349618421760680, -0.000349129134802423, -0.000300145791513366, -0.000314688030776492, -0.000344275931036111, -0.000314687932121784, -0.000314656644654236, -0.000314656753976871, -0.000322590075194713, -0.000308334554732122, -0.000326125198519708, -0.000307366719488318, -0.000308929159594051, -0.000329482076917630, -0.000338576347580837, -0.000299061755676187, -0.000300230079537407, -0.000253449986499882, -0.000198312769317913, -0.000180340556903472, -0.000112397338561133, -8.40003618339527e-05, -7.77792472565544e-05, -7.88121189048852e-05, -0.000104891305927779, -0.000119703840000000, -0.000104687803423177, -5.93107999770712e-05, -2.91863885997525e-05, 1.21481359999986e-05, 7.89120094802929e-05, 0.000151316152702385, 0.000284436240311541, 0.000359121893179136, 0.000314656460656127, 0.000299841953976870, 0.000251261035685624, 0.000255425054236490, 0.000289177263771537, 0.000318807335756432, 0.000315266920243571, 0.000380260120398392, 0.000421821689890560, 0.000590536034702553, 0.000763826675008497, 0.000607407407999999, 0.000575424127331443, 0.000466356689754228, 0.000179550340995987, 4.74094579183375e-05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.00247079537410e-05, 3.49618091102193e-05, 9.08748293603945e-06, 0, 0, 4.91856954448908e-05, 0.000100144131885768, 0.000161188712669342, 0.000235867164603402, 0.000330651455396601, 0.000412044074505546, 0.000294341911446777, 0.000247095542047674, 0.000125480123400247, 1.43715885997522e-05, -4.85880332094179e-05, -0.000104893294790583, -0.000159999839999999, -0.000138667891727386, -7.52536644170562e-05, -9.24489918555579e-05, -5.52571190150475e-05, -6.97790502339493e-05, -6.87452874203444e-05, -0.000101185005521489, 0.000796299778190831, 0, 0, 0, 0}; int n; int curr_ts; curr_ts = N_TIME; /* set deforming flag on adjacent cell zone */ SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf)); /*NV_S(omega, =, 0.0); */ NV_D(axis, =, 1.0, 0.0, 0.0); NV_D(origin, =, 0.0, 0.0, 0.0); begin_f_loop(f,tf) { f_node_loop(f,tf,n) { v = F_NODE(f,tf,n); /*function that pickes up the node */ /* update node if x position is greater than 0.02 and that the current node has not been previously visited when looping through previous faces */ if (last_ts != curr_ts && NODE_POS_NEED_UPDATE (v)) { /* indicate that node position has been update so that it’s not updated more than once */ last_ts = curr_ts; NODE_POS_UPDATED(v); NV_V_VS(NODE_COORD(v),=, NODE_COORD(v),+, axis,*,displ[last_ts]); } } } end_f_loop(f,tf); }
And I get this error: LINK : fatal error LNK1104: cannot open file 'libudf.dll'.
I don't know if it is because of my udf function that is wrong coded, or because it lacks some compiler.
Thank you very much in advance! -
November 5, 2018 at 11:31 am
Rob
Ansys EmployeeWhat else did Fluent output when the UDF failed to compile? Was there anything about nmake? Have you got (and linked) a compiler on your computer?
-
November 5, 2018 at 12:24 pm
DrAmine
Ansys EmployeeTo add to rwoolhou message: check if you have already an UDF loaded into your case!
-
August 21, 2020 at 11:15 am
CFDGer
SubscriberI actually have the same question regarding a UDF for my specific heat cp(T).
I receive a similar error message:
LINK : fatal error LNK1104: cannot open file "kernel123-lib".
I don't receive the warning regarding the nmake.
I use FLUENT 2020R1 and the current Microsoft Visual Studio Community.
I have read something about some Environment Variables but I'm not sure what to do exactly.
Thanks
-
August 21, 2020 at 11:35 am
DrAmine
Ansys EmployeeCan you compile this one:
#include "udf.h"
DEFINE_ON_DEMAND(Hello)
{
Message0("nHello World!n");
}
-
August 21, 2020 at 12:06 pm
CFDGer
SubscriberThanks for your reply!
No, unfortunately this doesn't work aswell.
I already checked the Ansys Customer Portal and the case numbers
#2041677
and
#2061708
But I couldn't find any of the mentioned environment variables on my system.
What does this all mean now?
-
August 21, 2020 at 12:08 pm
DrAmine
Ansys EmployeeWhat about launching from the x64-86 VS command prompt as indicated in the solutions?
-
August 21, 2020 at 12:19 pm
CFDGer
SubscriberI don't know what to enter in that command prompt. I mean, which folder or file am I supposed to cd to? The FLUENT .exe?
-
August 21, 2020 at 12:21 pm
DrAmine
Ansys EmployeeCheck #2059458
-
August 21, 2020 at 1:02 pm
CFDGer
SubscriberThat works. I am now able to Build and Load the Compiled function, thanks!
But I can't open FLUENT this way all the time. Is this problem fixed now that I have done it this way once or do i always have to start FLUENT like this if I want to implement one or more UDFs?
-
August 21, 2020 at 1:29 pm
CFDGer
SubscriberWell, now that I tried that exact procedure a second time it says "nmake" can't be found.
-
August 21, 2020 at 2:40 pm
Rob
Ansys EmployeeIf you can update to R2 there's an inbuilt compiler: try that.
-
August 21, 2020 at 2:40 pm
DrAmine
Ansys EmployeeYes the best solution.
-
August 24, 2020 at 8:16 pm
anshs
SubscriberHello Dr. Amine can you help me with a mass transfer udf problem :
My UDF for mass transfer is not running , the code stops at "Message("nn %f," , NV_MAG(C_VOF_G(cell,w)) );"
UDF:
DEFINE_MASS_TRANSFER(interface_transfer, cell, thread, from_index, from_species_index, to_index, to_species_index)
{
real m_lg;
Thread *w = THREAD_SUB_THREAD(thread, from_index);
Thread *o = THREAD_SUB_THREAD(thread, to_index);
m_lg = 0.0;
if ( ( C_VOF(cell,w)*C_VOF(cell,o) > 0.1 ) && (C_VOF(cell,w) + C_VOF(cell,o) >0.75) )
{
Message("nn %f," , C_YI(cell, w, 0));
Message("nn %f," , ( C_YI(cell, w, 0) - 0.00005 ));
Message("nn %f," , NV_MAG(C_VOF_G(cell,w)) );
m_lg = 0.4 * (NV_MAG(C_VOF_G(cell,w)))* ( C_YI(cell, w, 0) - 0.00005 ) ;
}
else m_lg = 0.0 ;
return (m_lg);
}
-
August 24, 2020 at 10:05 pm
Karthik R
AdministratorHello Please create a new post for each new discussion for better visibility on your issue.
If you add a message line to print M_lg, what you do get?
Thanks.
Karthik
-
August 25, 2020 at 6:42 am
CFDGer
SubscriberHi Amine and Rob, ok I will try R2. Thanks
-
August 25, 2020 at 6:45 am
DrAmine
Ansys EmployeeI will close this thread. please try R2 and report on your experience with the inbuilt Slang compiler ;)
-
- You must be logged in to reply to this topic.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
2564
-
2080
-
1293
-
1106
-
459
© 2023 Copyright ANSYS, Inc. All rights reserved.