run optistruct via bash file

MO987654
MO987654 New Altair Community Member
edited October 2020 in Community Q&A

Hello, 

im trying to do an optimisation on optistruct on Linux

i generatred my fem File with hypermesh on linux,

i did some changes on the fem File via Matlab on linux

i create a new fem File as output and  run the first Iteration manually, the generated, sh file will be placed where the second iteration should be executed 

now my goal is to send a command from matlab to optistruct to run the 2 nd 3rd, n th iteration, the command in matlab look like this 

      system([Argument_1,Argument_2 ,Argument_3]); where Arg_1 is  the Bash file, Arg_2 the fem File, and Arg_3 is the sh file.

my goal is to generate the ouput of the optimization automatically 

the problem here im  new in linux and i dont know what to write as a bash file to run this command.

can you please help me in this topic ??

thx in advance 

 

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited May 2020

    If I understand you correctly:

    • Arg_1 = your Bash shell script
    • Arg_2=  FEM file, 1st input arg of your Bash shell script Arg_1
    • Arg_3= 2nd input arg of your Bash script Arg_1

    Try within 'run.sh' :

     #!/bin/bash MyDir=/home/foo/bar cd $MyDir ./MyScript.sh MyFem.fem MyAnotherScript.sh

    Where: 'MyDir' is the folder containing the script 'MyScript.sh'

    Do the following command:

     chmod +x run.sh

    And the script 'run.sh' becomes executable now.