problem with defining vector in fenics


58
views
0
3 months ago by
Ali  
Hi,

I am trying to extract stiffness matrix refers to bilinear form below, so I have defined two vector S and F that give me first and the second component of the multiplied term.
But It seems this approach is not working here.
import dolfin
from dolfin import *
import scipy
from scipy.linalg import sqrtm
from petsc4py import PETSc
from numpy import array2string
import numpy as np
import sys
import time
import mshr


start_time = time.time()
# Create mesh
mesh = UnitSquareMesh(2, 2)

# Define function spaces
CG = VectorElement("CG", mesh.ufl_cell(), 2, dim=2)
NED = VectorElement("n1curl", mesh.ufl_cell(), 1, dim=2)
RT = VectorElement("RT", mesh.ufl_cell(), 1, dim=2)
mio = 1
lda = 2
S = [0,1] ###problematic part
F = [1,0] ###problematic part
element = MixedElement([CG, NED, RT])
V = FunctionSpace(mesh, element)
w = Function(V)

V, M, Q = TrialFunctions(V)

yup, lamda, pi= TestFunctions(V)

ncells = [  mesh.num_vertices(), mesh.num_edges(), mesh.num_faces(), mesh.num_facets(), mesh.num_cells() ]

a =(mio*(dot(M[0],pi[0]))) + (mio* dot(inner(M[0],F)*F,pi[0])) + (mio* dot(inner(M[1])*S,pi[1])) \
+ 4*lda*(dot(inner(M[0],F)*F,pi[0])) + 4*lda*(dot(inner(M[1]),S)*F,pi[0]) \
+ (mio*(dot(inner(M[0]),S)*F,pi[1])) + (mio*(dot(inner(M[1]),S)*S,pi[1])) + (mio*(dot(M[1],pi[1]))) \
+ 4*lda*dot((inner(M[0],F)*S),pi[1]) + 4*lda*dot((inner(M[1],S)*S),pi[1]) \
- dot(Q[0], pi[0]) - dot(Q[0], pi[0]))*dx
​

Community: FEniCS Project
Please login to add an answer/comment or follow this question.

Similar posts:
Search »