General Mechanical

General Mechanical

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

How to use script to run the cfile for creating k file?

    • cct
      Subscriber

      Hi, 

      We tried to use cfile to create the key file for running LS-Dyna and LS-OPT. However, when we used the script to submit it in the terminal, it keeps jumping out the message "Error: Unable to initialize gtk, is DISPLAY set properly?" The following picture is the command in the run file.

      Does anyone face the same issue as ours?
      The following picture is the run_lspp file we try to submit.

    • igandiko
      Ansys Employee

      I don't think you need a script for LSPP. Since you're already running ls-opt process on the cluster using a script, run LSPP on the same node as LS-OPT. To run on same node, instead of using a script, in LSPP stage solver command, enter below line. 

      /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lsprepost

      LS-OPT will automatically add "-nographics c= LsPrepostOpt.inp" to above command so you don't have to define it again. After running baseline run, check job_log.solver in 1.1 directory of LSPP stage. If you still get the same error, try below command in solver command section of LSPP, 

      /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lsprepost runc= LsPrepostOpt.inp

      Note that after replacing parameter values, ls-opt copies cfile as LsPrepostOpt.inp so this is the input file for LSPP command. 

       

       

      • cct
        Subscriber

         

        We tried the way entering /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lsprepost in LSPP stage, but the key file is not created.

        We tried editing the script and now it could create the key file from cfile when we submit the run_lspp file. However, even though the run_lspp file works, when we use sbatch ../../run_lspp in command in the LSPP stage, the stdout in LS-Dyna directory still shows the key file cannot be found.

        We checked LsPrepostOpt.inp and it has the replacing parameter values.

         

        • igandiko
          Ansys Employee

          Are you saying "sbatch run_lspp" command works outside of ls-opt but using same script "sbatch ../../run_lspp" command does not work through ls-opt?

          Below the stage command, select "do not add input file argument" option and try again.

          Note that by default, if you select LSPP solver package, ls-opt will add "-nographics c=LsPrepostOpt.inp" or "runc=LsPrepostOpt.inp" arguments to solver command but since you are using a script, these arguments maynot be valid so skip it by using "do not add input file argument" checkbox.

           

        • cct
          Subscriber

          Understand! Thanks for the explaining.

          However, we selected the option “do not add input file argument”, it still cannot get the key file created.

          The LsPrepostOpt.inp in stage seems good. Is there any other thing we can check for this issue?

           

           

           

           

        • igandiko
          Ansys Employee

          What does job_command.solver show in LSPP 1.1 directory? What happens if you manually run this command file through a terminal?

        • cct
          Subscriber

           

          The job_command.solver shows in stage1/1.1 as following

          When we use run_lspp to create kfile from cfile, it works. Yet, when we use run_opt to submit the LS-OPT job, it jumps out the same error and kfile isn’t created.

           

    • cct
      Subscriber

      When we use run_lspp to create kfile from cfile, it works. Yet, when we use run_opt to submit the LS-OPT job, it jumps out the same error and kfile isn’t created.

       

      • igandiko
        Ansys Employee

        In LSPP 1.1 directory, is there a log file from your cluster to see the error? Without checking the log file, we don't even know if LSPP was launched correctly. In the below 3 steps, which step do you see an issue? 

        1. LS-OPT runs job_command.solver file located in LSPP 1.1 stage. This command runs "sbatch ../../run_lspp". Is there a log from sbatch? 
        2. sbatch script calls LSPP and LSPP runs LsPrepostOpt.inp to generate k file
        3. k file from LSPP stage is copied to LS-DYNA stage

        Focus on log files in LSPP 1.1 stage to see if LSPP was even called or not. If it was called, did it generate k file in LSPP 1.1 directory? 

        Since you're running LSPP on the cluster, you may have to select "use queuing >simple" in remote options and also define suitable termination criteria in "termination" tab. Maybe LS-OPT is running sbatch command correctly by its not waiting for LSPP process to finish and moves on to LS-DYNA stage and complains about missing k file. 

        • cct
          Subscriber

          In those following steps, 

          1. There's a log file in stage1.1
          2. In the main directory, there's a kfile created from cfile
          3. The kfile doesn't show up in the stage of LSDYNA

          It works now when I select "use queuing >simple" in the stage of LSPP, which seems the error occurs as you thought that LS-OPT is running sbatch command correctly by its not waiting for LSPP process to finish and moves on to LS-DYNA stage.

          Thank you so much!

        • cct
          Subscriber

          It works in GUI, but it still has issue when we sbatch in the terminal.

          When I checked in the LSDYNA/1.1, I found the created kfile is copied into this directory, but the time of stdout showing that the kfile cannot be found is 10 min. Yet, the queuer timeout is set 720 min (as default).

          It shows the message in the job_log.solver:

        • igandiko
          Ansys Employee

          Is this screen shot from job_log in ls-dyna stage? It says found matching criteria for error which means ls-opt found "E r r o r  t e r m i n a t i o n" line in d3hsp file so it looks like your ls-dyna run failed. Check ls-dyna messag/d3hsp files for errors. 

        • cct
          Subscriber

          In d3hsp, there's the same error message that the key file does'nt exist.

        • igandiko
          Ansys Employee

          Can you show screen shot of ls-opt workflow? Did you define file transfer operation between ls-opt and ls-dyna? If you did, check time stamps of when k was created in LSPP stage and compare it to time stamps of k file in ls-dyna stage and also time stamp of d3hsp file. This should give some clues. 

        • cct
          Subscriber

           

          This is our ls-opt workflow:

          I just set the input cfile in LSPP stage (stage1) and the file would be copied to LSDYNA stage. In stgae1/1.1, there is no kfile created from cfile. Yet, in the main directory, we can find the kfile was created at 2:39:50 PM, and it is copied into LSDYNA/1.1 at 2:49:08 PM, but d3hsp and stdout created at 2:39:51 PM.

          Also, we tried to run it in GUI again, and it now faces the same issue.

    • igandiko
      Ansys Employee

      Your setup is not correct. In stage1, you select cfile. ls-opt will replace parameters and copy this cfile as LsPrepostOpt.inp. LSPP will run LsPrepostOpt.inp and generate ls-dyna k file. Lets say this k file is model.k. 

      Double click on the small box between Stage1 and LS-Dyna and define file transfer operation to copy model.k file from Stage1 directories to LS-Dyna directories as DynaOpt.inp. Just enter "model.k" as "source" and "DynaOpt.inp" as "destination". 

      In LS-Dyna stage, don't select any input file. DynaOpt.inp will directly come from LSPP stage and your ls-dyna job script will have i= DynaOpt.inp to run this file.

      • cct
        Subscriber

        We have two input into LS-OPT, one is cfile which would create model.k, and one is main.k, which is the whole model removing the cube part.

        Do you mean what's done in the following pictures? I am wondering whether the main.k would be not read in LS-OPT if we do in this way.

    • igandiko
      Ansys Employee

      In that case, use main.k as input file of LS-Dyna stage. main.k will have *include card for model.k which comes from LSPP stage.

      In file transfer box, enter model.k in both source and destination fields.

      LS-OPT will copy main.k from working directory as DynaOpt.inp and its include file will be copied from LSPP stage using file transfer operation.

       

      • cct
        Subscriber

        I changed the file transfer box and set the main.k as input in LSDYNA stage, and can see the model.k is copied in LSDYNA/1.1.

        However, in the very beginning, LSOPT stops due to the error which is same as very previous one: (in LSDYNA/1.1 job_log)

    • igandiko
      Ansys Employee

      If job_log just says error, without any meaningful message, the next file to check is ls-dyna messag or d3hsp. 

      • cct
        Subscriber

        These two files are even not created in LSDYNA/1.1 directory.

        • igandiko
          Ansys Employee

          Which means ls-dyna not did not run. Check job_log.solver file to see if there is any output from sbatch command. What happens if you manually run job_command.solver located in ls-dyna/1.1? Are there any other log files from sbatch command? 

        • cct
          Subscriber

          In the job_log.solver, it shows

          When I tried to run job_command.solver with the run file for submitting the LSOPT, it jumps out the warning: Could not read lsopt project file job_command.solver

        • igandiko
          Ansys Employee

          Clearly, file copying failed which means either T005_trycube.k is not available in Stage/1.1 or it wasn't generated yet when ls-opt moved on to next step after running LSPP command. 

        • cct
          Subscriber

           

          I just downloaded the T005_trycube.k in LSDYNA/1.1, and it seems good, having the shell mesh and properties of material, hourglass, and section. This kfile is copied into 1.1 just 12 sec later than the lsopt runs. Is this issue be unable to solved with using queuing >simple?

           

        • igandiko
          Ansys Employee

           

          What termination criteria did you define for LSPP stage under “termination tab”? 

           

        • cct
          Subscriber

          I did not change the default setting under termination tab in LSPP stage.

    • igandiko
      Ansys Employee

      Since T005_trycube.k will be generated in LSPP directories, change criteria to "existence of file" and enter T005_trycube.k. In this way, LSPP job will be considered as normal termination only if T005_trycube.k is found in the directory, until then ls-opt will wait instead of moving on to LS-Dyna stage. 

      (or)

      Add a delay of 15-20 seconds. First option might be better. 

      • cct
        Subscriber

        I changed with the first option and run it in GUI, but it seems like stocked. In lsot_engine.log shows that the kfile is copied to lsdyna stage, and it truely exists in lsdyna/1.1, but the job keeps waiting, and no other step occurs in lsdyna stage.

    • cct
      Subscriber

       

      Thank you for your help, Imtiaz.

      The issue is solved by these steps:

      1. In the cfile, the path for saving the keyword is removed sice if you give a path, the same file will get overwritten; if you don't define a path, k file will be created locally in individual folders.

      2. The section and material cards are moved to the main file. The thickness parameter can be defined directly in *SECTION using *PARAMETER, no need to define this in cfile.
       
      3. In cfile, there's only *part card for cube. The lines with "$" in cfile are removed since ls-opt was adding extra line if there is "$' in cfile and that caused issues in LSPP in writing correct *PART card.

       

Viewing 7 reply threads
  • The topic ‘How to use script to run the cfile for creating k file?’ is closed to new replies.