hyperelastic-meterial-test

Home   »   hyperelastic-meterial-test

import getfem as gf
import numpy as np

#Moony-Rivlinの構成則

C10 = 1.195056693 #[MPa]=[N/mm2]
C01 = 0.0 #[MPa]=[N/mm2]

dim = 3 # 3次元要素

P = 0.01 # {N}

elements_degree = 2 # Lagrange要素Pkのkを設定
L = 20 # 幅[mm]
H = 50 # 高さ[mm]
d = 4  # メッシュ幅[mm]

mesh = gf.Mesh("cartesian Q1", np.arange(0, L+d/10, d), np.arange(0, L+d/10, d), np.arange(0, H+d/10, d))

print('FACES')
print('face count', mesh.faces_from_cvid().shape)
print('POINTS')
print('point count', mesh.pts().shape)
print('REGIONS')
print(mesh.regions())

# 固定点と荷重点を取得(底面を固定し上面に荷重を加える)
points = mesh.pts()
point_indexes = list(range(0, mesh.nbpts()))

top_z    = np.max(points[2,:])
bottom_z = np.min(points[2,:])

fixed_pids = np.compress(points[2,:] < bottom_z + 0.1, point_indexes)
vcon_pids  = np.compress(points[2,:] > top_z - 0.1, point_indexes)

fix  = mesh.faces_from_pid(fixed_pids)
vcon = mesh.faces_from_pid(vcon_pids)

FIX  = 1 # 固定点のRegion番号
VCON = 2 # 荷重点のRegion番号

mesh.set_region(FIX, fix)
mesh.set_region(VCON, vcon)

# メッシュに有限要素法を構築(3次元ベクトル場)

mesh_fem_object = gf.MeshFem(mesh, dim)
fem_method = gf.Fem(f'FEM_QK({dim},{elements_degree})')
mesh_fem_object.set_fem(fem_method)

# 要素内の積分法について設定

mesh_integration_method = gf.MeshIm(mesh)
integ_method = gf.Integ(f'IM_NC_PARALLELEPIPED({dim}, {elements_degree})')
mesh_integration_method.set_integ(integ_method)

model = gf.Model("real")

# 変位ベクトルの変数U
model.add_fem_variable("u", mesh_fem_object)

### ひずみエネルギー密度関数

model.add_initialized_data("A", [C10,C01])
model.add_finite_strain_elasticity_brick(mesh_integration_method, 'Incompressible Mooney Rivlin', 'u', 'A')

# 荷重を荷重点に作用させる

F = mesh_fem_object.eval(str([0,0,P]))
model.add_initialized_fem_data('ForceData', mesh_fem_object, F)
model.add_source_term_brick(mesh_integration_method, 'u', 'ForceData', VCON)


# 固定点にディレクリ境界条件を作用

model.add_Dirichlet_condition_with_multipliers(mesh_integration_method, 'u', elements_degree - 1, FIX)

model.solve('max_res', 1e-5, 'max_iter', 40, 'noisy')

Leave a Reply

Your email address will not be published. Required fields are marked *