RecurDyn and Particleworks Co-Simulation

RecurDyn, provided by FunctionBay, is an interdisciplinary, computer-aided engineering (CAE) software package whose primary function is the simulation of multibody dynamics (MBD). Particleworks, provided by Prometech, is a leading software for simulating the movement of fluids including large free surface deformation which is considered to be very difficult to simulate. Users can run a co-simulation between Particleworks and RecurDyn on the Rescale ScaleX platform by following the steps outlined in the tutorial below.

This tutorial will demonstrate running a co-simulation of RecurDyn and Particleworks in batch. The simulation used in this demonstration is to check the effect of piston behavior on the lubricant distribution in the engine. Approximately 50,000 particles were used.

Please contact us if you’re having trouble.

Engine
You can click on the Import job Setup button to clone this tutorial’s job setup or on the Get Job Results to share this tutorial’s completed job to your account.



Job Summary

Simulation CodeRecurDyn V9R1 – Particleworks 6.1
Analysis TypeMBD-Particle based CFD co-simulation
DescriptionA Simulation of lubricant behavior inside an engine
Suggested HardwareEmerald / 18 cores
Commandexport OMP_NUM_THREADS=18 export MPI_PROCS=$((RESCALE_CORES_PER_SLOT / (OMP_NUM_THREADS/2))) mpirun -machinefile $MACHINEFILE -n $MPI_PROCS app.solver.double -p $PWD/scene -k simd -n $OMP_NUM_THREADS –inter_proc_cmd=’rdsolver sampleEngineModel sampleEngineModel’
Estimated Run TimeAbout 1 hour

Generate Project File

To perform the co-simulation between RecurDyn and Particleworks on Rescale, you need to create a project suitable for command use. This process should be preceded with a model on Windows environment to allow you to analyze it using the Linux environment within Rescale.

RecurDyn Setting

  • To create sampleEngineModel.rmd, open sampleEngineModel.rdyn in the ‘scene’ folder and create .rmd file. Save the setting parameter of RecurDyn solver and export it from the RecurDyn model.
Exporting .rmd file
  • To create sampleEngineModel.rss – On the Analysis tab, click the Scenario and follow the process shown in the figure below to create an .rss file. The .rss file is a Simulation Scenario file, which contains information of the time required for simulation and data output interval.
Exporting .rss file
  • Both sampleEngineModel.rmd and sampleEngineModel.rss should be located in the scene folder.
  • Please refer the RecurDyn online help > Linux Standalone Solver for more information.

Particleworks Setting

  • Suspend Particleworks after it solely analyzes 1 step. Then project file/scene/sub.json is automatically created. The sub.json file contains variables for Particleworks.
  • Open the automatically generated project file/models/models.json. Then leave the file name as shown in the figure below after deleting the path of the cad file.
Change of cad file path

Job Setup

Login and Initial Screen

  • To start using Rescale, go to platform.rescale.com and log in using your account information.
  • After logging in, you can see the initial screen as below, and manage the jobs you already have or create a new job.
  • From the main screen of the platform, click on the +New Job button at the top left corner of your screen. This will take you to a Setup page.
Initial Screen
  • Zip the folder you created in the previous section To Generate a Project File locally and then upload the project file (*.zip) on Rescale.
Upload project file

Software Settings

  • Click Next to move on to the Software Settings section of the analysis.

Particleworks

  • After clicking the ‘Software’, search for ‘Particleworks’. Then, add it to the software configuration settings.
Adding particleworks
  • Note: For the co-simulation using commands, the commands for Particleworks control all commands including RecurDyn. This is essential for the correct use of the hardware and parallelization libraries required in the parallelization settings of Particleworks.
  • Now enter the commands for Particleworks as shown in the figure below. Commands for co-simulation between RecurDyn and Particleworks should be entered in the Particleworks command window. The explanation for the commands are given at the end of current section
Commands
  • Enter the path to the license that you have in the Licensing Options to connect the license server with the Rescale.

RecurDyn

  • Search for RecurDyn and add it to the software setting.
  • Comment out using # in Command window of Analysis Options (Ex: #rdsolver).
  • Enter the path to the license that you have in the License Options to connect the license server with Rescale.

