We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
General Mechanical

General Mechanical

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

How to use script to create complete part from cfile to kfile and run in LS-OPT

    • cct
      Subscriber

      Hi, 

      We tried to use cfile to create the key file for running LS-Dyna and LS-OPT. We know that cfile can only create elements and nodes to kfile. However, the part we want to create has a series of processes: creating lines, rotating them into a solid  part, meshing the surface of the solid part, removing solid part (only shell left), and making the shell corrugated by generating solid elements from shell, generating shell elements from solid face, and deleting solid one and the original shell part.

      Since we would like to do parametric-optimization on this corrugated shell part, we need to use cfile to create kfile, rather than process them in LSPP directly.

      We were thinking that we might be able to create a part with the steps from adding lines to make a solid part via cfile, and adding script to main.k to do the remaining process. Thus, we made a part in LSPP to see what scipts would be in kfile. Yet, we found there is only the info about element_shell and nodes, which is different from our expectation.

      Does anyone know how to use script to create complete part from cfile to kfile, or how to edit the kfile for this problem?

    • cct
      Subscriber

      We tried some other ways to create the part:

      1. Before meshing it, we used lines, curves, and features of breaking/merging curves and offset curves to create a solid part. Then, delete ths solid one after meshing it.
      2. Simplifier our part to a cone, and using Solid>Cone to create a solid part and mesh it, and then delete the solid one.

      We saved these two ways in cfile and still have errors to create the kfile. Is there any other way we can try for it? Thanks!

    • igandiko
      Ansys Employee

      "We know that cfile can only create elements and nodes to kfile." - this is incorrect. A cfile is an LSPP command file and it allows you to perform most of LSPP operations in batch model. All the steps performed through LSPP GUI are recorded as commands in cfile. It can be generating a part, drawing lines/curves, postprocessing results, or a series of steps.

      "We were thinking that we might be able to create a part with the steps from adding lines to make a solid part via cfile, and adding script to main.k to do the remaining process. Thus, we made a part in LSPP to see what scipts would be in kfile. Yet, we found there is only the info about element_shell and nodes, which is different from our expectation."

      As long as cfile has all the steps , starting from adding lines, etc, it should be able to create a part. I don't understand what you mean by adding a script to main.k.

      After creating the part and saving the operation in cfile, what error did you get when you ran this cfile in batch mode? You can also open this cfile in LSPP GUI (open > command file > start). Depending on where this process stops, you can identify where the problem lies in the cfile.

       

       

      • cct
        Subscriber

        Thank you for repling and explaining.

        When we tried to run in the cluster, there is no kfile created and the error jumped out several similar lines as following:

        (process:103941): Gdk-CRITICAL **: 00:12:55.741: IA__gdk_screen_get_width: assertion 'GDK_IS_SCREEN (screen)' failed
        (process:103941): GLib-GObject-WARNING **: 00:12:55.745: invalid (NULL) pointer instance
        (process:103941): GLib-GObject-CRITICAL **: 00:12:55.745: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

        However, we just tried to run in LSPP GUI in the local computer, and found it successfully created the part.

        We need to run lsopt in the cluster, so creating parts also needs to be done in the cluster. Is this issue caused by the the command in run file or is anywhere in cfile should be editted for running in the cluster? The following figure is our command in runfile.

         
      • cct
        Subscriber

        I also tried using the same version of LSPP to create the cfile as what we use in cluster (4.8.24), but it still has the same issue (shown in the following figure).

    • igandiko
      Ansys Employee

      You can try couple of things: 

      1. Use '/path/lspp48 -nographics c=' command instead of '/path/lspp48 runc='

      2. Don't use slurm script to submit LSPP job. In LS-OPT stage solver command, enter below command and turn on "do not add input file argument". 

      /sw/hprc/...../lspp48 -nographics c=LsPrepostOpt.inp

       

       

      • cct
        Subscriber

        Thank you for replying and providing possible ways.

        With way 1, we got the error : Unable to initialize gtk, is DISPLAY set properly?

        With way 2, we found in stage1 (LSPP)/1.1, the parameter is read correctly, but kfile is not created. And the same error message is shown in stdout file.

        • igandiko
          Ansys Employee

          Try option 2 using a newer version (v4.9) or newer build of 4.8 (4.8.22 is latest). 

          Is the command correct? Why are you calling 'lsprepost' instead of 'lspp48' script located in /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common? Try below command. Make sure "DN" variable in 'lspp48' script points to correct installation path.

          /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lspp48 runc=

          Next try mesa version, 

          /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lspp48_mesa runc=

          If these don't help, I will have to check with LSPP experts. 

           

        • cct
          Subscriber

          The command was correct; I just wanted to specify that the stage 1 is the stage of LSPP but we just not named it LSPP. We used the directory "/sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common" in the command. Sorry for the confusion.

          The latest version we have in our cluster is 4.8.24 and I tried it with option 2, but they still cannot create the kfile.

        • igandiko
          Ansys Employee

          What I meant is, in '/sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common' directory, 'lsprepost' is a binary but there is 'lspp48' script in the installation directory which set environment for some libraries before launching lsprepost. You should be calling this script to launch LSPP. Please check if 'lspp48' file is located in /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common. If yes, make sure "DN" variable points to correct directory and then try below command,

           /sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lspp48 runc=

        • cct
          Subscriber

          Also, I just checked with our previos slurm script and found we used "/sw/hprc/sw/LS-PREPOST/4.8.9/lsprepost4.8_common/lsprepost runc=LsPrepostOpt.inp"

          In that case, both of running this script directly and run it in LSOPT work. Yet, both lspp48 and lsprepost do not work now.

        • cct
          Subscriber

          Hi Imtiaz,

          We also tried to simplify our part and see if we could find where the problem is. Here are some points of simplification:

          1. We remove the corrogation and make it a half ellipsoid. Yet, it still fails in the cluster;
          2. We reduce the number of parameters. It still fails in the cluster, too;
          3. In comparison, we also add parameters on the previous testing one, which is a cube created by using "generate mesh tool." This successful model still succed in the cluster. 

          All of them can successfully create the kfile with LSPP GUI in the local computer. From these tries, we know that it is highly possible to fail due to the reasons except the number of parameters or the number of lines (i.e. the complexity of the process we create it). 

          However, we still do not know where's the problem. Do you have any other recommendations on what kind of other tries we can do or could you please help us to check with LSPP experts?

          Thank you so much!

        • igandiko
          Ansys Employee

          So you're saying LSPP fails on the cluster for one cfile but completes successfully for a different cfile? I would need the files, hard to guess without it. On local computer, did you run the cfile in batch mode without using GUI? 

        • cct
          Subscriber

          Yes, the current one with several lines fails, but the previous one with generating meshes directly succed. I did not try to run it in batch mode without using GUI, but I just checked that it can successfully create the kfile with GUI in the cluster.

    • cct
      Subscriber

      Sorry for the misunderstanding.

      When running the LSOPT GUI, I put "/sw/hprc/sw/LS-PREPOST/4.8.24/lsprepost4.8_common/lspp48" in the command of Stage LSPP.

      I also rerun the LSPP with slurm script (edited the lspp48 from lsprepost), but it showed out the error message "Permission denied."

Viewing 4 reply threads
  • The topic ‘How to use script to create complete part from cfile to kfile and run in LS-OPT’ is closed to new replies.