Jump to content
Sign in to follow this  
stefan.schroeder

creating stress response with flexibel element range

Recommended Posts

hello


 


i would like to create an optimization approach in hyperstudy. i use a tcl-script based model file with parametrized geometry to generate my .fem model. the objective is to minimize the geometry till a certain stress level is reached. i define my stress response with the "max(resvector(...))" function.


this works well, but due to the changing geometry in the optimization approach, the script use a criteria-based automesh function to obtain a good element quality. as a result, the total number of elements varies and i get a error message "index out of range" for "resvector" if the number of elements are below the end_request arguement of the function. so i want to implement some kind of automated element range function (minimum to maximum element index) into the "resvector" function.


 


question: is it possible to include a dynamic range of elements into the "resvector" function?


[f.e. "resvector(file_name, type, 0 [start_request], maximum element index [end_request], ...)"]


 


greetings


stefan


 


 


Share this post


Link to post
Share on other sites

Hi Stefan


If you can create responses that gets the minimum element index and maximum element index, you can use these responses in your resvector definition such as


max(resvector(getenv("HST_APPROACH_RUN_PATH") + "/m_1/beam.h3d",1,0,r_6,0,0,0,1))


 


In this example, minimum element index is always 0 but maximum element index is another response (r_6). This response, r_6, in this case, reads the number of elements from the OptiStruct output file.


Hope this helps


Fatma


Share this post


Link to post
Share on other sites

Hello Stefan,

 

To add to the above reply from Fatma: you could define something like r_6 using a HyperMath function like:

 

function getNumReqs(fileName,type_index,subcase)
   s = GetSubcase(fileName,subcase+1)
   numReqs=s::GetNumReqs(type_index+1)    
   return numReqs    
end

 

This function can be registered for use in HyperStudy making it accesible just like any other function.  So for example after registering it, you would define r_6  to have the expression :

 

getNumReqs(getenv("HST_APPROACH_RUN_PATH") + "/m_1/beam.h3d",1,0) where 1 and 0 are the Type and Subcase referenced by resvector.

 

Thanks

 

Joe

Share this post


Link to post
Share on other sites

Hello Fatma and Joe

Thanks a lot for your help. My solution: As Fatma has been suggested, I create a new response (element_max) to get the maximum element index. For that purpose, I use the "ASCII Extracts" function in the expression builder, with the .out as file source (where I can find the total number of elements) and use the keyword "Elements                  :    " to define my response.

It´s then "max(resvector(getenv("HST_APPROACH_RUN_PATH")+"FILENAME",1,0, element_max-1,0,0,0,0))". -1 because the index starts with 0!

It´s not as pretty as Joe's hint, but it works fine for me.

Stefan

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...