Ejemplo n.º 1
0
def J_BlockF(dotdU,dU,dP,U,dotD_F,v,dotv,q,D_F,rho,mu,N_F,dxFlist,dsDNlist,dsF,g_F=None):
    """Fluid Diagonal Block, Fluid Domain """
    Id = I(U)
    forms = []
    for dxF in dxFlist:
        #DT (without ALE term)
        J_FF =  inner(dotv, rho*J(D_F)*dotdU)*dxF                              
        J_FF +=  inner(v, rho*J(D_F)*dot(dot(grad(dU), inv(F(D_F))), U - dotD_F))*dxF  
        J_FF +=  inner(v, rho*J(D_F)*dot(grad(U), dot(inv(F(D_F)), dU)))*dxF

        #div Sigma_F
        J_FF +=  inner(grad(v), J(D_F)*mu*dot(grad(dU), dot(inv(F(D_F)), inv(F(D_F)).T)))*dxF     
        J_FF +=  inner(grad(v), J(D_F)*mu*dot(inv(F(D_F)).T, dot(grad(dU).T, inv(F(D_F)).T)))*dxF 
        J_FF += -inner(grad(v), J(D_F)*dP*inv(F(D_F)).T)*dxF                                       

        #div U_F (incompressibility)
        J_FF +=  inner(q, div(J(D_F)*dot(inv(F(D_F)), dU)))*dxF
        forms.append(J_FF)

    #Do nothing BC
    for dsDN in dsDNlist:
        DN_FF =  -inner(v, dot(J(D_F)*mu*dot(inv(F(D_F)).T, dot(grad(dU).T, inv(F(D_F)).T)), N_F))*dsDN
        DN_FF += inner(v, J(D_F)*dP*dot(Id, dot(inv(F(D_F)).T, N_F)))*dsDN
        forms.append(DN_FF)
    return sum(forms)
Ejemplo n.º 2
0
def J_BlockFFD(U, dotU, P, D_F, dD_F,dotD_F, dotdD_F, v_F,dotv, q, rho, mu,N_F,
               dxFlist,dsDNlist,dFSIlist,ds_F,g_F = None,F_F = None):
    """Fluid-Fluid Domain coupling"""
    Id = I(D_F)
    forms = []
    for dxF in dxFlist:
        #If a fluid body force has been specified, it will end up here. 
        if F_F is not None and F_F != []:
            B_F = -inner(v_F,J(D_F)*tr(dot(grad(dD_F),inv(F(D_F))))*F_F)*dxF
            forms.append(B_F)
    #Simplify the remaining terms if an FSI interface measure provided    
    if dFSIlist is not None:
        dxFlist = dFSIlist
        
    for dxF in dxFlist:
        #DT  
        J_FM =  inner(v_F, rho*J(D_F)*tr(dot(grad(dD_F), inv(F(D_F))))*dotU)
        J_FM +=  inner(v_F, rho*J(D_F)*tr(dot(grad(dD_F), inv(F(D_F))))*dot(grad(U), dot(inv(F(D_F)), U - dotD_F)))
        J_FM += -inner(v_F,rho*J(D_F)*dot((dot(grad(U), dot(inv(F(D_F)), \
                 dot(grad(dD_F), inv(F(D_F)))))), U - dotD_F ))
        J_FM += -inner(v_F, rho*J(D_F)*dot(grad(U), dot(inv(F(D_F)),dotdD_F)))

        #SigmaF
        J_FM += inner(grad(v_F),dD_FSigmaF(D_F,dD_F,U,P,mu))

        #Div U_F (incompressibility)
        J_FM +=  inner(q, div(J(D_F)*tr(dot(grad(dD_F), inv(F(D_F))))*dot(inv(F(D_F)), U)))
        J_FM += -inner(q, div(J(D_F)*dot(dot(inv(F(D_F)), grad(dD_F)), dot(inv(F(D_F)), U))))
        if dFSIlist is None:
            J_FM = J_FM*dxF
        else:
            J_FM = J_FM('+')*dxF
        forms.append(J_FM)
    return sum(forms)

    ##Add the terms for the Do nothing boundary if necessary
    for dsDN in dsDNlist:
        #Derivative of do nothing tensor with J factored out
        dSigma  =  tr(grad(dD_F)*inv(F(D_F)))*(mu*inv(F(D_F)).T*grad(U).T - P*Id)*inv(F(D_F)).T
        dSigma += -mu*inv(F(D_F)).T*grad(dD_F).T*inv(F(D_F)).T*grad(U).T*inv(F(D_F)).T
        dSigma += -(mu*inv(F(D_F)).T*grad(U).T - P*Id)*inv(F(D_F)).T*grad(dD_F).T*inv(F(D_F)).T
        #J added
        dSigma = J(D_F)*dSigma
        DN_FM = -inner(v_F,dot(dSigma,N_F))*dsDN
        forms.append(DN_FM)
    return sum(forms)
