Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
stressStraight/test.py
Go to the documentation of this file.
1# /opt/local/bin/python3.13 test.py
2import sys, string, os, time
3import numpy as np
4import matplotlib.pyplot as plt
5from matplotlib import cm
6plt.rcParams['text.usetex'] = True
7sys.path.append("../../python")
8from modlibUtils import *
9sys.path.append("../../build/tools/pyMoDELib")
10import pyMoDELib
11
12
15materialFile="../../Library/Materials/W.txt"
16mat=pyMoDELib.PolycrystallineMaterialBase(materialFile,300) # material object
17
18P0=np.array([0.0,0.0,0.0])
19P1=np.array([1.0,0.0,0.0])
20b=np.array([1.0,0.0,0.0])
21x=np.array([1.0,1.0,1.0])
22ss=pyMoDELib.StressStraight(mat,P0,P1,b,0.0)
23start_time = time.perf_counter() # Use perf_counter() for high resolution
24for i in range(0,10000000):
25 sigma=ss.stress(x)
26end_time = time.perf_counter()
27execution_time = end_time - start_time
28print(f"Execution time: {execution_time} seconds")
29print(sigma)