def create_forward_problem( mesh, activation, active_value=0.0, active_model="active_stain", T_ref=1.0, ): ffun = df.MeshFunction("size_t", mesh, 2) ffun.set_all(0) left = df.CompiledSubDomain("on_boundary && near(x[0], 0)") left_marker = 1 left.mark(ffun, left_marker) # Collect the functions containing the markers marker_functions = pulse.MarkerFunctions(ffun=ffun) def dirichlet_bc(W): V = W if W.sub(0).num_sub_spaces() == 0 else W.sub(0) return da.DirichletBC(V, da.Constant((0.0, 0.0, 0.0)), left) bcs = pulse.BoundaryConditions(dirichlet=(dirichlet_bc, ), ) f0 = df.as_vector([1, 0, 0]) microstructure = pulse.Microstructure(f0=f0) geometry = pulse.Geometry( mesh=mesh, marker_functions=marker_functions, microstructure=microstructure, ) material_parameters = dict( a=2.28, a_f=1.686, b=9.726, b_f=15.779, a_s=0.0, b_s=0.0, a_fs=0.0, b_fs=0.0, ) material = pulse.HolzapfelOgden( active_model=active_model, parameters=material_parameters, activation=activation, T_ref=T_ref, ) problem = pulse.MechanicsProblem(geometry, material, bcs) problem.solve() if active_value > 0.0: pulse.iterate.iterate(problem, activation, active_value) return problem
V_f = dolfin.VectorFunctionSpace(mesh, "CG", 1) # Fibers f0 = interpolate(Expression(("1.0", "0.0", "0.0"), degree=1), V_f) # Sheets s0 = interpolate(Expression(("0.0", "1.0", "0.0"), degree=1), V_f) # Fiber-sheet normal n0 = interpolate(Expression(("0.0", "0.0", "1.0"), degree=1), V_f) # Collect the mictrotructure microstructure = pulse.Microstructure(f0=f0, s0=s0, n0=n0) # Create the geometry geometry = pulse.Geometry( mesh=mesh, marker_functions=marker_functions, microstructure=microstructure, ) # Use the default material parameters material_parameters = pulse.HolzapfelOgden.default_parameters() # Select model for active contraction active_model = pulse.ActiveModels.active_strain # active_model = "active_stress" # Set the activation activation = Constant(0.0) # Create material material = pulse.HolzapfelOgden(
N = 4 mesh = UnitCubeMesh(N, N, N) V_f = dolfin.VectorFunctionSpace(mesh, "CG", 1) # Fibers f0 = interpolate(Expression(("1.0", "0.0", "0.0"), degree=1), V_f) # Sheets s0 = interpolate(Expression(("0.0", "1.0", "0.0"), degree=1), V_f) # Fiber-sheet normal n0 = interpolate(Expression(("0.0", "0.0", "1.0"), degree=1), V_f) microstructure = pulse.Microstructure(f0=f0, s0=s0, n0=n0) # Create the geometry geometry = pulse.Geometry( mesh=mesh, microstructure=microstructure, ) # - activation = Function(dolfin.FunctionSpace(geometry.mesh, "R", 0)) activation.assign(Constant(0.2)) matparams = pulse.HolzapfelOgden.default_parameters() material = pulse.HolzapfelOgden( activation=activation, parameters=matparams, f0=geometry.f0, s0=geometry.s0, n0=geometry.n0, ) problem = RigidMotionProblem(geometry, material)