Hello,
I would like to solve this second order equation in a 2D domain:
\rho d^2u(x,t)/dt^2 = (\lambda+2\mu) grad(div((x,t))) - \mu curl(curl(u(x,t))) + f(x,t)
To do so I would like to solve the following system
M d^2U/dt^2 + S U = F,
where M and S are matrices and F is a vector.
I introduce a basis {Phi_i^1, Phi_i^2} for i=1:#dof and Phi_i^1 = [Phi_i^1; 0] and Phi_i^2 = [0; Phi_i^2]. How can I do such thing in Fenics?
The ultimate goal would be to write M and S as block matrices sin the cbc.block library: for example the first block of S will be:
s1 = ((lambda_+2*mu_) * (div(u_x)*div(phi_x)) - mu_ * inner(curl(u_x),curl(phi_x))) * dx
S1 = assemble(s1)
where u_x = [u1_x; 0] and phi_x = [phi_x; 0] defined in some way.
I've tried the following:
Option (1):
V = VectorFunctionSpace(mesh, 'CG', 1)
u1, phi = TrialFunction(V), TestFunction(V)
phi_x = [phi.sub(0); 0]
phi_y = [0; phi.sub(1)]
s1 = ((lambda_+2*mu_) * (div(u_x)*div(phi_x)) - mu_ * inner(curl(u_x),curl(phi_x))) * dx
But I should know the dimension of phi.sub(0) and add the same dimension fo the zero part.
Option (2):
V = VectorFunctionSpace(mesh, 'CG', 1)
u1, phi = TrialFunction(V), TestFunction(V)
s1 = ( (lambda_+2*mu_) * (Dx(u1.sub(0),0) * Dx(phi.sub(0),0)) - mu_ * (Dx(u1.sub(0),1)*Dx(phi.sub(0),1))) * dx
But I get the following error: AttributeError: 'Argument' object has no attribute 'sub'
Can anyone help with this? There are almost no examples of second order equations of the fenics book or online, and none about the above equation.
How should one treat vector problems ?
Thank you!!!
I can be more specific or provide the entire code if needed.