Batch solving in Mecway

Hello! Quick question: What is the current recommended best practice for batch solving Mecway files?

I need to tune the contact coefficients for a hyperelastic simulation and figured it would be best done by trying out a few values in a batch solution.

It seems command line and python both might be options? Are there any pre-made scripts that I could download off the forum?

Comments

  • Set up a custom model input with *INCLUDE,file=input.inp.

    Click the appropriate CCX "don't includes" to suppress your contact commands

    Use Table to capture key outputs.

    Include a "save model to" as well.

    Create an input.inp that includes your contact commands.

    Run using Mecway command line solve

    Review results in CSV output

    With a little scripting, you can see that this has the makings of a black box that you can loop through.
  • More basic ways:

    A) The Python scripting is probably no use because you can't use it to set contact stiffness yet.

    B) Command line parameters

    Make a copy of the file for each parameter value like
    model1.liml
    model2.liml
    etc...

    In each one, add a Analysis -> new Save after solve with a unique filename.

    then from the models' directory, solve them all with

    \progra~1\mecway\mecway13\mecway model*.liml solve

    It's probably easier to edit the .liml files with a text editor to set the save filename and parameter values.


    C) Configurations
    Add a Edit -> New configuration for each parameter value, then select each configuration's tab in turn and create a contact with its parameters. By default, it'll be suppressed in all the other configurations. Then use Solution -> Solve all configurations. But beware the UI will freeze and it will look like it's crashed so keep an eye on the CCX files to see the progress instead.

    This puts all the solutions in the same file so be careful it doesn't get unwieldy if it's a big model with many time steps and configurations.

    Neither B or C really save any time, they just move the tedious work of setting parameters to the front so you can do it in a single sitting. JohnM's suggestion sounds like it would scale up easier to large number of parameters or doing this many times.
  • Excellent, thanks for the help John and Victor! In case I end up implementing any of these I'll come back and post more details.

    In my particular use case moving the tedious work of setting parameters to the front in a single sitting works since models take an hour or two to solve so far.
  • edited June 2020
    Here is a "kit" that should get anyone going with the batch trick.

    The attached model is a simple contact test that expects a file called input.inp.
    The model outputs a file called out.csv

    Create a run.bat using the following inputs:

    echo off
    echo *CONTACT PAIR,INTERACTION=SI_1,TYPE=SURFACE TO SURFACE > input.inp
    echo surf2,surf1 >> input.inp
    echo *SURFACE INTERACTION,NAME=SI_1 >> input.inp
    echo *SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR >> input.inp
    echo %1 >> input.inp

    "C:\Program Files\Mecway\Mecway13\mecway.exe" batchtrick.liml solve

    echo %1 >> summary.out
    type out.csv >> summary.out
    echo *END* >> summary.out

    That inputs are a simple modified cut-and-paste of the .inp file generated by Mecway:



    With batchtrick.liml and run.bat in the same directory, open a cmd window and execute:

    run.bat 2E9
    run.bat 2E10
    run.bat 2E11
    run.bat 2E12

    This will create summary.out

    2e9
    "Time step","Time","Node","external force Y"
    7,1,4,-6.98674
    7,1,8,-6.98674
    7,1,20,-14.8995 *END*
    2e10
    "Time step","Time","Node","external force Y"
    7,1,4,-37.1805
    7,1,8,-37.1805
    7,1,20,-79.2053 *END*
    2e11
    "Time step","Time","Node","external force Y"
    7,1,4,-66.2353
    7,1,8,-66.2353
    7,1,20,-139.919 *END*
    2e12
    "Time step","Time","Node","external force Y"
    7,1,4,-73.9428
    7,1,8,-73.9428
    7,1,20,-154.243 *END*



    This method is a basic starting point. It can be made very powerful once you get the hang of it.


  • edited August 2020
    Thanks for the help so far everyone. Just came back to this as I recently needed to do this again.
    \progra~1\mecway\mecway13\mecway model*.liml solve
    Just tested this and it works great for what I need to do, by the way.

    John I'm also trying to figure out your method because it looks like it might be really useful in the future. But I'm having a problem trying to get it to work.

    If I suppress all of these below and manually solve it in Mecway then I can get an out.csv file


    However if I unsuppress them and then try to solve it using "run.bat 2E9" from cmd, for example, it doesn't generate an out.csv file at all (and doesn't have a solution when I open it). Also tried "run.bat 2000000000", didn't seem to do anything.

    The .bat file I have has the following code:
    echo off echo *CONTACT PAIR,INTERACTION=SI_1,TYPE=SURFACE TO SURFACE > input.inp echo surf2,surf1 >> input.inp echo *SURFACE INTERACTION,NAME=SI_1 >> input.inp echo *SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR >> input.inp echo %1 >> input.inp "C:\Program Files\Mecway\Mecway13\mecway.exe" batchtrick.liml solve echo %1 >> summary.out type out.csv >> summary.out echo *END* >> summary.out

    The output when I run the above .bat file is as follows:
    echo off

    batchtrick.liml ... done
    Finished
    The system cannot find the file specified.

    And the generated input file has the following code:

    *CONTACT PAIR,INTERACTION=SI_1,TYPE=SURFACE TO SURFACE surf2,surf1 *SURFACE INTERACTION,NAME=SI_1 *SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR 2E9

    Do you know what might be the issue and how I could fix it? I've just used the same batchtrick.liml file from your post.

    Thanks a ton for your help so far, John and Victor!

  • edited August 2020
    I added the input file code directly to custom model definition and it seemed to work and generated an out.csv file, so I'm guessing that means it's an issue with the input file not being included properly.



    The custom model definition in the original model is:

    *INCLUDE,file=input.inp

    Ignore everything above, it seems to work fine now.

    AND... it turns out the issue was configuration specific to my machine, something about storing it in an unencrypted folder on an encrypted drive but without "entering the keys" made things go a bit wonky (even though I can normally access those files in other programs/through windows explorer).

    If someone else has issues running John's example I guess make sure the input file is accessible by Mecway. (Whoops...)

    Win some loose some, hah. Thanks for the help John and Victor!

  • edited August 2020
    Those last few posts were a fun read, and good to see a happy ending. I can relate to the trials that we have to go through to make things work sometimes

    For doing coefficient fitting with hyperelastic materials, I have found a neat (and free) piece of software that can be useful for this. It is called Optimax and it can be downloaded here:

    http://lace.fs.uni-mb.si/wordpress/borovinsek/?page_id=104

    Download the latest revision, and also the documentation. There is an example problem that shows how to determine the value of material properties to match a test. We use the same approach for matching test data to determine the C01 and C10 in hyperelastic models, it works great.

    We set up a model in Mecway, then save the CCX input file for use in Optimax. This hasn't replaced my run.bat approach, but it has its uses.
  • Hi John,

    That's really interesting, do you mean you perform experiments on parts that you have, recreate those experiments in Mecway, and use that to figure out the material coefficients C01 and C10?

    Would you be able to share an example?

    I contacted a few test labs and thought getting material samples tested was the only way to get the coefficients, but would be really excited if there's easier ways.

    I've been relying on the kindness of some stranger on a solidworks forum who uploaded an Excel sheet with coefficients that I've been using to get results that I would hope might be in some ballpark. I've attached it here in case it helps anyone in the future.
  • That's the exactly procedure, normally you should mold standard samples (cilinders about 32 diam and 18 in heigh if I remember well) with your specific rubber, then you measure on a dinamometer the load deflection curve in compresion. After that you setup the same model on FEA (using simetries to speed up the calculus) and run along some optimization software like Optimax or Abaqus I-Sight to find Mooney Ribbling coefficents (or other model you choose) comparing the measured vs computed load deflection curve. Then you can say that you have your compound characterizated, so you can model and predict the behavieur of a part made with that same compound.

    Take a look on the picture attached, the Optimax screen capture is the one used to made that analysis.
  • I will add to what Sergio said - if you do not have standard samples, use some version of the actual part (if available) and load in a similar fashion to the actual application.
    For example, an O-ring would be loaded in compression, but an inflatable membrane would be pressurized like a balloon, to simulate the biaxial tension. Then measure the load-deflection curve in test. You will likely need a load cell and/or a regulated pressure supply, and/or accurate deflection gage, depending on the test.

    Model this exact set-up in Mecway, capture the CCX input file and make variables out of your coefficients, then match curves using Optimax.

    Good luck!
  • Thank you, Sergio and John!!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!