Ejemplo n.º 3
0
def J_FSI(dU_F,dU_Fmid,dP_Fmid,dD_Fmid,U_Fmid,P_Fmid,D_Fmid,c_S,mu_F,N_F,dFSIlist):
    """Derivative of the Interface Residual"""
    forms = []
    Sigma_F = PiolaTransform(_Sigma_F(dU_Fmid, dP_Fmid, D_Fmid, mu_F), D_Fmid)
    for dFSI in dFSIlist:   
        J_FSI = -(inner(c_S('-'),dot(Sigma_F('+'),N_F('-'))))*dFSI       
        J_FSI += -inner(c_S('-'),dot(dD_FSigmaF(D_Fmid,dD_Fmid,U_Fmid,P_Fmid,mu_F)('+'),N_F('-')))*dFSI
        forms.append(J_FSI)
    return sum(forms)
Ejemplo n.º 4
0
def J_BlockF(dotdU,
             dU,
             dP,
             U,
             dotD_F,
             v,
             dotv,
             q,
             D_F,
             rho,
             mu,
             N_F,
             dxFlist,
             dsDNlist,
             dsF,
             g_F=None):
    """Fluid Diagonal Block, Fluid Domain """
    Id = I(U)
    forms = []
    for dxF in dxFlist:
        #DT (without ALE term)
        J_FF = inner(dotv, rho * J(D_F) * dotdU) * dxF
        J_FF += inner(
            v,
            rho * J(D_F) * dot(dot(grad(dU), inv(F(D_F))), U - dotD_F)) * dxF
        J_FF += inner(v,
                      rho * J(D_F) * dot(grad(U), dot(inv(F(D_F)), dU))) * dxF

        #div Sigma_F
        J_FF += inner(
            grad(v),
            J(D_F) * mu * dot(grad(dU), dot(inv(F(D_F)),
                                            inv(F(D_F)).T))) * dxF
        J_FF += inner(
            grad(v),
            J(D_F) * mu * dot(inv(F(D_F)).T, dot(grad(dU).T,
                                                 inv(F(D_F)).T))) * dxF
        J_FF += -inner(grad(v), J(D_F) * dP * inv(F(D_F)).T) * dxF

        #div U_F (incompressibility)
        J_FF += inner(q, div(J(D_F) * dot(inv(F(D_F)), dU))) * dxF
        forms.append(J_FF)

    #Do nothing BC
    for dsDN in dsDNlist:
        DN_FF = -inner(
            v,
            dot(
                J(D_F) * mu *
                dot(inv(F(D_F)).T, dot(grad(dU).T,
                                       inv(F(D_F)).T)), N_F)) * dsDN
        DN_FF += inner(v,
                       J(D_F) * dP * dot(Id, dot(inv(F(D_F)).T, N_F))) * dsDN
        forms.append(DN_FF)
    return sum(forms)
Ejemplo n.º 5
0
def J_BlockS(dD_S, D_S, c_S, mu_S, lmbda_S, rho_S, dxSlist): 
    "Structure diagonal block"
    Id = I(D_S)
    F_S = grad(D_S) + I(D_S)                 #I + grad U_s
    E_S = 0.5*(F_S.T*F_S - Id)           #Es in the book
    dE_S = 0.5*(grad(dD_S).T*F_S + F_S.T*grad(dD_S))#Derivative of Es wrt to US in the book
    dUsSigma_S = grad(dD_S)*(2*mu_S*E_S + lmbda_S*tr(E_S)*Id) + F_S*(2*mu_S*dE_S + lmbda_S*tr(dE_S)*Id)

    forms = []
    for dxS in dxSlist:
        forms.append(inner(grad(c_S), dUsSigma_S)*dxS)
    return sum(forms)
