Co-simulation launching of MPM-Agent + Script for FlowVision 3.11.01

FlowVision 3.11.01 obtained a new connector for linking to Abaqus. The new connector calls Abaqus CSE. This connector expands possibilities of direct coupling connector and has following advantages:

  • More flex settings of co-simulation;
  • Easier launching at cluster machines;
  • Introducing of additional programs into co-simulation;
  • Interaction with newest version of SIMULIA Abaqus.

Such advantages are realizing by Abaqus module: Abaqus CSE Director. But such approach has his own disadvantages:

  • Abaqus CSE Director requires configuration file for his work;
  • Complex launching of Abaqus which is not supporting by MPM-Agent of current FV version.

The problem of file generation was resolved. FlowVision creating file by user request. As input data FlowVision use Abaqus project which needed for connector creating.

Analysis launching by MPM-Agent has problems with commands which are transferring to Abaqus: are separated launching of Abaqus CSE Director and separated launching of project.

Script was created for resolving this problem and making launching of Abaqus more simple. This script taking data from FlowVision project and allows launching both type of connectors: Direct coupling and Co-simulation Engine.

Script as for Windows OS, as for Linux OS is attached to this paper for using.

Installation on Windows OS

  1. Place script ABQ.bat into directory with commands which are launching Abaqus. As example: C:\SIMULIA\Commands;
  2. Open script ABQ.bat by any text editor and set up variable ABQ. Variable ABQ should contain absolute path to command which will launching Abaqus;
           ABQ.bat
  3. Set up MPM-Agent by choosing script ABQ.bat into FvConfigurator;
           Configurator settings
  4. Launch MPM-Agent and use it!

Important notice: All parameters of simulation controls should be took in quotes. Simulation controls could be founded by following path: FlowVision project -> Preprocessor -> External connections -> Abaqus CSE/Abaqus Direct Coupling -> Simulation Controls. More about External connections: https://flowvisioncfd.com/webhelp/fven_31101/index.html?folderexternalconnections.htm

Installation on Linux OS

  1. Place script ABQ.sh into directory with commands which are launching Abaqus. As example: /var/DassaultSystems/SIMULIA/Commands;
  2. Open script ABQ.sh by any text editor and set up variable ABQ. Variable ABQ should contain absolute path to command which will launching Abaqus;
           ABQ.sh
  3. Use command chmod +x for ABQ.sh to give him more rights;
           chmod +x for ABQ.sh
  4. Set up MPM-Agent by specifying absolute path to the script ABQ.sh into file MpmAgent.cfg;
           MpmAgent.cfg settings
  5. Launch MPM-Agent and use it!

Scripts:

ABQ.bat


@echo off

set ABQ="C:\SIMULIA\Commands\abq2019.bat"
setlocal EnableDelayedExpansion
set JOB=0
set ASK_DELETE=0
set PORT=0
set OTHER=0
set n=0
set i=0

 

rem Array with variables creating
for %%a in (%*) do (
set ARR[!n!]=%%a
set /A n+=1
)

rem JOB, OLDJOB, PORT filling
:LOOP
if %i% lss %n% (
if "!ARR[%i%]!" equ "job" (
goto JOB
) else if "!ARR[%i%]!" equ "ask_delete" (
goto ASK_DELETE
) else if "!ARR[%i%]!" equ "port" (
goto PORT
) else (
goto OTHER1
)
:JOB
set /a i=%i%+1
set JOB=!ARR[%i%]!
goto LOOP
:ASK_DELETE
set /a i=%i%+1
set ASK_DELETE=!ARR[%i%]!
goto LOOP
:PORT
set /a i=%i%+1
set PORT=!ARR[%i%]!
goto LOOP
:OTHER1
set /a i=%i%+1
goto LOOP
)

set i=0
:LOOP2
if %i% lss %n% (
if "!ARR[%i%]!" equ "job" (
goto END2
) else if "!ARR[%i%]!" equ "ask_delete" (
goto END2
) else if "!ARR[%i%]!" equ "port" (
goto END2
) else if "!ARR[%i%]!" equ "%JOB%" (
goto END2
) else if "!ARR[%i%]!" equ "%ASK_DELETE%" (
goto END2
) else if "!ARR[%i%]!" equ "%PORT%" (
goto END2
) else (
goto OTHER2
)
:OTHER2
set OTHER=!ARR[%i%]!
:END2
set /a i=%i%+1
goto LOOP2
)

findstr "MULTIPHYSICS" %JOB%.inp >nul
if errorlevel 1 (goto DC) else (goto CSE)

if "%OTHER%" equ "" (
set OTHER=""
)

:CSE
echo call %ABQ% cse config=%JOB% listenerport=%PORT%
echo %ABQ% job=%JOB% %OTHER:~1,-1% ask_delete=%ASK_DELETE% csedirector=localhost:%PORT%
call %ABQ% cse config=%JOB% listenerport=%PORT%
%ABQ% job=%JOB% %OTHER:~1,-1% ask_delete=%ASK_DELETE% csedirector=localhost:%PORT%
goto exit

 

:DC
echo %ABQ% job=%JOB% %OTHER:~1,-1% ask_delete=%ASK_DELETE% port=%PORT%
%ABQ% job=%JOB% %OTHER:~1,-1% ask_delete=%ASK_DELETE% port=%PORT%
goto exit

:exit


 

 ABQ.sh


 #!/bin/sh

## set me up!!!
ABQ=/var/DassaultSystemes/SIMULIA/Commands/abq2019

 

line=$*
var=($line)
echo $line
IFS=' ' read -a myarray <<< "$line"

 

i="0"
while [ $i -lt ${#var[@]} ]; do
if echo ${myarray[$i]} | grep -q ^"job=";then
JOB=${myarray[$i]:4}
elif echo ${myarray[$i]} | grep -q ^"oldjob=";then
OLDJOB=${myarray[$i]:7}
elif echo ${myarray[$i]} | grep -q "port=";then
PORT=${myarray[$i]:5}
else
OTHER=$OTHER" "${myarray[$i]}
fi
i=$[$i+1]
done

if grep ^"*CO-SIMULATION, PROGRAM=MULTIPHYSICS" $JOB.inp || grep ^"*CO-SIMULATION, PROGRAM=multiphysics" $JOB.inp || grep ^"*CO-SIMULATION, PROGRAM=Multiphysics" $JOB.inp; then
$ABQ cse -config $JOB -listenerport $PORT
$ABQ -job $JOB -oldjob $OLDJOB -csedirector localhost:$PORT $OTHER
elif grep ^"*CO-SIMULATION, PROGRAM=DIRECT" $JOB.inp || grep ^"*CO-SIMULATION, PROGRAM=direct" $JOB.inp || grep ^"*CO-SIMULATION, PROGRAM=Direct" $JOB.inp; then
$ABQ -job $JOB -oldjob $OLDJOB -port $PORT $OTHER
fi

 

sleep 5

tail -f $JOB.log


 

Об авторе
Владимир Каширин
Author: Владимир Каширин
Инженер 3 категории
Экспертиза в областях: FSI, прочность, физика металлов, АЭС