Cannot output results from ANSYS 18.2 when run from MATLAB in batch mode

Hello,

I have problems outputting the results from ANSYS 18.2 when run from MATLAB R2018a in batch mode on a 64-bit Windows 7 machine. I am using the following procedure:

I have created an APDL file for ANSYS called geom_sol_out.txt which contains geometry commands, boundary conditions, loads, solve commands and output command to write results into a text file. I run it from MATLAB by running batch file run_ansys.bat which contains:

set ANS_CONSEC=YES
set ANSYS_LOCK=OFF
"C:\Program Files\ANSYS Inc\v182\ansys\bin\winx64\ANSYS182" -b -i ansysinputreader.txt -o out.dat

with ansysinputreader.txt containing /INPUT,'geom_sol_out','txt','H:\test\',, 0

This works nicely until the SOLVE command in geom_sol_out.txt is reached. After the solution is done, ANSYS simply ignores all the commands following the SOLVE command, so I cannot output the nodal results. I am using  /OUTPUT command to output the results into text file. (note:  /OUTPUT command works fine for e.g. nodal coordinates when it is called before the SOLVE command, but not when it it is called afterwards)

Can anyone help me with this?

Thank you in advance.

Comments

  • bsistabsista Member
    edited June 2018

    This may sound trivial but are you issuing /POST1 or /POST26 after the SOLVE command to enter the post-processing module? Perhaps it may help if you can share the .out file for any warnings or errors.

  • edited June 2018

    Hello,

    Thank you for your comment. In the meantime, I managed to solve my problem. The issue was in the lack of memory and that is the reason why the file stopped execution at some point. It was solved by adding SET KMP_STACKSIZE=2048k to the batch file.

  • AlkallaAlkalla Member
    edited September 2018

    Hello Aleksandar,

     

    I have the same problem, the file in working fine with the interactive mode, but when using the batch mode it stops before /post1 command.

    Would you please let me know how you use the command you mentioned above (SET KMP_STACKSIZE=2048k).

     

    Many thanks

  • edited September 2018

    Hello,

    First I create a batch file run_ansys.bat containing: (make sure to change the path calling ANSYS applicable to your system. Also, you might need more than 2048k)

    SET ANS_CONSEC=YES

    SET ANSYS_LOCK=OFF

    SET KMP_STACKSIZE=2048k

    "C:\Program Files\ANSYS Inc\v181\ansys\bin\winx64\ANSYS181" -b -i ansysinputreader.txt -o out.dat

    The ansysinputreader.txt contains the following:

    /INPUT,'A_02','txt','C:\Users\A.-S. Milakovic\Dropbox\Work\TUHH\Moritz\paper_1\T_joint_A\stress_grad_calcs\',, 0

    which is simply a path to an APDL file containing geometry, mesh, loads, and solve commands for ANSYS including the /OUTPUT command which outputs the desired results from ANSYS into a .txt file in the current directory. Here is an example of an /OUTPUT command in ANSYS APDL which outputs nodal stresses into stress_nodes.txt:

    /POST1

    /OUTPUT,stress_nodes,txt 

    PRNSOL,S,PRIN

    /OUTPUT 

    Finally, I simply call !run_ansys.bat from MATLAB and get the desired output files which I can then read back into MATLAB and analyse. 

    Hope this helps.

    Cheers,

    Aleksandar

  • MeruMeru Member
    edited October 2018

    Hi, I have started a project that require similar things ( like running Ansys in Batch mode from matlab) I do not know how to write an APDL file and How to write a batch file that can open Ansys . Can you please guide me in a proper direction of source that I can refer and learn how to do it. It would be really helpfull. Thank you.  

  • peteroznewmanpeteroznewman Member
    edited October 2018

    Hi Meru,

    Maybe you can do everything in ANSYS without matlab. What are you doing in matlab that you can't do in ANSYS?

    Or, if you don't know ANSYS well enough to answer that question, perhaps you could tell us what you are trying to do.

    Regards,
    Peter

     

  • kintoresenpaikintoresenpai Member
    edited November 2019

    You are a genius! Thank you so much

  • edited October 18

    I was having the same problem. I uninstalled and installed several versions of matlab/ansys, however, it only worked when I changed the command in matlab:

    !"C: \ Program Files \ ANSYS Inc \ v192\ ansys \ bin \ winx64 \ ANSYS192" -b -i FEAin.txt -o FEAout.dat

    by:

    system ('SET KMP_STACKSIZE = 10240k & "C: \ Program Files \ ANSYS Inc \ v192 \ ansys \ bin \ winx64 \ ANSYS192" -b -i FEAin.txt -o FEAout.dat') 

    Thanks for the help, you saved my research!!!

Sign In or Register to comment.