Ejemplo n.º 6
0
def J_FSI(dU_F, dU_Fmid, dP_Fmid, dD_Fmid, U_Fmid, P_Fmid, D_Fmid, c_S, mu_F,
          N_F, dFSIlist):
    """Derivative of the Interface Residual"""
    forms = []
    Sigma_F = PiolaTransform(_Sigma_F(dU_Fmid, dP_Fmid, D_Fmid, mu_F), D_Fmid)
    for dFSI in dFSIlist:
        J_FSI = -(inner(c_S('-'), dot(Sigma_F('+'), N_F('-')))) * dFSI
        J_FSI += -inner(
            c_S('-'),
            dot(
                dD_FSigmaF(D_Fmid, dD_Fmid, U_Fmid, P_Fmid, mu_F)
                ('+'), N_F('-'))) * dFSI
        forms.append(J_FSI)
    return sum(forms)
Ejemplo n.º 7
0
def J_BlockS(dD_S, D_S, c_S, mu_S, lmbda_S, rho_S, dxSlist):
    "Structure diagonal block"
    Id = I(D_S)
    F_S = grad(D_S) + I(D_S)  #I + grad U_s
    E_S = 0.5 * (F_S.T * F_S - Id)  #Es in the book
    dE_S = 0.5 * (grad(dD_S).T * F_S + F_S.T * grad(dD_S)
                  )  #Derivative of Es wrt to US in the book
    dUsSigma_S = grad(dD_S) * (2 * mu_S * E_S +
                               lmbda_S * tr(E_S) * Id) + F_S * (
                                   2 * mu_S * dE_S + lmbda_S * tr(dE_S) * Id)

    forms = []
    for dxS in dxSlist:
        forms.append(inner(grad(c_S), dUsSigma_S) * dxS)
    return sum(forms)
Ejemplo n.º 8
0
def J_Bufferable(dU_F,dotdD_S,dD_S, dotdU_S,dU_S,dU_Smid,dD_Fdot,dD_F,dD_Fmid,dL_U,dL_D,v_F,dotv_S,
                 dotc_S,dotc_F,c_F,m_D,m_U,rho_S,mu_FD,lmbda_FD,dx_Flist,dFSIlist,dxSlist):
    """Linear forms that only need to be assembled once"""
    #Fluid Domain diagonal block
    forms = []
    Sigma_FD = _Sigma_M(dD_Fmid, mu_FD, lmbda_FD)
    for dx_F in dx_Flist:
        J_FD = inner(dotc_F, dD_Fdot)*dx_F + inner(sym(grad(c_F)), Sigma_FD)*dx_F
        forms.append(J_FD)
    #Lagrange Multiplier conditions
    for dFSI in dFSIlist:
        J_FSI = inner(m_D, dD_F - dD_S)('+')*dFSI 
        J_FSI += inner(c_F, dL_D)('+')*dFSI #Lagrange Multiplier
        J_FSI += inner(m_U, dU_F - dU_S)('+')*dFSI
        J_FSI += inner(v_F, dL_U)('+')*dFSI #Lagrange Multiplier
        forms.append(J_FSI)
    #Structure Dt terms
    for dxS in dxSlist:
        J_S = inner(dotc_S, rho_S*dotdU_S)*dxS + inner(dotv_S, dotdD_S - dU_Smid)*dxS
        forms.append(J_S)
    return sum(forms)
