General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

APDL sequence of jobs in batch mode

    • sohrab
      Subscriber

      Hi everyone,


      i have dozens of developed codes in text and i want to run every code . how can i set APDL in such a way that starts from one code finish it and then start anaother code to analyze till end . it would hugely saves my time.


       


      thank you in advance for your replies and comments


       

    • jj77
      Subscriber

       


      Never done this, but should be perhaps possible. See these two very good posts on how to do something like that.


       


      In your case instead of running different parameters you do a *do loop that takes entries from a string array that contains all the mapdl macros/scripts file names.


      http://www.padtinc.com/blog/tag/batch


       


      On how to create such an array see below:


      http://www.padtinc.com/blog/the-focus/manipulating-text-strings-in-ansys-mechanical-apdl

    • sohrab
      Subscriber

      Thank you @jj77 for your reply.


      i wrote a script as below


      fini
      /clear


      *dim,ANNUM,string,80,17      
      ANTAG(1,1) = ‘AN1_SC’
      ANTAG(1,2)=’AN1_DC’
      ANTAG(1,3) = ‘AN2_SC’
      ANTAG(1,4)=’AN2_DC’
      ANTAG(1,5) = ‘AN3_SC’
      ANTAG(1,6) = ‘AN4_SC’
      ANTAG(1,7)=’AN4_DC’
      ANTAG(1,8) = ‘AN5_SC’
      ANTAG(1,9)=’AN5_DC’
      ANTAG(1,10) = ‘AN6_SC’
      ANTAG(1,11)=’AN6_DC’
      ANTAG(1,12) = ‘AN7_SC’
      ANTAG(1,13)=’AN7_DC’
      ANTAG(1,14) = ‘AN8_SC’
      ANTAG(1,15)=’AN8_DC’
      ANTAG(1,16) = ‘AN9_SC’
      ANTAG(1,17)=’AN9_DC’


      !/INQUIRE,dir_,DIRECTORY


      *do,I,1,17
      *cfopen,%ANTAG(1,i)% ,mac
      dirnam='%ANTAG(1,i)% '
      *cfclose
      /input,%ANTAG(1,i)%,mac
      *enddo


      but i get error (unknown expression in input file)


       


       


       

    • jj77
      Subscriber

      As I said I have not done this myself. One thing I can see in the code though is that the array is called ANNUM, but then ANTAG is used (should be ANNUM I think). But I think it will not work still. I will have a look and see how one can add strings to an array.

    • jj77
      Subscriber

      this works:


      *dim,ANTAG,CHAR,17


      ANTAG(1,1) ='AN1_SC'


      ANTAG(2,1) ='AN1_DC'


      and so on


       


      Have in mind that CHAR are upto 8 characters long, but that is OK for you now.


       


      This should also work


      size=17 


      *dim,mytext,char,size 


      mytext(1)='hi'


      mytext(2)='hiagain'


       

    • sohrab
      Subscriber

      thanks jj77 for the reply.i tried your code and still get the same error. 


      i copy and paste the script to the command bar in APDL, is it a correct approach? 

    • jj77
      Subscriber

      Not sure which part is not working. If we take the array part first, then take this and paste it in to the apdl command window on the top, that works.


      *dim,ANTAG,CHAR,17


      ANTAG(1,1) ='AN1_SC'


      ANTAG(2,1) ='AN1_DC'


      To see the values one can set a scalar s1=ANTAG(1,1) and look at s1.


      See below:



      If you mean that the whole script (running batch mode) does not work then I do not know why.

    • sohrab
      Subscriber

      your help is highly appreciated.

    • jj77
      Subscriber

      No worries, let us know if the script is not working and you can run batch and perhaps someone can help more (I will have a look also tomorrow when I have some more time)

    • jj77
      Subscriber

      There might be an easier option as described in help:



       


      also this might be of help


       


      https://www.eng-tips.com/viewthread.cfm?qid=277708


       


      also this post from Peter is very good:


      /forum/forums/topic/need-help-on-creating-the-script-file-for-launching-ansys-mechanical-job/

    • sohrab
      Subscriber

      Thnak you very much jj77 for your help it was useful. I appreciate it.

Viewing 10 reply threads
  • The topic ‘APDL sequence of jobs in batch mode’ is closed to new replies.