Example #1
0
 def bilin_mortar(u, v, w):
     ju = (-1.)**j * dot(u, w.n)
     jv = (-1.)**i * dot(v, w.n)
     nxn = prod(w.n, w.n)
     mu = .5 * ddot(nxn, C(sym_grad(u)))
     mv = .5 * ddot(nxn, C(sym_grad(v)))
     return ((1. / (alpha * w.h) * ju * jv - mu * jv - mv * ju) *
             (np.abs(w.x[1]) <= limit))
Example #2
0
    def __init__(self, state_n, state_np1, solver_options, set_strain=None):
        """
        Setup solver

        Parameters:
          state_n         previous state
          state_np1       current state
          solver_options  various 'how to solve' parameters

        Additional parameters:
          set_strain      set the zz strain to this value, if given
        """
        self.state_n = state_n
        self.state_np1 = state_np1
        self.options = solver_options
        self.set_strain = set_strain

        self.ebcs = []

        self.edofs = []
        self.evalues = []

        # Initialize the guess
        self.setup_guess()

        # The operators!
        if self.ndim == 1:
            # 1D axisymmetric is different than 2D/3D cartesian
            self.internal = LinearForm(
                lambda v, w: (
                    v.grad[0][0] * w["radial"]
                    - v.value[0] * w["radial"] / w.x[0]
                    + v.value[0] * w["hoop"] / w.x[0]
                )
            )
            self.jac = BilinearForm(
                lambda u, v, w: v.grad[0][0] * w["Crr"] * u.grad[0][0]
                + v.grad[0][0] * w["Crt"] * u.value[0] / w.x[0]
                - v.value[0]
                * (w["Crr"] * u.grad[0][0] + w["Crt"] * u.value[0] / w.x[0])
                / w.x[0]
                + v.value[0]
                * (w["Ctr"] * u.grad[0][0] + w["Ctt"] * u.value[0] / w.x[0])
                / w.x[0]
            )
        else:
            self.internal = LinearForm(
                lambda v, w: helpers.ddot(helpers.sym_grad(v), w["stress"])
            )
            self.jac = BilinearForm(
                lambda u, v, w: helpers.ddot(
                    helpers.sym_grad(v), helpers.ddot(w["C"], helpers.sym_grad(u))
                )
            )
        self.external = LinearForm(
            lambda v, w: helpers.dot((-1.0) * w["pressure"] * w.n, v)
        )
Example #3
0
def a(u, v, w):
    F, iF = deformation_gradient(w)
    DF = grad(u)
    dF = grad(v)
    dFiF = mul(dF, iF)
    DFiF = mul(DF, iF)
    tr_DFiF_dFiF = ddot(transpose(dFiF), DFiF)
    lnJ = np.log(det(F))
    return (mu * ddot(DF, dF) - (lmbda * lnJ - mu) * tr_DFiF_dFiF +
            lmbda * trace(dFiF) * trace(DFiF))
Example #4
0
            def bilinf(u, v, w):
                def C(T):
                    trT = T[0, 0] + T[1, 1]
                    return E / (1. + nu) * \
                        np.array([[T[0, 0] + nu / (1. - nu) * trT, T[0, 1]],
                                  [T[1, 0], T[1, 1] + nu / (1. - nu) * trT]])

                return t**3 / 12.0 * ddot(C(dd(u)), dd(v))
Example #5
0
def bilinf(u, v, w):
    from skfem.helpers import dd, ddot, trace, eye
    d = 0.1
    E = 200e9
    nu = 0.3

    def C(T):
        return E / (1 + nu) * (T + nu / (1 - nu) * eye(trace(T), 2))

    return d**3 / 12.0 * ddot(C(dd(u)), dd(v))
Example #6
0
 def mass(u, v, w):
     from skfem.helpers import dot, ddot
     p = 0
     if len(u.shape) == 2:
         p = u * v
     elif len(u.shape) == 3:
         p = dot(u, v)
     elif len(u.shape) == 4:
         p = ddot(u, v)
     return p
Example #7
0
 def proj(v, _):
     return ddot(C(sym_grad(x)), v)
Example #8
0
def biharmonic(u, v, w):
    from skfem.helpers import ddot, dd

    return ddot(dd(u), dd(v))
def penalty_2(u, v, w):
    return ddot(-dd(v), prod(w.n, w.n)) * dot(grad(u), w.n)
Example #10
0
def a_load(u, v, w):
    '''
    for $a_{h}$
    '''
    return ddot(dd(u), dd(v))
Example #11
0
 def bilinf(u, p, v, q, w):
     from skfem.helpers import grad, ddot, div
     return (ddot(grad(u), grad(v)) - div(u) * q - div(v) * p -
             1e-2 * p * q)
Example #12
0
def biharmonic(u, v, w):
    return ddot(dd(u), dd(v))
Example #13
0
def phipsi_load2(u, v, w):
    '''
    for 5.7b $(Laplace_phi, Laplace_psi)$
    '''
    return ddot(grad(u), grad(v))
Example #14
0
 def bilinf(u, v, w):
     return ddot(dd(u), dd(v))
Example #15
0
def L(v, w):
    F, iF = deformation_gradient(w)
    dF = grad(v)
    lnJ = np.log(det(F))
    return mu * ddot(F, dF) + (lmbda * lnJ - mu) * ddot(transpose(iF), dF)
Example #16
0
 def weakform(u, v, w):
     return ddot(C(sym_grad(u)), sym_grad(v))
Example #17
0
def vector_laplace(u, v, _):
    return ddot(grad(u), grad(v))
Example #18
0
def bilinf(u, v, w):
    from skfem.helpers import dd, ddot
    return ddot(dd(u), dd(v))
Example #19
0
 def lin_mortar(v, w):
     jv = (-1.)**i * dot(v, w.n)
     mv = .5 * ddot(prod(w.n, w.n), C(sym_grad(v)))
     return ((1. / (alpha * w.h) * gap(w.x) * jv - gap(w.x) * mv) *
             (np.abs(w.x[1]) <= limit))