Ejemplo n.º 9
0
def J_Bufferable(dU_F, dotdD_S, dD_S, dotdU_S, dU_S, dU_Smid, dD_Fdot, dD_F,
                 dD_Fmid, dL_U, dL_D, v_F, dotv_S, dotc_S, dotc_F, c_F, m_D,
                 m_U, rho_S, mu_FD, lmbda_FD, dx_Flist, dFSIlist, dxSlist):
    """Linear forms that only need to be assembled once"""
    #Fluid Domain diagonal block
    forms = []
    Sigma_FD = _Sigma_M(dD_Fmid, mu_FD, lmbda_FD)
    for dx_F in dx_Flist:
        J_FD = inner(dotc_F, dD_Fdot) * dx_F + inner(sym(grad(c_F)),
                                                     Sigma_FD) * dx_F
        forms.append(J_FD)
    #Lagrange Multiplier conditions
    for dFSI in dFSIlist:
        J_FSI = inner(m_D, dD_F - dD_S)('+') * dFSI
        J_FSI += inner(c_F, dL_D)('+') * dFSI  #Lagrange Multiplier
        J_FSI += inner(m_U, dU_F - dU_S)('+') * dFSI
        J_FSI += inner(v_F, dL_U)('+') * dFSI  #Lagrange Multiplier
        forms.append(J_FSI)
    #Structure Dt terms
    for dxS in dxSlist:
        J_S = inner(dotc_S, rho_S * dotdU_S) * dxS + inner(
            dotv_S, dotdD_S - dU_Smid) * dxS
        forms.append(J_S)
    return sum(forms)
Ejemplo n.º 10
0
def J_BlockFFD(U,
               dotU,
               P,
               D_F,
               dD_F,
               dotD_F,
               dotdD_F,
               v_F,
               dotv,
               q,
               rho,
               mu,
               N_F,
               dxFlist,
               dsDNlist,
               dFSIlist,
               ds_F,
               g_F=None,
               F_F=None):
    """Fluid-Fluid Domain coupling"""
    Id = I(D_F)
    forms = []
    for dxF in dxFlist:
        #If a fluid body force has been specified, it will end up here.
        if F_F is not None and F_F != []:
            B_F = -inner(v_F,
                         J(D_F) * tr(dot(grad(dD_F), inv(F(D_F)))) * F_F) * dxF
            forms.append(B_F)
    #Simplify the remaining terms if an FSI interface measure provided
    if dFSIlist is not None:
        dxFlist = dFSIlist

    for dxF in dxFlist:
        #DT
        J_FM = inner(v_F,
                     rho * J(D_F) * tr(dot(grad(dD_F), inv(F(D_F)))) * dotU)
        J_FM += inner(
            v_F,
            rho * J(D_F) * tr(dot(grad(dD_F), inv(F(D_F)))) *
            dot(grad(U), dot(inv(F(D_F)), U - dotD_F)))
        J_FM += -inner(v_F,rho*J(D_F)*dot((dot(grad(U), dot(inv(F(D_F)), \
                 dot(grad(dD_F), inv(F(D_F)))))), U - dotD_F ))
        J_FM += -inner(v_F,
                       rho * J(D_F) * dot(grad(U), dot(inv(F(D_F)), dotdD_F)))

        #SigmaF
        J_FM += inner(grad(v_F), dD_FSigmaF(D_F, dD_F, U, P, mu))

        #Div U_F (incompressibility)
        J_FM += inner(
            q,
            div(
                J(D_F) * tr(dot(grad(dD_F), inv(F(D_F)))) *
                dot(inv(F(D_F)), U)))
        J_FM += -inner(
            q,
            div(
                J(D_F) *
                dot(dot(inv(F(D_F)), grad(dD_F)), dot(inv(F(D_F)), U))))
        if dFSIlist is None:
            J_FM = J_FM * dxF
        else:
            J_FM = J_FM('+') * dxF
        forms.append(J_FM)
    return sum(forms)

    ##Add the terms for the Do nothing boundary if necessary
    for dsDN in dsDNlist:
        #Derivative of do nothing tensor with J factored out
        dSigma = tr(grad(dD_F) * inv(F(D_F))) * (
            mu * inv(F(D_F)).T * grad(U).T - P * Id) * inv(F(D_F)).T
        dSigma += -mu * inv(F(D_F)).T * grad(dD_F).T * inv(
            F(D_F)).T * grad(U).T * inv(F(D_F)).T
        dSigma += -(mu * inv(F(D_F)).T * grad(U).T - P * Id) * inv(
            F(D_F)).T * grad(dD_F).T * inv(F(D_F)).T
        #J added
        dSigma = J(D_F) * dSigma
        DN_FM = -inner(v_F, dot(dSigma, N_F)) * dsDN
        forms.append(DN_FM)
    return sum(forms)