x
Our website uses cookies. By using the website you agree ot its use. More information can be found in our privacy policy.

An example using GenEx to extract responses

GenEx provides features for extracting entities from text files. This allows LS-OPT to be used with any solver code that produces a text database. GenEx is a tool to create the .g6 file used by LS-OPT to extract responses and histories. It is included in the LS-OPT distribution as the executable file genex.

This example explains how to extract a number of responses from the LS-DYNA d3hsp file. Different search options are employed to demonstrate the various options.

  1. From the Responses panel select GENEX as a response.
  2. Create a new .g6 file by clicking on the Create/Edit button.
    ( When first starting GenEx, there will be two predefined anchors in the tree on the left, Start of File and End of File. It is not possible to change or remove these two anchors.)

genex_responses_02.png

  1. In the GenEx GUI select d3hsp as the input file by using File→Open input file→Browse for file. The d3hsp file can be generated by executing a baseline run in LS-OPT, or a file of a previoulsy performed simulation using the same model can be used.The d3hsp file is displayed in the middle column in the GenEx GUI window. We are interested in 3 responses at various cycles and a fourth response to be the last one in the file.

genex_responses_03.png

  

Defining an anchor using a plain search

  1. Define an anchor by clicking on the anchor icon anchor_icon.png or using the Edit option.
    (Anchors describe how to find a certain position in the data file. This can be done with searching for keywords or with an absolute position.)
  2. Type the Anchor name Cycle4800_Plain.
  3. For Origin switch to Start of File.
    (Origin is the parent anchor of the anchor/entity.)
  4. For Type switch to Plain search.
  5. Type Text to search for: "dt of cycle    4800". Press "Enter" on the keyboard.
    (If you want to change the string in the text box, remember to press "Enter" on the keyboard. The anchor is displayed as a small anchor icon in the left most column of the line that matches the search string. The next step would be to find the desired field relative to this anchor.)
  6. Select Forward as the search Direction from the origin.

 genex_responses_05.png

 

Defining an entity

  1. Define a new entity by using the leftmost x-icon entity_icon.png or the Edit option.
    (An entity is a quantity we want to extract from LS-OPT. Entities describe both what the number should look like as well as where, relative to the parent, to find it. )
  2. Type for Entity name SWEner.
  3. Choose the previously defined anchor, i.e. Cycle4800_Plain, as the Origin.
  4. Find the desired field by searching 6 lines below the anchor, 2 columns across. The desired field is highlighted in yellow with a black border. See figure below.

 exp_genex_responses_06.png

Now define a new entity referred to the same anchor Cycle4800_Plain:

  1. Click on the x-icon entity_icon.png.
  2. Type for the Entity name Yvelocity.
  3. This entity is 18 lines below the anchor and 3 columns across.

 exp_genex_responses_07.png

 

Defining a second anchor using a global search

  1. Click on the anchor icon anchor_icon.png.
  2. Type for Anchor name Cycle4700_Glob.
  3. The Origin of this anchor is also the Start of the file.
  4. For Type switch to Glob search.
  5. Type Text to search for: "4700 is controlled".
    Note the anchor placement on the figure below just before the string "4700 is controlled".
  6. Select Forward as the search Direction from the origin.

 exp_genex_responses_08.png

 

Defining an anchor relative to the previous anchor

Now define an anchor InternalEnergy_Absolute relative to the previous anchor by setting the origin as Cycle4700_Glob and type as Absolute, then searching 5 lines down and one column across.

  1. Click on the Anchor icon anchor_icon.png.
  2. Type for Anchor name InternalEnergy_Absolute.
  3. Select as the Origin of this anchor Cycle4700_Glob.
  4. Select Absolute as Type.
  5. Select Forward as the search Direction from the origin.
  6. The Relative location of this anchor according to Cycle4700_Glob is 5 lines below and 1 column across.

 exp_genex_responses_09.png

 

Define a new entity

The entity InternalEnergy using the InternalEnergy_Absolute anchor as reference point. The desired field is immediately found since the anchor is already at the desired location.

 exp_genex_responses_10.png

 

Defining an anchor with reference to the end of the file

The next desired entity is the final total energy ratio (i.e. the one in the last cycle in the file).

  1. Click on the Anchor icon anchor_icon.png.
  2. Type for Anchor name LastCycle.
  3. Set the Origin to the End of the file and
  4. The Regular expression search Type is used.
  5. The search string is total energy.
  6. Select Backward as the search Direction from the origin.

 exp_genex_responses_11.png

  1. Define a new entity by clicking on the x-icon entity_icon.png.
  2. and type for Entity name Energy4900.
  3. The entity is found by using LastCycle as the Origin.
  4. and searching in the 5th column.

 exp_genex_responses_12.png

 

This completes the GenEx setup. Save the .g6 file.

 

Extracting Responses using created GENEX file

  1. On the LS-OPT GUI - Responses page select the GENEX response type on the left.
  2. Enter SWEner as the response Name.
  3. Open the Input GenEx file. A browse option is available. Importing the file will display the selected entities in the Entities box.
  4. Enter the input data file, namely d3hsp. This file must be available in the run directory during the LS-OPT run.
  5. Select the entity SWEner from the Entities box.
  6. Click on the OK button.

Repeat the procedure for the remaining three response entities, i.e. Yvelocity, InternalEnergy, Energy4900.

 

 exp_genex_responses_14.png

 

 LS-OPT can now be run and the response entities will be extracted for each simulation run.