How to link Abaqus to MATLAB libraries?

I am currently working on writing a UMAT subroutine. In one part of the code, I need to solve a system of linear equations. Initially, I used Fortran libraries such as LAPACK and PARDISO for solving the system, but they were unable to provide accurate solutions for the equation’s roots when the matrixes are very large and sparse. In contrast, MATLAB can calculate these roots with high accuracy. To address this, I established a connection between Fortran and MATLAB to compute the roots directly within the Fortran code.

At present, the Fortran code executes without errors in Visual Studio 2019 and produces results that align with my previous MATLAB implementation. However, when I incorporate this Fortran code into the UMAT subroutine, Abaqus fails to access MATLAB libraries during the analysis phase.

To resolve this issue, I conducted extensive research and modified the abq2024.bat, win86_64.env, and custom_v6.env files to define the paths for MATLAB libraries in Abaqus (based on suggestions from online forums). The MATLAB libraries required for execution are located in the following path:
C:Program FilesMATLABMatlabVersionexternlibwin64microsoft.

I attempted to add this path both through Windows environment variables and by explicitly defining it in Abaqus’ .env files. However, the error persists.

To simplify my debugging process, I wrote a basic code in the UMAT subroutine to calculate DDSDDE for a material and call a MATLAB function at the end, passing it a value. This code successfully links with MATLAB and returns the correct output when executed in Visual Studio. However, when running the same code through Abaqus, it fails with a linking error.

Any insights or suggestions would be greatly appreciated!

A portion of the UMAT code for connecting to MATLAB and calling its function is as follows:

x=27

 ep = engOpen('matlab ') 

if (ep .eq. 0) then 

write(6,*) 'Can''t start MATLAB engine' stop

 endif 

Xp =mxCreateDoubleMatrix(1,1,0)

#if MX_HAS_INTERLEAVED_COMPLEX

call mxCopyReal8ToPtr(x,mxGetDoubles(Xp),1) 

#else

call mxCopyReal8ToPtr(x,mxGetPr(X),1) 
#endif

 status1 = engPutVariable(ep, 'Xp', Xp)

 if (status1 .ne. 0) then 
write(6,*) 'engPutVariable failed for x'
 stop
 endif  

if (engEvalString(ep, 'cd /path/functionName.m;') .ne. 0) then
write(6,*) 'faield in finding path!!!'
 stop
 endif
 
if (engEvalString(ep, 'Yp=FuncForFortran(Xp);') .ne. 0) then
write(6,*) 'faield in calling function!!!'
stop
endif
Yp = engGetVariable(ep,'Yp')

#if MX_HAS_INTERLEAVED_COMPLEX call mxCopyPtrToReal8(mxGetDoubles(Yp), y,1) 

#else 
call mxCopyPtrToReal8(mxGetPr(Yp), y, 1) 
#endif 

call mxDestroyArray(Xp) call mxDestroyArray(Yp) 

print *, 'y = ', y 

status1 = engClose(ep)
if (status1 .ne. 0) then 
    write(6,*) 'engClose failed'
    stop
 endif

The error message encountered during Abaqus execution is as follows:

error LNK2019: unresolved external symbol engopen referenced in function umat.R

error LNK2019: unresolved external symbol mxcreatedoublematrix800 referenced in function umat.R

error LNK2019: unresolved external symbol mxgetdoubles800 referenced in function umat.R

error LNK2019: unresolved external symbol mxcopyreal8toptr800 referenced in function umat.R

error LNK2019: unresolved external symbol engputvariable referenced in function umat.R

error LNK2019: unresolved external symbol engevalstring referenced in function umat.R

error LNK2019: unresolved external symbol enggetvariable referenced in function umat.R

error LNK2019: unresolved external symbol mxcopyptrtoreal8800 referenced in function umat.R

error LNK2019: unresolved external symbol mxdestroyarray800 referenced in function umat.R

error LNK2019: unresolved external symbol engclose referenced in function umat.R

New contributor

Albert2013 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật