forked from matbinder/DAMASK-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulation_runner.py
More file actions
43 lines (30 loc) · 866 Bytes
/
simulation_runner.py
File metadata and controls
43 lines (30 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# coding: utf-8
# ## Simulation runer class
# Here the functions will create the geometry as vtr file for the simulations
# In[1]:
import damask
from damask import Geom
import numpy as np
import subprocess,shlex
import os
# In[2]:
class simulation():
def run(simulation_folder,geom,load):
"""
Run the DAMASK simulations.
Returns the returncode after the simulation is done.
Parameters
----------
simulation_folder : str
Path to the simulation folder
geom : str
Name of the geom file
load : str
Name of the load file
"""
cmd = f'DAMASK_grid -l {load} -g {geom}'
p = subprocess.Popen(cmd,shell=True)
while p.poll() == None:
p.poll()
return p.poll()