Problem with variational derivative
I am solving a coupled problem: Nonlinear advection-diffusion and hyperelasticity
#Function spaces are:
Q = FunctionSpace(mesh, "CG", 1);
V = VectorFunctionS
U = VectorFunctionS
#Functions for advection-diff
u1c = Function(Q) #Solution from current time step
u10 = Function(Q) #Initial condition
#Functions for hyperelasticity
v2 = TestFunction(U) # Test function
du2 = TrialFunction(U) # Incremental displacement
u2c = Function(U) # Displacement in current time step
#Concentration field influencing the stress. Strain energy function psi(C), where C is the right Cauchy-Green tensor.
psi = ((u10/u1c)
P = 2*((u1c/
#Variational form
L2 = inner(P, grad(v2))*dx(1) - inner(B, v2)*dx(1) - inner(T2, v2)*ds(1)
a2 = derivative(L2, u2c, du2)
# Solve nonlinear variational problem
problem = VariationalProb
This code takes inordinately long to form the matrices, but appears to converge quadratically to the correct solution. If instead I move the multiplication by (u10/u1c) from
P = 2*((u1c/
psi = ((u10/u1c)
P = 2*F*diff(psi, C) #Stress
the matrices are assembled faster by a factor of 30 or 40, but the starting residual is different and I lose quadratic convergence of the residual.
Is there something obviously wrong? It is unexpected that rewriting the stress without changing its mathematical form causes such a difference in the assembly and solution procedures.
----Krishna
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Krishna Garikipati for more information if necessary.