AnsysEmat - Trying to llink Ansys bin library.

100 views
Skip to first unread message

Andy

unread,
Feb 12, 2015, 7:09:09 PM2/12/15
to mor4...@googlegroups.com
Hello Everyone,

I am trying to setup AnsysEmat with mathlink to read the matrices on Linux Ubuntu. Unfortunately I get the following errors, hopefully someone can point me in the right direction. 

Many Thanks

The errors as displayed--

/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64//CompilerAdditions/mprep AnsysEmat.tm -o AnsysEmattm.c
#rm *.o AnsysEmattm.c
gcc -c -m64 -I/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64//CompilerAdditions AnsysEmattm.c
gcc -c -m64 -I/usr/local/Wolfram/Mathematica/9.0/SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64//CompilerAdditions AnsysEmat.cpp

AnsysEmat.cpp: In function ‘int closeAnsysFile()’:
AnsysEmat.cpp:90:37: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
     binclo_(&nblk, "KEEP", buffer, 4);
                                     ^
AnsysEmat.cpp: In function ‘void readElement()’:
AnsysEmat.cpp:236:29: error: ‘abs’ was not declared in this scope
  head[5] = convert ? abs(dim) : dim;
                             ^
make: *** [AnsysEmat.o] Error 1

Evgenii Rudnyi

unread,
Feb 14, 2015, 8:27:18 AM2/14/15
to mor4...@googlegroups.com
Hi Andy,

This is quite an old code, hence some extra work may be required.

> AnsysEmat.cpp:90:37: warning: deprecated conversion from string
> constant to ‘char*’ [-Wwrite-strings] binclo_(&nblk, "KEEP", buffer,

This message says that it seems nowadays it is not good to put a string
constant into the function call. Presumably one has to

char* text = "KEEP";
binclo_(&nblk, text, buffer,

Otherwise the warning should be ignored.

> AnsysEmat.cpp:236:29: error: ‘abs’ was not declared in this scope

This means that the function abs has not been found in the headers. It
is necessary to check which header should be included to have abs.

Evgenii

Andy

unread,
Feb 16, 2015, 8:26:07 AM2/16/15
to mor4...@googlegroups.com
Hi Evgenii,

Thank you very much for your support. I got rid of those errors by using a older compiler - GCC 3.4. How ever I am still unable to successfully load the AnsysEmat executable on to Mathematica. The error I seem to get from Mathematica is ;

1) error while loading shared libraries: libbin.so: cannot open shared object file: No such file or directory

I am assuming that there seems to be something wrong on the makefile, that's related to the runtime path. Any insights to the problem is highly appreciated.

many thanks,

Andy 

Evgenii Rudnyi

unread,
Feb 16, 2015, 3:18:13 PM2/16/15
to mor4...@googlegroups.com
Hi Andy,

First you should locate that file, and then put the directory with it to
the LD_LIBRARY_PATH. I should say that I do not remember exactly what an
environment variable is responsible for the search of shared libraries
but I guess that this is that one.

Evgeny

Andy

unread,
Feb 20, 2015, 5:52:04 AM2/20/15
to mor4...@googlegroups.com
Hi Evgenii,

I successfully compiled AnsysEmat and managed to read the .emat file contents. How ever I am having a strange issue. 

1) While reading the n  elements in the file, the first element matrix is totally different from the other matrices. In my example it should be identical. ( I doubt its one of the Element matrices at all)
2) All elements except the first one is perfectly fine. 

 Thanks again for all the support.

Andy 

On Friday, February 13, 2015 at 12:09:09 AM UTC, Andy wrote:

Evgenii Rudnyi

unread,
Feb 21, 2015, 4:06:56 AM2/21/15
to mor4...@googlegroups.com
Hi Andy,

You have to read the documentation to the EMAT file in the Programmer
Reference. It might be that there were some changes, I have not used the
EMAT file for ages.

With ANSYSRecords you read the ANSYS binary file record by record and
you can check what is there.

Please note that you have access to the assembled matrices in MathAPDL
nowadays. Why do you need the element matrices?

Evgeny

Andy

unread,
Feb 21, 2015, 4:33:04 AM2/21/15
to mor4...@googlegroups.com
Hi Evgeny,

As you said there are some changes in the functions used and possibly the format has also been changed. I am currently looking into that. For my work I require to extract the element matrices in a very precise format. I cannot do that with the built in Ansys APDL commands, due to its low precision output.

For now I will take your advice to read with ANSYSRecords and troubleshoot the problem. 

Many Thanks,

Andy

On Friday, February 13, 2015 at 12:09:09 AM UTC, Andy wrote:
Reply all
Reply to author
Forward
0 new messages