2

I have written a UMAT subroutine in which I call a Python code of ABAQUS simulation.

st1=SYSTEM('abaqus cae noGUI="c:\temp\pycode.py"')

I need to pass some variables from Fortran to my Python code and bring back some other values from Python to Fortran. Now, I write those variables in text files and load them in Python and Fortran. By this way, I cannot parallelize my code since all the cores wants to write in a file at the same time.

RKM
  • 61
  • 2

1 Answers1

3

Arguments can be passed into the script by entering -- on the command line, followed by the arguments separated by one or more spaces. These arguments will be ignored by the Abaqus/CAE execution procedure, but they will be accessible within the script. Example: abaqus cae noGUI=pythonScript -- -passedToPythonScript.

For more information, see “Abaqus/CAE execution,” Section 3.2.6 of the Abaqus Analysis User's Guide

Miguel
  • 150
  • 2
  • 10
  • Thanks for your response. I have seen it in the manual. However, I do not know how to get back the results of my python code to my UMAT. – RKM Feb 01 '19 at 12:06
  • Passing back to Fortran is always a challenge. I don't think cae scripts are able to return anything. Using a file is the simplest way. Alternatively, you can create an always running server that responds to requests directly and that would solve your parallelism since once request gets one answer. – Miguel Feb 02 '19 at 13:16
  • Would you please elaborate the second way more? Since it is parallel, creating a file and reading it is not possible – RKM Feb 03 '19 at 14:08
  • 1
    Maybe check out [this](https://stackoverflow.com/questions/43334302/communication-between-two-separate-python-engines) – Daniel F Feb 04 '19 at 10:21
  • Daniel F's answer is exactly what I meant. – Miguel Feb 06 '19 at 16:03