Command Explanation

  • export OMP_NUM_THREADS=18: Defines the number of hardware threads used for variables of OMP_NUM_THREAD. For example, when using Intel Xeon E5-2655 v3 hardware for simulation, this hardware has 9 cores, and Rescale uses hyperthreading by default, therefore the number of threads is 18.
  • export MPI_PROCS=$((RESCALE_CORES_PER_SLOT / (OMP_NUM_THREADS/2))): Since parallelization of Particleworks is done by process unit (1 process means 1 node), the total number of processes should be entered in the command.
    The total number of cores can be loaded by using ‘RESCALE_CORES_PER_SLOT‘, Rescale’s own variable. This can be divided by the number of cores per node (OMP_NUM_THREADS / 2) to calculate the number of processes to be created.
  • mpirun -machinefile $MACHINEFILE -n $MPI_PROCS app.solver.double -p $PWD/scene -k simd -n $OMP_NUM_THREADS –inter_proc_cmd=’rdsolver sampleEngineModel sampleEngineModel’ :
  • mpirun: runs mpi
  • -machinefile $MACHINEFILE: loads the machine information registered in the cluster
  • -n $MPI_PROCS: the number of processes
  • app.solver.double: Particleworks solver with double precision (app.solver.float is used for single precision simulation)
  • -p $PWD/scene: working directory. For this demo, the operation is performed in the ‘scene’ folder, a subfolder of $PWD, which is the decompressed current location.
  • -k simd: CPU based parallelization execution (when GPU is used: -k cuda)
  • -n $OMP_NUM_THREADS: the number of threads to use per node
  • –inter_proc_cmd=‘***‘: details on the RecurDyn solver for co-simulation
  • rdsolver: RecurDyn Solver
  • sampleEngineModel: file name of *.rmd
  • sampleEngineModel: file name of *.rss

Please refer to Reference: 7.10 Command Line in Particleworks install path/Documents/UserManual.pdf for more information

Hardware Settings

  • Click the Hardware Settings button to select the appropriate hardware provided by Rescale.
Hardware settings
  • For this example , 18 cores on Emerald type is chosen.

Submitting the job

  • Click the Submit located on the upper right corner of the screen. Then, the simulation will proceed in the following order.
  • Click the Process_output.log in the ‘Live Tailing’ window. You can see the simulation log output in real time and the status message of the solver. All the output logs are the same as in a general Linux environment and can be used for the review in the same way.
Check output log

Results

  • Click the Results tab on the right. Click the Download Job to download the result files.
Result file download

본 데모에서 사용할 예제는, 리커다인과 파티클웍스의 연성 해석을 통해 엔진 내 피스톤 거동이 윤활유 분포에 미치는 영향을 확인하기 위한 시뮬레이션이며 약 5만개의 입자를 사용하였다.Engine
다음 링크를 클릭하면 작업 설정을 가져 오거나 Rescale의 플랫폼에서 직접 작업 결과를 가져올 수 있습니다.


작업 설정 가져 오기


직무 결과 얻기


작업 요약

소프트웨어RecurDyn V9R1 – Particleworks 6.1
분석 유형MBD-Particle based CFD co-simulation
기술A Simulation of lubricant behavior in engine
하드웨어Emerald / 18 cores
커맨드export OMP_NUM_THREADS=18 export MPI_PROCS=$((RESCALE_CORES_PER_SLOT / (OMP_NUM_THREADS/2))) mpirun -machinefile $MACHINEFILE -n $MPI_PROCS app.solver.double -p $PWD/scene -k simd -n $OMP_NUM_THREADS –inter_proc_cmd=’rdsolver sampleEngineModel sampleEngineModel’
시뮬레이션 시간약 1시간

프로젝트 생성하기

리스케일 환경에서 리커다인-파티클웍스 연성해석을 수행하기 위해 먼저 커맨드 사용에 적합한 프로젝트를 생성하여야 한다. 윈도우 환경의 모델에서 본 작업이 선행 되어야 리눅스 환경을 기반으로 하는 리스케일 플랫폼에서 해석이 가능하다.

RecurDyn 셋팅

  • sampleEngineModel.rmd을 생성한다.
    scene 폴더 내에 있는 sampleEngineModel.rdyn을 열어 rmd파일을 생성한다.
    *.rmd 파일 :RecurDyn 솔버의 셋팅파라미터 정보를 저장, RecurDyn 모델에서 export
Exporting .rmd file
  • sampleEngineModel.rss을 생성한다.
    Analysis탭에 있는 Scenario에서 아래 프로세스에 따라 rss파일을 생성한다.
    *.rss 파일: 시뮬레이션 시나리오 파일, 총 시뮬레이션 시간 및 데이터 출력간격 정보 포함
Exporting .rss file
  • sampleEngineModel.rmd파일과 sampleEngineModel.rss파일은 반드시 scene 폴더 내에 위치
  • 참고자료: RecurDyn online help > Linux Standalone Solver

Particleworks 셋팅

  • Particleworks 단독으로 1스텝 해석 후 정지시켜 자동으로 프로젝트/scene/sub.json 파일이 생성되게 한다. sub.json은 Particleworks의 변수 포함
  • 역시 자동으로 생성된 프로젝트/models/models.json 파일을 열어, 아래 그림과 같이 cad파일의 경로를 삭제하고 파일명만 남긴다.
Change of cad file path

리스케일에서 Job 셋팅

로그인 및 초기 화면

    • 로그인을 하면 아래와 같은 초기 화면을 볼 수 있고, 보유한 Job들을 관리하거나 새로운 작업을 생성 할 수 있다. ( kr.rescale.com )
    • 새로운 작업 생성 – 새 작업 버튼을 클릭하여 새로운 작업을 생성한다.
