v0.14.0 |
First follow instruction here Running JupyterHub. Then select file in um_views/tutorial/vec-1/eigen_elastic.md
import pyvista as pv
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
um_view_dir='/mofem_install/um_view'
bin_dir=um_view_dir + '/bin'
working_dir=um_view_dir + '/tutorials/vec-1'
plt.rcParams['figure.figsize'] = [15, 10]
YoungModulus=207
nu=0.3
rho=7829
If you have mesh in native hd5 MOAB format, VTK, Cubit, gMesh, you can use such mesh directly. If you using mesh in MED format used by code-aster, you need to convert mesh into native MOAB hdf5 format.
#!cd {working_dir} && {bin_dir}/read_med \
#-med_file TET-2-0.med \
#-output_file fork-2-0.h5m;
!ls
README.md frequency_log out_eig_2.h5m.vtk part_mesh.h5m eigen_elastic.ipynb log out_eig_3.h5m screenshot_0.png eigen_elastic_2d mesh.cub out_eig_3.h5m.vtk screenshot_1.png eigen_elastic_3d out_eig_0.h5m out_eig_4.h5m screenshot_2.png fork-0-5.h5m out_eig_0.h5m.vtk out_eig_4.h5m.vtk screenshot_3.png fork-1-0.h5m out_eig_1.h5m out_part.vtk screenshot_4.png fork-2-0.h5m out_eig_1.h5m.vtk param_file.petsc fork-2-0_2parts.h5m out_eig_2.h5m part.h5m
If you would like run analysis on multiple-processors you need to partition mesh. You can do that using mofem tool to do that.
# Set number of processors
NumberOfCores=4
mesh_name='fork-2-0.h5m'
part_mesh='part_mesh.h5m'
# Parition mesh
!cd {working_dir} && {bin_dir}/mofem_part \
-my_file {mesh_name} \
-output_file {part_mesh} \
-nparts {NumberOfCores} -dim 3 -adj_dim 1
# Convert mesh to VTK format
!cd {working_dir} && {bin_dir}/mbconvert {part_mesh} out_part.vtk
# Print paritions
mesh = pv.read(working_dir+'/'+'out_part.vtk')
my_cmap = plt.cm.get_cmap("jet", 12)
mesh.plot(
show_grid=True,
show_edges=True,
scalars="PARALLEL_PARTITION",
smooth_shading=False,
cmap=my_cmap)
[0] <inform> MoFEM version 0.10.1 (MOAB 5.2.1 Petsc Release Version 3.11.4, Sep, 28, 2019 ) [0] <inform> git commit id SHA1-NOT FOUND [0] <inform> Local time: 2021-1-16 10:8:28 [0] <inform> UTC time: 2021-1-16 10:8:28 [0] <inform> [MeshsetsManager] read cubit meshset 12682136550675316737 type BLOCKSET UNKNOWNNAME msId 1 name TET-2-0.unv [0] <inform> [MeshsetsManager] read cubit meshset 12682136550675316738 type BLOCKSET UNKNOWNNAME msId 2 name EL_Section [0] <inform> [MeshsetsManager] read cubit meshset 12682136550675316739 type BLOCKSET UNKNOWNNAME msId 3 name N_Section [0] <inform> [mofem_part] meshset 12682136550675316737 type BLOCKSET UNKNOWNNAME msId 1 name TET-2-0.unv [0] <inform> [mofem_part] meshset 12682136550675316738 type BLOCKSET UNKNOWNNAME msId 2 name EL_Section [0] <inform> [mofem_part] meshset 12682136550675316739 type BLOCKSET UNKNOWNNAME msId 3 name N_Section [0] <inform> [ProblemsManager] Finite elements in problem: row lower 0 row upper 2111 nb. elems 2111 ( 2111 ) Read "part_mesh.h5m" Wrote "out_part.vtk"
[(109.13957213699392, 127.50957106699391, 110.63957213699392), (0.0, 18.36999893, 1.5), (0.0, 0.0, 1.0)]
# Approximation order
order=2
# Tolerance
Tol=1e-3
# Number of eigen values to calculate
numberOfValuesToCalulate=5
# Clean previous solution
!cd {working_dir} && rm -vf out_eig_*
# Log file
log_file='log'
# Running code
!cd {working_dir} && \
{bin_dir}/mpirun --allow-run-as-root -np {NumberOfCores} ./eigen_elastic_3d \
-file_name {part_mesh} -eps_monitor -order {order} \
-eps_pos_gen_non_hermitian -eps_ncv 400 \
-eps_tol {Tol} -eps_nev {numberOfValuesToCalulate} -log_no_color 2>&1 | tee {log_file}
removed 'out_eig_0.h5m' removed 'out_eig_0.h5m.vtk' removed 'out_eig_1.h5m' removed 'out_eig_1.h5m.vtk' removed 'out_eig_2.h5m' removed 'out_eig_2.h5m.vtk' removed 'out_eig_3.h5m' removed 'out_eig_3.h5m.vtk' removed 'out_eig_4.h5m' removed 'out_eig_4.h5m.vtk' [0] <inform> MoFEM version 0.10.1 (MOAB 5.2.1 Petsc Release Version 3.11.4, Sep, 28, 2019 ) [0] <inform> git commit id SHA1-NOT FOUND [0] <inform> Local time: 2021-1-16 10:8:32 [0] <inform> UTC time: 2021-1-16 10:8:32 [0] <inform> [example] Read mesh for problem in 3 [0] <inform> [MeshsetsManager] read cubit meshset 12682136550675316738 type BLOCKSET UNKNOWNNAME msId 1 name TET-2-0.unv [0] <inform> [MeshsetsManager] read cubit meshset 12682136550675316739 type BLOCKSET UNKNOWNNAME msId 2 name EL_Section [0] <inform> [MeshsetsManager] read cubit meshset 12682136550675316740 type BLOCKSET UNKNOWNNAME msId 3 name N_Section [0] <inform> [FieldCore] Add field U field_id 1 space H1 approximation base AINSWORTH_BERNSTEIN_BEZIER_BASE rank 3 meshset 12682136550675316743 [0] <inform> [FECore] Add finite element dFE [0] <inform> [ProblemCore] Add problem SimpleProblem [0] <inform> [FieldCore] Number of dofs 3258 [1] <inform> [FieldCore] Number of dofs 3366 [2] <inform> [FieldCore] Number of dofs 3417 [3] <inform> [FieldCore] Number of dofs 3408 [0] <inform> [FECore] Finite element dFE added. Nb. of elements added 513 [1] <inform> [FECore] Finite element dFE added. Nb. of elements added 523 [2] <inform> [FECore] Finite element dFE added. Nb. of elements added 538 [3] <inform> [FECore] Finite element dFE added. Nb. of elements added 537 [0] <inform> [FECore] Number of adjacencies 5130 [0] <inform> [ProblemsManager] SimpleProblem Nb. local dof 3258 by 3258 nb global dofs 13131 by 13131 [1] <inform> [ProblemsManager] SimpleProblem Nb. local dof 3291 by 3291 nb global dofs 13131 by 13131 [2] <inform> [ProblemsManager] SimpleProblem Nb. local dof 3249 by 3249 nb global dofs 13131 by 13131 [3] <inform> [ProblemsManager] SimpleProblem Nb. local dof 3333 by 3333 nb global dofs 13131 by 13131 [0] <inform> [ProblemsManager] FEs ghost dofs on problem SimpleProblem Nb. ghost dof 0 by 0 Nb. local dof 3258 by 3258 [1] <inform> [ProblemsManager] FEs ghost dofs on problem SimpleProblem Nb. ghost dof 75 by 75 Nb. local dof 3291 by 3291 [2] <inform> [ProblemsManager] FEs ghost dofs on problem SimpleProblem Nb. ghost dof 168 by 168 Nb. local dof 3249 by 3249 [3] <inform> [ProblemsManager] FEs ghost dofs on problem SimpleProblem Nb. ghost dof 75 by 75 Nb. local dof 3333 by 3333 [0] <inform> [petsc] 1 EPS nconv=0 first unconverged value (error) 8.16564e+10 (8.00140413e+00) [0] <inform> [petsc] 2 EPS nconv=0 first unconverged value (error) 6.34804e+10 (7.52369510e+00) [0] <inform> [petsc] 3 EPS nconv=0 first unconverged value (error) 5.05937e+10 (9.44028047e+00) [0] <inform> [petsc] 4 EPS nconv=0 first unconverged value (error) 4.07374e+10 (1.07320571e+01) [0] <inform> [petsc] 5 EPS nconv=0 first unconverged value (error) 3.3807e+10 (8.67264660e+00) [0] <inform> [petsc] 6 EPS nconv=0 first unconverged value (error) 3.08233e+10 (6.65407561e+00) [0] <inform> [petsc] 7 EPS nconv=0 first unconverged value (error) 2.92339e+10 (5.26661474e+00) [0] <inform> [petsc] 8 EPS nconv=0 first unconverged value (error) 2.80254e+10 (5.42268536e+00) [0] <inform> [petsc] 9 EPS nconv=0 first unconverged value (error) 2.70057e+10 (4.99549582e+00) [0] <inform> [petsc] 10 EPS nconv=0 first unconverged value (error) 2.60223e+10 (5.77556626e+00) [0] <inform> [petsc] 11 EPS nconv=0 first unconverged value (error) 2.49414e+10 (5.75554904e+00) [0] <inform> [petsc] 12 EPS nconv=0 first unconverged value (error) 2.36983e+10 (7.37731077e+00) [0] <inform> [petsc] 13 EPS nconv=0 first unconverged value (error) 2.27423e+10 (5.42853520e+00) [0] <inform> [petsc] 14 EPS nconv=0 first unconverged value (error) 2.16978e+10 (7.09649055e+00) [0] <inform> [petsc] 15 EPS nconv=0 first unconverged value (error) 2.02886e+10 (9.52849525e+00) [0] <inform> [petsc] 16 EPS nconv=0 first unconverged value (error) 1.76519e+10 (1.46419639e+01) [0] <inform> [petsc] 17 EPS nconv=0 first unconverged value (error) 1.52271e+10 (1.48311035e+01) [0] <inform> [petsc] 18 EPS nconv=0 first unconverged value (error) 1.25997e+10 (1.72160482e+01) [0] <inform> [petsc] 19 EPS nconv=0 first unconverged value (error) 1.07157e+10 (1.72726159e+01) [0] <inform> [petsc] 20 EPS nconv=0 first unconverged value (error) 9.43234e+09 (1.45393518e+01) [0] <inform> [petsc] 21 EPS nconv=0 first unconverged value (error) 8.83368e+09 (1.36501733e+01) [0] <inform> [petsc] 22 EPS nconv=0 first unconverged value (error) 8.27393e+09 (1.32761676e+01) [0] <inform> [petsc] 23 EPS nconv=0 first unconverged value (error) 7.74814e+09 (1.39217096e+01) [0] <inform> [petsc] 24 EPS nconv=0 first unconverged value (error) 7.32713e+09 (1.45282752e+01) [0] <inform> [petsc] 25 EPS nconv=0 first unconverged value (error) 6.94071e+09 (1.28789100e+01) [0] <inform> [petsc] 26 EPS nconv=0 first unconverged value (error) 6.4288e+09 (1.65027556e+01) [0] <inform> [petsc] 27 EPS nconv=0 first unconverged value (error) 5.95522e+09 (1.68963229e+01) [0] <inform> [petsc] 28 EPS nconv=0 first unconverged value (error) 5.56099e+09 (1.59461111e+01) [0] <inform> [petsc] 29 EPS nconv=0 first unconverged value (error) 5.30861e+09 (1.41399333e+01) [0] <inform> [petsc] 30 EPS nconv=0 first unconverged value (error) 5.10237e+09 (1.32570201e+01) [0] <inform> [petsc] 31 EPS nconv=0 first unconverged value (error) 4.91286e+09 (1.28996437e+01) [0] <inform> [petsc] 32 EPS nconv=0 first unconverged value (error) 4.66685e+09 (1.78503421e+01) [0] <inform> [petsc] 33 EPS nconv=0 first unconverged value (error) 4.37763e+09 (1.76398865e+01) [0] <inform> [petsc] 34 EPS nconv=0 first unconverged value (error) 4.12314e+09 (1.93596102e+01) [0] <inform> [petsc] 35 EPS nconv=0 first unconverged value (error) 3.85499e+09 (1.80279424e+01) [0] <inform> [petsc] 36 EPS nconv=0 first unconverged value (error) 3.66073e+09 (1.88327934e+01) [0] <inform> [petsc] 37 EPS nconv=0 first unconverged value (error) 3.47288e+09 (1.80050764e+01) [0] <inform> [petsc] 38 EPS nconv=0 first unconverged value (error) 3.32409e+09 (1.72181580e+01) [0] <inform> [petsc] 39 EPS nconv=0 first unconverged value (error) 3.20969e+09 (1.51052513e+01) [0] <inform> [petsc] 40 EPS nconv=0 first unconverged value (error) 3.11437e+09 (1.56101961e+01) [0] <inform> [petsc] 41 EPS nconv=0 first unconverged value (error) 3.00574e+09 (1.54790969e+01) [0] <inform> [petsc] 42 EPS nconv=0 first unconverged value (error) 2.89822e+09 (1.69267390e+01) [0] <inform> [petsc] 43 EPS nconv=0 first unconverged value (error) 2.82576e+09 (1.21208315e+01) [0] <inform> [petsc] 44 EPS nconv=0 first unconverged value (error) 2.75111e+09 (1.51716951e+01) [0] <inform> [petsc] 45 EPS nconv=0 first unconverged value (error) 2.6857e+09 (1.45009857e+01) [0] <inform> [petsc] 46 EPS nconv=0 first unconverged value (error) 2.62622e+09 (1.59317833e+01) [0] <inform> [petsc] 47 EPS nconv=0 first unconverged value (error) 2.52399e+09 (2.25794526e+01) [0] <inform> [petsc] 48 EPS nconv=0 first unconverged value (error) 2.40758e+09 (2.14751525e+01) [0] <inform> [petsc] 49 EPS nconv=0 first unconverged value (error) 2.30532e+09 (2.32890883e+01) [0] <inform> [petsc] 50 EPS nconv=0 first unconverged value (error) 2.14104e+09 (3.38727232e+01) [0] <inform> [petsc] 51 EPS nconv=0 first unconverged value (error) 1.94286e+09 (3.07761688e+01) [0] <inform> [petsc] 52 EPS nconv=0 first unconverged value (error) 1.80014e+09 (3.18633543e+01) [0] <inform> [petsc] 53 EPS nconv=0 first unconverged value (error) 1.69713e+09 (2.26664689e+01) [0] <inform> [petsc] 54 EPS nconv=0 first unconverged value (error) 1.63388e+09 (2.43214243e+01) [0] <inform> [petsc] 55 EPS nconv=0 first unconverged value (error) 1.5872e+09 (1.77156937e+01) [0] <inform> [petsc] 56 EPS nconv=0 first unconverged value (error) 1.53218e+09 (2.87046953e+01) [0] <inform> [petsc] 57 EPS nconv=0 first unconverged value (error) 1.46035e+09 (2.57834836e+01) [0] <inform> [petsc] 58 EPS nconv=0 first unconverged value (error) 1.37543e+09 (3.60551039e+01) [0] <inform> [petsc] 59 EPS nconv=0 first unconverged value (error) 1.31015e+09 (2.75643854e+01) [0] <inform> [petsc] 60 EPS nconv=0 first unconverged value (error) 1.25831e+09 (2.50889746e+01) [0] <inform> [petsc] 61 EPS nconv=0 first unconverged value (error) 1.22825e+09 (2.61778006e+01) [0] <inform> [petsc] 62 EPS nconv=0 first unconverged value (error) 1.19406e+09 (2.26275429e+01) [0] <inform> [petsc] 63 EPS nconv=0 first unconverged value (error) 1.15771e+09 (2.58171129e+01) [0] <inform> [petsc] 64 EPS nconv=0 first unconverged value (error) 1.11848e+09 (2.66648751e+01) [0] <inform> [petsc] 65 EPS nconv=0 first unconverged value (error) 1.0822e+09 (2.95068268e+01) [0] <inform> [petsc] 66 EPS nconv=0 first unconverged value (error) 1.03906e+09 (3.17283391e+01) [0] <inform> [petsc] 67 EPS nconv=0 first unconverged value (error) 1.00015e+09 (2.80736885e+01) [0] <inform> [petsc] 68 EPS nconv=0 first unconverged value (error) 9.79033e+08 (2.06620452e+01) [0] <inform> [petsc] 69 EPS nconv=0 first unconverged value (error) 9.51777e+08 (2.81182097e+01) [0] <inform> [petsc] 70 EPS nconv=0 first unconverged value (error) 9.18942e+08 (3.10058641e+01) [0] <inform> [petsc] 71 EPS nconv=0 first unconverged value (error) 8.93031e+08 (3.09565362e+01) [0] <inform> [petsc] 72 EPS nconv=0 first unconverged value (error) 8.69821e+08 (2.66965380e+01) [0] <inform> [petsc] 73 EPS nconv=0 first unconverged value (error) 8.51224e+08 (2.27433114e+01) [0] <inform> [petsc] 74 EPS nconv=0 first unconverged value (error) 8.38791e+08 (1.83565904e+01) [0] <inform> [petsc] 75 EPS nconv=0 first unconverged value (error) 8.2673e+08 (2.33098001e+01) [0] <inform> [petsc] 76 EPS nconv=0 first unconverged value (error) 8.12996e+08 (2.25958993e+01) [0] <inform> [petsc] 77 EPS nconv=0 first unconverged value (error) 7.99661e+08 (2.41445748e+01) [0] <inform> [petsc] 78 EPS nconv=0 first unconverged value (error) 7.88321e+08 (2.05269925e+01) [0] <inform> [petsc] 79 EPS nconv=0 first unconverged value (error) 7.76374e+08 (2.29332852e+01) [0] <inform> [petsc] 80 EPS nconv=0 first unconverged value (error) 7.64047e+08 (2.36462228e+01) [0] <inform> [petsc] 81 EPS nconv=0 first unconverged value (error) 7.51932e+08 (2.34671013e+01) [0] <inform> [petsc] 82 EPS nconv=0 first unconverged value (error) 7.39763e+08 (2.05394103e+01) [0] <inform> [petsc] 83 EPS nconv=0 first unconverged value (error) 7.31031e+08 (2.17396550e+01) [0] <inform> [petsc] 84 EPS nconv=0 first unconverged value (error) 7.22734e+08 (2.00193449e+01) [0] <inform> [petsc] 85 EPS nconv=0 first unconverged value (error) 7.15613e+08 (1.93055809e+01) [0] <inform> [petsc] 86 EPS nconv=0 first unconverged value (error) 7.0721e+08 (1.72389636e+01) [0] <inform> [petsc] 87 EPS nconv=0 first unconverged value (error) 6.9915e+08 (2.28755919e+01) [0] <inform> [petsc] 88 EPS nconv=0 first unconverged value (error) 6.86131e+08 (2.88059849e+01) [0] <inform> [petsc] 89 EPS nconv=0 first unconverged value (error) 6.71598e+08 (2.60957147e+01) [0] <inform> [petsc] 90 EPS nconv=0 first unconverged value (error) 6.61111e+08 (2.11638220e+01) [0] <inform> [petsc] 91 EPS nconv=0 first unconverged value (error) 6.53722e+08 (2.38040679e+01) [0] <inform> [petsc] 92 EPS nconv=0 first unconverged value (error) 6.46609e+08 (1.78252601e+01) [0] <inform> [petsc] 93 EPS nconv=0 first unconverged value (error) 6.41569e+08 (2.09769807e+01) [0] <inform> [petsc] 94 EPS nconv=0 first unconverged value (error) 6.33812e+08 (2.07464863e+01) [0] <inform> [petsc] 95 EPS nconv=0 first unconverged value (error) 6.25192e+08 (2.37392280e+01) [0] <inform> [petsc] 96 EPS nconv=0 first unconverged value (error) 6.20295e+08 (1.31835592e+01) [0] <inform> [petsc] 97 EPS nconv=0 first unconverged value (error) 6.17928e+08 (1.30119584e+01) [0] <inform> [petsc] 98 EPS nconv=0 first unconverged value (error) 6.14638e+08 (1.58902335e+01) [0] <inform> [petsc] 99 EPS nconv=0 first unconverged value (error) 6.11474e+08 (1.64392248e+01) [0] <inform> [petsc] 100 EPS nconv=0 first unconverged value (error) 6.08901e+08 (1.32212252e+01) [0] <inform> [petsc] 101 EPS nconv=0 first unconverged value (error) 6.06236e+08 (1.45362525e+01) [0] <inform> [petsc] 102 EPS nconv=0 first unconverged value (error) 6.03656e+08 (1.22454445e+01) [0] <inform> [petsc] 103 EPS nconv=0 first unconverged value (error) 6.01063e+08 (1.51668238e+01) [0] <inform> [petsc] 104 EPS nconv=0 first unconverged value (error) 5.9785e+08 (1.17323678e+01) [0] <inform> [petsc] 105 EPS nconv=0 first unconverged value (error) 5.95183e+08 (1.50589169e+01) [0] <inform> [petsc] 106 EPS nconv=0 first unconverged value (error) 5.91399e+08 (1.36997070e+01) [0] <inform> [petsc] 107 EPS nconv=0 first unconverged value (error) 5.87496e+08 (1.95909302e+01) [0] <inform> [petsc] 108 EPS nconv=0 first unconverged value (error) 5.83566e+08 (1.45806535e+01) [0] <inform> [petsc] 109 EPS nconv=0 first unconverged value (error) 5.78536e+08 (1.75293399e+01) [0] <inform> [petsc] 110 EPS nconv=0 first unconverged value (error) 5.76348e+08 (1.14783066e+01) [0] <inform> [petsc] 111 EPS nconv=0 first unconverged value (error) 5.73104e+08 (2.43208213e+01) [0] <inform> [petsc] 112 EPS nconv=0 first unconverged value (error) 5.6584e+08 (2.24539042e+01) [0] <inform> [petsc] 113 EPS nconv=0 first unconverged value (error) 5.60847e+08 (2.23105814e+01) [0] <inform> [petsc] 114 EPS nconv=0 first unconverged value (error) 5.57646e+08 (1.22002323e+01) [0] <inform> [petsc] 115 EPS nconv=0 first unconverged value (error) 5.54676e+08 (1.21853447e+01) [0] <inform> [petsc] 116 EPS nconv=0 first unconverged value (error) 5.52594e+08 (1.39495095e+01) [0] <inform> [petsc] 117 EPS nconv=0 first unconverged value (error) 5.48842e+08 (1.57073298e+01) [0] <inform> [petsc] 118 EPS nconv=0 first unconverged value (error) 5.47299e+08 (1.02627248e+01) [0] <inform> [petsc] 119 EPS nconv=0 first unconverged value (error) 5.43803e+08 (1.60990150e+01) [0] <inform> [petsc] 120 EPS nconv=0 first unconverged value (error) 5.40468e+08 (1.66562689e+01) [0] <inform> [petsc] 121 EPS nconv=0 first unconverged value (error) 5.3826e+08 (1.32630723e+01) [0] <inform> [petsc] 122 EPS nconv=0 first unconverged value (error) 5.35028e+08 (1.57421280e+01) [0] <inform> [petsc] 123 EPS nconv=0 first unconverged value (error) 5.29796e+08 (2.36474776e+01) [0] <inform> [petsc] 124 EPS nconv=0 first unconverged value (error) 5.24572e+08 (2.13980203e+01) [0] <inform> [petsc] 125 EPS nconv=0 first unconverged value (error) 5.19629e+08 (1.80552770e+01) [0] <inform> [petsc] 126 EPS nconv=0 first unconverged value (error) 5.14438e+08 (2.49143773e+01) [0] <inform> [petsc] 127 EPS nconv=0 first unconverged value (error) 5.09882e+08 (2.07948335e+01) [0] <inform> [petsc] 128 EPS nconv=0 first unconverged value (error) 4.91669e+08 (4.32850657e+01) [0] <inform> [petsc] 129 EPS nconv=0 first unconverged value (error) 4.69907e+08 (3.60075641e+01) [0] <inform> [petsc] 130 EPS nconv=0 first unconverged value (error) 4.57525e+08 (4.51393315e+01) [0] <inform> [petsc] 131 EPS nconv=0 first unconverged value (error) 4.36606e+08 (4.93245694e+01) [0] <inform> [petsc] 132 EPS nconv=0 first unconverged value (error) 4.24577e+08 (4.03276711e+01) [0] <inform> [petsc] 133 EPS nconv=0 first unconverged value (error) 4.17314e+08 (3.10715648e+01) [0] <inform> [petsc] 134 EPS nconv=0 first unconverged value (error) 4.01679e+08 (5.84906278e+01) [0] <inform> [petsc] 135 EPS nconv=0 first unconverged value (error) 3.78868e+08 (4.00989454e+01) [0] <inform> [petsc] 136 EPS nconv=0 first unconverged value (error) 3.70886e+08 (5.54452228e+01) [0] <inform> [petsc] 137 EPS nconv=0 first unconverged value (error) 3.57074e+08 (2.46856245e+01) [0] <inform> [petsc] 138 EPS nconv=0 first unconverged value (error) 3.47616e+08 (4.45813018e+01) [0] <inform> [petsc] 139 EPS nconv=0 first unconverged value (error) 3.44987e+08 (3.21964922e+01) [0] <inform> [petsc] 140 EPS nconv=0 first unconverged value (error) 3.41732e+08 (4.17960788e+01) [0] <inform> [petsc] 141 EPS nconv=0 first unconverged value (error) 3.39514e+08 (1.40066745e+01) [0] <inform> [petsc] 142 EPS nconv=0 first unconverged value (error) 3.38279e+08 (1.06239584e+01) [0] <inform> [petsc] 143 EPS nconv=0 first unconverged value (error) 3.27675e+08 (1.55864333e+01) [0] <inform> [petsc] 144 EPS nconv=0 first unconverged value (error) 3.20068e+08 (8.35157138e+01) [0] <inform> [petsc] 145 EPS nconv=0 first unconverged value (error) 3.14893e+08 (4.59888001e+01) [0] <inform> [petsc] 146 EPS nconv=0 first unconverged value (error) 2.94604e+08 (1.72518006e+01) [0] <inform> [petsc] 147 EPS nconv=0 first unconverged value (error) 2.87463e+08 (2.03906396e+01) [0] <inform> [petsc] 148 EPS nconv=0 first unconverged value (error) 2.84764e+08 (7.56355211e+01) [0] <inform> [petsc] 149 EPS nconv=0 first unconverged value (error) 2.81916e+08 (1.57282048e+01) [0] <inform> [petsc] 150 EPS nconv=0 first unconverged value (error) 2.71112e+08 (1.12722930e+01) [0] <inform> [petsc] 151 EPS nconv=0 first unconverged value (error) 2.68402e+08 (9.39117326e+01) [0] <inform> [petsc] 152 EPS nconv=0 first unconverged value (error) 2.52861e+08 (3.87710774e+00) [0] <inform> [petsc] 153 EPS nconv=0 first unconverged value (error) 2.45479e+08 (8.22672074e+01) [0] <inform> [petsc] 154 EPS nconv=0 first unconverged value (error) 2.4402e+08 (6.71449973e+00) [0] <inform> [petsc] 155 EPS nconv=0 first unconverged value (error) 2.22261e+08 (8.64522661e+01) [0] <inform> [petsc] 156 EPS nconv=0 first unconverged value (error) 2.18919e+08 (4.14738583e+01) [0] <inform> [petsc] 157 EPS nconv=0 first unconverged value (error) 1.77143e+08 (2.49146494e+01) [0] <inform> [petsc] 158 EPS nconv=0 first unconverged value (error) 1.76027e+08 (7.78225754e+01) [0] <inform> [petsc] 159 EPS nconv=0 first unconverged value (error) 1.54635e+08 (6.16190244e+00) [0] <inform> [petsc] 160 EPS nconv=0 first unconverged value (error) 1.53784e+08 (1.31876144e+02) [0] <inform> [petsc] 161 EPS nconv=0 first unconverged value (error) 1.32562e+08 (1.18476177e+01) [0] <inform> [petsc] 162 EPS nconv=0 first unconverged value (error) 1.32414e+08 (6.52037295e+01) [0] <inform> [petsc] 163 EPS nconv=0 first unconverged value (error) 1.31083e+08 (2.27010545e+00) [0] <inform> [petsc] 164 EPS nconv=0 first unconverged value (error) 1.28334e+08 (3.59310750e+02) [0] <inform> [petsc] 165 EPS nconv=0 first unconverged value (error) 1.07004e+08 (6.92875839e+00) [0] <inform> [petsc] 166 EPS nconv=0 first unconverged value (error) 1.05367e+08 (3.12350834e+02) [0] <inform> [petsc] 167 EPS nconv=0 first unconverged value (error) 8.33183e+07 (1.53292055e+01) [0] <inform> [petsc] 168 EPS nconv=0 first unconverged value (error) 8.32838e+07 (2.05770749e+01) [0] <inform> [petsc] 169 EPS nconv=0 first unconverged value (error) 4.10722e+07 (7.73469020e+02) [0] <inform> [petsc] 170 EPS nconv=0 first unconverged value (error) 1.13788e+07 (1.48707683e+02) [0] <inform> [petsc] 171 EPS nconv=0 first unconverged value (error) 1.13453e+07 (1.45382299e+02) [0] <inform> [petsc] 172 EPS nconv=0 first unconverged value (error) 9.71171e+06 (1.13824145e+02) [0] <inform> [petsc] 173 EPS nconv=0 first unconverged value (error) 9.70381e+06 (1.75347388e+01) [0] <inform> [petsc] 174 EPS nconv=0 first unconverged value (error) 9.15406e+06 (5.55019931e+02) [0] <inform> [petsc] 175 EPS nconv=0 first unconverged value (error) 8.90476e+06 (8.22383757e+00) [0] <inform> [petsc] 176 EPS nconv=0 first unconverged value (error) 8.89561e+06 (2.03074352e+02) [0] <inform> [petsc] 177 EPS nconv=0 first unconverged value (error) 7.89382e+06 (8.43490204e+01) [0] <inform> [petsc] 178 EPS nconv=0 first unconverged value (error) 7.88675e+06 (3.00213563e+00) [0] <inform> [petsc] 179 EPS nconv=0 first unconverged value (error) 7.88674e+06 (4.47176775e+00) [0] <inform> [petsc] 180 EPS nconv=0 first unconverged value (error) 7.84841e+06 (2.89973609e+02) [0] <inform> [petsc] 181 EPS nconv=0 first unconverged value (error) 7.78857e+06 (5.36462220e+00) [0] <inform> [petsc] 182 EPS nconv=0 first unconverged value (error) 7.78855e+06 (8.24029483e-02) [0] <inform> [petsc] 183 EPS nconv=1 first unconverged value (error) 1.82775e+07 (2.27641007e-03) [0] <inform> [petsc] 184 EPS nconv=243 first unconverged value (error) 1.12214e+13 (2.77711362e-03) [0] <inform> [example] Number of iterations of the method: 184 [0] <inform> [example] Solution method: krylovschur [0] <inform> [example] Number of requested eigenvalues: 5 [0] <inform> [example] Stopping condition: tol=0.001, maxit=500 [0] <inform> [example] ncov = 0 eigr = 7.789e+06 eigi = 0 (inv eigr = 1.284e-07) [0] <inform> [example] ncov = 1 eigr = 1.828e+07 eigi = 0 (inv eigr = 5.471e-08) [0] <inform> [example] ncov = 2 eigr = 1.132e+08 eigi = 0 (inv eigr = 8.832e-09) [0] <inform> [example] ncov = 3 eigr = 1.322e+08 eigi = 0 (inv eigr = 7.566e-09) [0] <inform> [example] ncov = 4 eigr = 3.088e+08 eigi = 0 (inv eigr = 3.239e-09) [0] <inform> [example] ncov = 0 omega2 = 7788553.8 omega = 2790.7981 frequency = 444.16931 [0] <inform> [example] ncov = 1 omega2 = 18277493 omega = 4275.2184 frequency = 680.42215 [0] <inform> [example] ncov = 2 omega2 = 1.1322031e+08 omega = 10640.503 frequency = 1693.4887 [0] <inform> [example] ncov = 3 omega2 = 1.3217266e+08 omega = 11496.637 frequency = 1829.7466 [0] <inform> [example] ncov = 4 omega2 = 3.087528e+08 omega = 17571.363 frequency = 2796.5693
# Get frequencies
frequency_log='frequency_log'
!cd {working_dir} && grep "frequency" {log_file} > {frequency_log}
frequencies_data=pd.read_csv(working_dir+"/"+frequency_log,sep='\s+',header=None)
frequencies=frequencies_data[14].to_numpy()
print(frequencies)
for f in zip(range(1,numberOfValuesToCalulate+1),frequencies):
print('Mode ',f[0],' frequency ',f[1],' Hz')
plt.barh(range(1,numberOfValuesToCalulate+1), frequencies, align='center')
plt.xlabel('Frequency [Hz]')
plt.ylabel('Vibration mode')
[ 444.16931 680.42215 1693.4887 1829.7466 2796.5693 ] Mode 1 frequency 444.16931 Hz Mode 2 frequency 680.42215 Hz Mode 3 frequency 1693.4887 Hz Mode 4 frequency 1829.7466 Hz Mode 5 frequency 2796.5693 Hz
Text(0, 0.5, 'Vibration mode')
# Convert files to VTK
out_files=!ls out_eig_*.h5m
for f in out_files:
!cd {working_dir} && {bin_dir}/mbconvert {f} {f}'.vtk'
for f in range(0,numberOfValuesToCalulate):
plot_mode=f
plot_file=('%s/out_eig_%d.h5m.vtk') % (working_dir,plot_mode)
print(plot_file)
mesh = pv.read(plot_file)
my_cmap = plt.cm.get_cmap("jet", 24)
# Take a screen shot
max_u = 0
for u in mesh.point_arrays['U']:
max_u=max(max_u, u[0]**2+u[1]**2+u[2]**2)
max_u=np.sqrt(max_u)
print('Max displacement ',max_u)
mesh=mesh.warp_by_vector('U',factor=10/max_u)
mesh.plot(
screenshot=('%s/screenshot_%d.png') % (working_dir,plot_mode),
show_grid=False,
show_edges=False,
scalars="U",
smooth_shading=False,
cmap=my_cmap)
Read "out_eig_0.h5m" Wrote "out_eig_0.h5m.vtk" Read "out_eig_1.h5m" Wrote "out_eig_1.h5m.vtk" Read "out_eig_2.h5m" Wrote "out_eig_2.h5m.vtk" Read "out_eig_3.h5m" Wrote "out_eig_3.h5m.vtk" Read "out_eig_4.h5m" Wrote "out_eig_4.h5m.vtk" /mofem_install/um_view/tutorials/vec-1/out_eig_0.h5m.vtk Max displacement 0.0322210418353059
/mofem_install/um_view/tutorials/vec-1/out_eig_1.h5m.vtk Max displacement 0.03658696933354081
/mofem_install/um_view/tutorials/vec-1/out_eig_2.h5m.vtk Max displacement 0.035816174529954795
/mofem_install/um_view/tutorials/vec-1/out_eig_3.h5m.vtk Max displacement 0.042094751899699176
/mofem_install/um_view/tutorials/vec-1/out_eig_4.h5m.vtk Max displacement 0.03230248376884193
# Plot screan shots
for f in range(0,numberOfValuesToCalulate):
screeen_shot=('%s/screenshot_%d.png') % (working_dir,f)
img = mpimg.imread(screeen_shot)
imgplot = plt.imshow(img)
plt.show()