Jump to content
Duc_Hoang

Compile the UDF

Recommended Posts

Hello guys,

I have got a trouble while using AcuSolve cmd prompt to compile the UDF file.

 

To be more precise, i am doing an AcuSolve tutorial ACU-4002: sloshing of water in a tank.

There was a step:

image.thumb.png.70feb086e95f01235ef5c1539bb0f290.png

 

I have follow the intructions but the cmd prompt have an error like below:

image.png.b692c9d4f9c3a94a6adb9c3eee109640.png

while:

"C:\Users\ducho\Desktop\multiphase" is my working directory for this case and it has already contained "gravity.c" file (copied from AcuSolve tutorials-model files)

 

I also searched for more help on AcuSolve user-define function manunal but didnt found.

 

So can you guys help me out?

appreciate any help. Thank you!

 

Share this post


Link to post
Share on other sites

AcuSolve installation does not have a C/C++ Compiler. So you would need to install a compiler  seprately and then link the compiler to AcuSolve.

 

Windows system would probably work well with Microsoft Visual Studio.

Linux systems generally have GCC preinstalled.

Duc_Hoang likes this

Share this post


Link to post
Share on other sites

Try just typing

 

acuMakeDll

 

and return, without adding "-src gravity.c" - and see which errors are returned.  As mentioned, you do need to have a compiler installed.  It seems Visual Studio Community is the latest free version from Microsoft.

Duc_Hoang and whj like this

Share this post


Link to post
Share on other sites
On 2/11/2019 at 11:12 PM, acupro said:

Try just typing

 

acuMakeDll

 

and return, without adding "-src gravity.c" - and see which errors are returned.  As mentioned, you do need to have a compiler installed.  It seems Visual Studio Community is the latest free version from Microsoft.

 

On 2/11/2019 at 9:31 PM, ydigit said:

AcuSolve installation does not have a C/C++ Compiler. So you would need to install a compiler  seprately and then link the compiler to AcuSolve.

 

Windows system would probably work well with Microsoft Visual Studio.

Linux systems generally have GCC preinstalled.

Thank you guys,

I have found the issue.

My computer didn't have any C/C++ compiler.

 

Altair university also has a post about this problem.

 

Share to others who have faced problem like me : https://altairuniversity.com/11523-acusolve-search-for-installed-compiler-tips-tricks/

whj and ydigit like this

Share this post


Link to post
Share on other sites

Hello:

I have encountered some problems in learning acusolve acu-4002, and I have been unable to run gravity.c file. My compiler software has been installed (VS2013), and the environment configuration has been completed according to the relevant information (Figure 1). However, the following problem was encountered in operation (Figure 2). The gravity. obj file cannot be found, nor can the. Dll file be generated.

 

 

I also tried to run gravity. C program separately in VS2013, but I also found many errors. (Fig. 3)

1. error LNK2019: Unparsable external symbol _udfCheckNumUsrVals, which is referenced in function _usrGravity

2. error LNK1120: Three unresolved external commands

3. IntelliSense: Undefined identifier "Integer"

4. IntelliSense: Undefined identifier "String"

5. IntelliSense: Undefined identifier "Void"

6. IntelliSense: Undefined identifier "Real"

I hope you can help me. Thank you very much.

1.jpg

2.jpg

3.png

5.png

00F165EB%409E4D7633.44C2D15C.jpg_recompress.jpg

Share this post


Link to post
Share on other sites

You don't post the image of the compile attempt where it actually shows errors.  Please use the AcuSolve Command Prompt and go into the directory where the gravity.c user function resides.  Then issue the command, maybe first without any options - just:

 

acuMakeDll

 

and see what happens.

Share this post


Link to post
Share on other sites
On 2/11/2019 at 2:52 PM, duc-hoang said:

Hello guys,

I have got a trouble while using AcuSolve cmd prompt to compile the UDF file.

 

To be more precise, i am doing an AcuSolve tutorial ACU-4002: sloshing of water in a tank.

There was a step:

image.thumb.png.70feb086e95f01235ef5c1539bb0f290.png

 

I have follow the intructions but the cmd prompt have an error like below:

image.png.b692c9d4f9c3a94a6adb9c3eee109640.png

while:

"C:\Users\ducho\Desktop\multiphase" is my working directory for this case and it has already contained "gravity.c" file (copied from AcuSolve tutorials-model files)

 

I also searched for more help on AcuSolve user-define function manunal but didnt found.

 

So can you guys help me out?

appreciate any help. Thank you!

 

Hello,
"C: Users ducho Desktop multiphase" Is this your working file?
How is this set up? When I open my acusolve CMD prompt, default d: Document, do you know how to set it to the current working folder?

 

Share this post


Link to post
Share on other sites
On 5/9/2019 at 1:00 AM, acupro said:

You don't post the image of the compile attempt where it actually shows errors.  Please use the AcuSolve Command Prompt and go into the directory where the gravity.c user function resides.  Then issue the command, maybe first without any options - just:

 

acuMakeDll

 

and see what happens.

Thank you very much

I have a few questions to ask you.

Question 1:

Interface for starting acusolve Cmd prompt

Default d:\ Documents>

Is that right?

If not, how do I modify the path?

Do I need to set the path of the model folder?

图片1.png

Share this post


Link to post
Share on other sites
On 5/9/2019 at 1:00 AM, acupro said:

You don't post the image of the compile attempt where it actually shows errors.  Please use the AcuSolve Command Prompt and go into the directory where the gravity.c user function resides.  Then issue the command, maybe first without any options - just:

 

acuMakeDll

 

and see what happens.