Initial Screen
  • ‘1. 프로젝트 파일 생성하기(Generate project file)’ 과정에서 작업한 폴더를 zip 포맷으로 압축한다. zip 형식으로 압축한 프로젝트 파일을 리스케일에 업로드한다
Upload project file

소프트웨어 설정

소프트웨어 설정 구성에서 파티클웍스 추가

  • 소프트웨어 선택 탭에서 ‘Particleworks’를 검색하여 추가한다.
Adding particleworks
  • 참고: 커맨드를 이용한 co-simulation의 경우 Particleworks 커맨드를 사용하여 리커다인을 포함한 모든 명령을 제어한다. 이는 Particleworks의 병렬화 셋팅에서 요구하는 하드웨어 및 병렬화 라이브러리를 정확히 사용하기 위해 필수적이다.
  • ‘분석 옵션’의 ‘Command’ 창에 co-simulation을 위한 커맨드를 입력한다.
Commands
  • ‘라이선스 옵션’에 보유한 라이선스의 경로를 입력하여 라이센스 서버와 리스케일을 연결한다.

소프트웨어 설정 구성에서 RecurDyn 추가

  • C-i 의 과정을 되풀이하여 RecurDyn을 소프트웨어에 추가한다.
  • ‘분석 옵션’의 Command 창에 ‘#’을 이용하여 주석 처리한다. (Ex: #rdsolver)
  • ‘라이선스 옵션’에 보유한 라이선스의 경로를 입력하여 라이센스 서버와 리스케일을 연결한다.

. 명령의 세부 사항

  • export OMP_NUM_THREADS=18: OMP_NUM_THREAD 변수에 사용할 하드웨어의 스레드 수를 저장한다. 예를 들어 해석에 Intel Xeon E5-2655 v3 하드웨어를 이용하는 경우, 이 하드웨어는 9개의 core를 가지고 있고, rescale은 기본적으로 하이퍼스레딩을 사용하기 때문에 thread의 수는 18이 된다.
  • Export: 변수를 저장한다
    export MPI_PROCS=$((RESCALE_CORES_PER_SLOT / (OMP_NUM_THREADS/2))) : 파티클웍스의 병렬화는 프로세스단위(1개의 프로세스는 1개의 노드를 의미)로 이루어지기 때문에 총 프로세스 개수를 커맨드에 입력해야 한다.
    리스케일의 자체변수인 RESCALE_CORES_PER_SLOT을 이용하여 총 core수를 불러올 수 있으며, 이를 각 노드당 코어 개수인 OMP_NUM_THREADS/2로 나누어 생성할 프로세스의 개수를 산정할 수 있다.
  • mpirun -machinefile $MACHINEFILE -n $MPI_PROCS app.solver.double -p $PWD/scene -k simd -n $OMP_NUM_THREADS –inter_proc_cmd=’rdsolver sampleEngineModel sampleEngineModel’
    • mpirun: mpi 실행
    • -machinefile $MACHINEFILE: 클러스터에 등록된 머신 정보를 입력
    • -n $MPI_PROCS: 프로세스 개수
    • app.solver.double: double precision을 사용하는 Particleworks의 솔버 (Single precision계산의 경우 app.solver.float 사용)
    • -p $PWD/scene: 작업디렉토리. 본 데모의 경우 압축이 해제된 현재위치인 $PWD의 하위폴더인 scene에서 작업이 수행됨
    • -k simd: cpu 병렬 연산 수행, GPU를 사용할 경우 ‘–k cuda’
    • -n $OMP_NUM_THREADS: 각 노드당 사용할 스레드 개수
    • –inter_proc_cmd=‘***‘: co-simulation에 사용할 리커다인 솔버 상세내용
    • rdsolver: 리커다인의 솔버
    • sampleEngineModel: rmd 파일명
    • sampleEngineModel: rss 파일명
  • 참고자료: Particleworks install path/Documents/UserManual.pdf 중 7.10 Command Line

하드웨어 설정

  • 하드웨어 설정 버튼을 클릭하여 리스케일에서 제공하는 하드웨어 중 적합한 장치를 선택할 수 있다.
Hardware settings
  • 이 예제의 경우 : 18 cores on Emerald

작업 저장 및 제출

  • 우측 상당에 위치한 ‘제출’을 클릭하면 아래와 같은 순서로 시뮬레이션이 진행된다.
  • ‘라이브 추적’ 창의 Process_output.log를 클릭한다. 실시간으로 출력되는 시뮬레이션 로그를 확인할 수 있으며, 이를 통하여 솔버의 상태 메시지 또한 확인할 수 있다. 출력되는 모든 로그는 일반적인 리눅스 환경과 동일하며 같은 방식으로 검토에 사용할 수 있다.
Check output log

결과 다운로드

  • 우측의 ‘결과’ 탭을 클릭한다. ‘Download job’을 클릭하여 전체 결과 파일을 다운받을 수 있다.
Result file download