TAGGED: ansys-apdl, apdl-command, APDL-thermal, matlab, mechanical-apdl
-
-
March 21, 2022 at 10:48 am
IsaccoRafanelli
SubscriberHi everybody,
i'm launching a Steady State Thermal analysis with an Ansys Mechanical APDL macro code from Matlab in order to automatize a decoupled CHT caculus, but i'm facing with some issues. The matlab string used to launch the simulation is the following:
"!"C:Program FilesANSYS directoryANSYS192.exe" -b -i input.mac -o output.txt"
where the file "input.mac" has been created in ANSYS Mechanical with the command "write input file" and contains either all the informations about geometry, mesh, boundary conditions, and the command "solve" in /solu environment, or the manually written macro code for the results export (written in /post1 environment after the "solve" command).
The main issue is that commands written after "solve" are not considered, no matter what i write (i tried to write some random digits but it doesnt give any errors/warnings) included the macro code for the results export.T he output file doesn't show any errors and at the end "solution converged after XX iterations" is written.
For a further test i tried to load the macro code on Ansys Mechanical APDL with the graphical interface. After the loading, solution data are not available and a manually written "/solu solve" is needed.
I report the /solu and the /post1 environments of "input.mac" here:
/com,****************************************************************************
/com,************************* SOLUTION ********************************
/com,****************************************************************************
/solu
antype,0 ! static analysis
!eqsl,sparse ! using sparse solver which is default so no eqsl command needed
cntr,print,1 ! print out contact info and also make no initial contact an error
rescontrol,,none ! Do not keep any restart files
dmpoption,emat,no ! Don't combine emat file for DANSYS
dmpoption,esav,no ! Don't combine esav file for DANSYS
/com,****************************************************
/com,******************* SOLVE FOR LS 1 OF 1 ****************
esel,s,type,,18
nsle
sf,all,hflux,5000
!OTHER BOUNDARY CONDITIONS ARE NOT REPORTED
nsel,all
esel,all
autots,on
nsub,1,10,1
time,1.
outres,erase
outres,all,none
outres,nsol,all
outres,rsol,all
outres,eangl,all
outres,etmp,all
outres,veng,all
outres,fflux,all
outres,cont,all
/nopr
esel,s,type,,22
esel,a,type,,23,49
cm,_elmisc,elem
esel,all
/gopr
outres,misc,all,_elmisc
cnvtol,heat,,.001,,1.e-006 ! Program Controlled. Set MINREF equivalent of 1e-6 Watts
! *********** WB SOLVE COMMAND ***********
! check interactive state
*get,ANSINTER_,active,,int
*if,ANSINTER_,ne,0,then
/eof
*endif
solve
!PROBLEM: COMMANDS WRITTEN BELOW ARE SKIPPED
/com *************** Write FE CONNECTORS *********
CEWRITE,file,ce,,INTE
/com,****************************************************
/com,*************** FINISHED SOLVE FOR LS 1 *************
*get,_wallasol,active,,time,wall
/post1
/INPUT,'postpr','dat','C:Users afanelliDocumentsITER1A',, 0 !MACRO FOR POSTPROCESS
xmlo,ENCODING,ISO-8859-1
xmlo,parm
/xml,parm,xml
fini
/gopr
*get,_walldone,active,,time,wall
_preptime=(_wallbsol-_wallstrt)*3600
_solvtime=(_wallasol-_wallbsol)*3600
_posttime=(_walldone-_wallasol)*3600
_totaltim=(_walldone-_wallstrt)*3600
*get,_dlbratio,active,0,solu,dlbr
/com,--- Number of total nodes = %_numnode%
/com,--- Number of total elements = %_numelem%
/com,--- Element load balance ratio = %_dlbratio%
/wb,file,end ! done with WB generated input
I think there is a problem with the solution command but i'm not able to figure out.
Thank you so much
March 22, 2022 at 12:12 pmgiulio.generini
SubscriberHi everyone! I've the same problem: does anyone have the solution?
Thanks in advance!
March 23, 2022 at 4:47 pmAshish Khemka
Forum Moderator
Please see if the following link helps:
Run Ansys from Matlab | ths1104 geek├® (wordpress.com)
Regards Ashish Khemka
March 23, 2022 at 5:13 pmChandra Sekaran
Ansys EmployeeYou mention that the commands right after SOLVE are ignored. Does the output show that the SOLVE completed successfully? It almost sounds like the solve stopped without completion and nothing else is being executed. Do you have the postpr.dat in the location 'C:\Users\rafanelli\Documents\ITER1A\ ?
Viewing 3 reply threads- The topic ‘thermal steady state analysis with Ansys Mechanical APDL and Matlab’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
5879
-
1906
-
1420
-
1306
-
1021
Top Rated Tags© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-