Question 2

Enter only acuMakeDll to display the following information

图片2.png

Share this post


Link to post
Share on other sites
On 5/9/2019 at 1:00 AM, acupro said:

You don't post the image of the compile attempt where it actually shows errors.  Please use the AcuSolve Command Prompt and go into the directory where the gravity.c user function resides.  Then issue the command, maybe first without any options - just:

 

acuMakeDll

 

and see what happens.

Question 3

Header files: acusim.h and udf.h

Source file: gravity.c

Running in VS2013, the following errors occurred:

Error LNK2019: Unparsable external symbol udfGetUsrVals, which is quoted in the function usrGravity as D: Documents ACU4002_Sloshing Tank Console Application 3 Console Application 3 Console Application 3 y. obj

Error 4 LNK1120: Three unresolved external commands D: Documents ACU4002_Sloshing Tank Console Application 3 x64 Debug Console Application 3.dll

After searching for information on the Internet, I found that some people said that the reason for this problem was the lack of library files (.lib/.dll).

I hope you can help me. Thank you very much.:D

图片3.png

Share this post


Link to post
Share on other sites

You need to go into the directory where the C code user-function is on your machine.

 

The compiler itself as you've shown in the Window above will not be aware of the libraries in the AcuSolve installation.  But when you are in the AcuSolve Command Prompt, the appropriate paths are set (PATH, LD_LIBRARY_PATH, etc), and the necessary libraries are available to acuMakeDll.

whj likes this

Share this post


Link to post
Share on other sites
7 hours ago, acupro said:

You need to go into the directory where the C code user-function is on your machine.

 

The compiler itself as you've shown in the Window above will not be aware of the libraries in the AcuSolve installation.  But when you are in the AcuSolve Command Prompt, the appropriate paths are set (PATH, LD_LIBRARY_PATH, etc), and the necessary libraries are available to acuMakeDll.

Thank you very much, but I still don't know what to do.
What commands do I need to enter before I can enter the directory where the user functions in C code are located?

What libraries are necessary for ACUMAKEDLL to use? I found libabd. lib, libcci. lib, libeco. lib, libfrm. lib only in the installation directory of acusolve. But he doesn't seem to be what acuMakeDll needs.

I attach the relevant library files, header files and C programs that may be needed in the running of the program.

In udf.h file, only some functions are declared, but the program how these functions work is not given. But I can't find the relevant documents.

I hope you can help me see where this problem appears.

 

ACU4002_SloshingTank.zip udf.h libfrm.lib libeco.lib libcci.lib libadb.lib gravity.c acusim.h

Share this post


Link to post
Share on other sites
8 hours ago, acupro said:

You need to go into the directory where the C code user-function is on your machine.

 

The compiler itself as you've shown in the Window above will not be aware of the libraries in the AcuSolve installation.  But when you are in the AcuSolve Command Prompt, the appropriate paths are set (PATH, LD_LIBRARY_PATH, etc), and the necessary libraries are available to acuMakeDll.

1846743993_TIM20190511112145.jpg.d895368ceda9f531b3b69178b3828333.jpg

 

8 hours ago, acupro said:

You need to go into the directory where the C code user-function is on your machine.

 

The compiler itself as you've shown in the Window above will not be aware of the libraries in the AcuSolve installation.  But when you are in the AcuSolve Command Prompt, the appropriate paths are set (PATH, LD_LIBRARY_PATH, etc), and the necessary libraries are available to acuMakeDll.

I've just solved the problem of how to set up a working directory, but I'm still prompted that the gravity. obj file can't be found in the working directory.
But the display shows that libusr.dll has been created

Share this post


Link to post
Share on other sites
On 5/13/2019 at 11:46 PM, acupro said:

Looks like you should be good to go, since the dll was created.

Thanks for your help

I recently used UDF to define motion, and I found a program for rotating translational motion in the official help document, but when I ran it, it made some errors, showing grid divergence, but I've increased the number of grids near objects, and it's still not getting better.
Please help me again. Thank you very much.

usrRotTransMmo.c

Share this post


Link to post
Share on other sites
On 5/13/2019 at 11:46 PM, acupro said:

Looks like you should be good to go, since the dll was created.

This is the error that is prompted during the exercise.

image.png.83c1899934ff7e689d418958839da930.png

Share this post


Link to post
Share on other sites


I have attached some screenshots which may help for reference.

Set mesh-motion

 

image.png.d191b7707ea534d6bca35d4549bdafe3.png

 

Setting grid motion on the surface of moving object

image.png.849f2b0163b69cde49eab626b9428b91.png

 

 

Share this post


Link to post
Share on other sites

                      Severe mesh distortion; must reduce time increment
acuSolve:     Max error ref.  coord. = 4.804283e-004 -6.017617e-005 -1.802330e-005
acuSolve:     Max error curr. coord. = 4.804267e-004 -6.000000e-005 -1.802330e-005
acuSolve:      Worst elem. has nodes = 398 7450 7451 11222
acuSolve:     Severe mesh distortion; mesh not fully updated

image.png.804a9e82d3016b1fbb7efa36207afe48.png

Share this post


Link to post
Share on other sites

Hello Duc,

 

I'm unable to access tutorial ACU-4002: Sloshing water in a tank. I'm very interested in the topic, I think my problem is that I'm using version 2017 and I'm missing documentation updates. Is there any possibility that you could share this with me?

 

Kind regards.

Share this post


Link to post
Share on other sites

You can download the latest release versions from connect.altair.com - which will then include the documentation, tutorials, etc.  You can request a login there if you don't already have one.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...