def _external_work(self, u, v):

        F = dolfin.variable(kinematics.DeformationGradient(u))

        N = self.geometry.facet_normal
        ds = self.geometry.ds
        dx = self.geometry.dx

        external_work = []

        for neumann in self.bcs.neumann:

            n = neumann.traction * ufl.cofac(F) * N
            external_work.append(dolfin.inner(v, n) * ds(neumann.marker))

        for robin in self.bcs.robin:

            external_work.append(
                dolfin.inner(robin.value * u, v) * ds(robin.marker))

        for body_force in self.bcs.body_force:

            external_work.append(
                -dolfin.derivative(dolfin.inner(body_force, u) * dx, u, v), )

        if len(external_work) > 0:
            return list_sum(external_work)

        return None
Example #2
0
	def V0constrainedE(self,inverse=False):


		mesh = self.parameters["mesh"]
		u = self.parameters["displacement_variable"]
		ds = dolfin.ds(subdomain_data=self.parameters["facetboundaries"])
		dsendo = ds(self.parameters["endoid"], domain = self.parameters["mesh"], subdomain_data = self.parameters["facetboundaries"])
		pendo = self.parameters["volconst_variable"] 
		V0= self.parameters["constrained_vol"] 

		X = SpatialCoordinate(mesh)
		x = u + X


		F = self.Fmat()
		N = self.parameters["facet_normal"]
		n = cofac(F)*N

		area = assemble(Constant(1.0) * dsendo)
		if inverse:
			V_u = - Constant(0.0/3.0) * inner(x, n)
			Wvol = (Constant(0.0/area) * pendo  * V0 * dsendo) - (pendo * V_u *dsendo)
		else:
		    V_u = - Constant(1.0/3.0) * inner(x, n)
		    Wvol = (Constant(1.0/area) * pendo  * V0 * dsendo) - (pendo * V_u *dsendo)
		return Wvol
    ###############################################################

    # Invariants of deformation tensors (media)
    I_m = tr(C_m)
    Ie_m = tr(Ce_m)
    J_m = det(Fe_m)  #Jacobian of F or Fe?
    ###############################################################

    # Invariants of deformation tensors (Adventitia)
    I_a = tr(C_a)
    Ie_a = tr(Ce_a)
    J_a = det(Fe_a)
    ###############################################################

    #deformed normal vector
    NansonOp = cofac(F)
    deformed_N = dot(NansonOp, n)
    ###############################################################

    # Stored strain energy density (neo-Hookean Hopzafel model)
    psi_i = (mu_i / 2) * (Ie_i - 3) + (eta_i / beta_i) * (
        exp(beta_i *
            (rho_i * (I4_i - 1)**2 + (1 - rho_i) * (Ie_i - 3)**2)) - 1) + (
                (mu_i * nu_i) / (1 - 2 * nu_i)) * (J_i - 1)**2 - mu_i * ln(J_i)
    psi_m = (mu_m / 2) * (Ie_m - 3) + (eta_m / beta_m) * (
        exp(beta_m *
            (rho_m * (I4_m - 1)**2 + (1 - rho_m) * (Ie_m - 3)**2)) - 1) + (
                (mu_m * nu_m) / (1 - 2 * nu_m)) * (J_m - 1)**2 - mu_m * ln(J_m)
    psi_a = (mu_a / 2) * (Ie_a - 3) + (eta_a / beta_a) * (
        exp(beta_a *
            (rho_a * (I4_a - 1)**2 + (1 - rho_a) * (Ie_a - 3)**2)) - 1) + (