I am using fenics Ubuntu, please i am trying to interpolate the final solution onto a finer mesh in a mixed formulation. Here is my code for the final solution in which i want to interpolate but seems to not get it right.
u = Function(ME_coarse) # current solution
c, mu = u.split()
Step in time
t = 0.0
for j in range(N):
t += dt
# RHS weak form of Convex splitting
L = (c0*q + 3*((c0)**2)*v - 2*((c0)**3)*v)*dx
solve(a == L, u)
u.t = t
u0.assign(u)
u0.t = t
# Split mixed functions
c0, mu0 = u0.split()
c, mu = u.split()
Would like to interpolate the final solution onto a new mesh which is ‘c and mu’
Please would like to know how to interpolate the final solution (c and mu) onto a different mesh, i am using mixed formulation, i have my previous solution to be c0 and mu0 and my current solution is c and mu.
As i said in the previous post, we Need a minimal example that is executable by anyone on any computer. The code you have posted above does not have the necessary definitions to be executable.
This what i did for my error analysis but seems not to work and get error saying
TypeError: instance between mesh and mesh.
Error Analysis and Convergence
if (Nt > 1):
for l in range(1, len(ch)):
c_error = dot(ch[l-1]-ch[l], ch[l-1]-ch[l])*dx
c_error = sqrt(assemble(c_error))
mu_error = dot(muh[l-1]-muh[l], muh[l-1]-muh[l])*dx
mu_error = sqrt(assemble(mu_error))
c_L2_error.append(c_error)# when dt is refined
mu_L2_error.append(mu_error)# when dt is refined
for l in range(1, len(c_L2_error)):
c_rate = ln(c_L2_error[l-1]/c_L2_error[l])/ln(2)
c_L2_rate.append(c_rate)
Please format your code with three ` on each side of your code
and make sure it is runnable.
This line c, mu = u.split(). is not complete.
Additionally, make the example as small as possible, removing all lines that are not needed for showing the issue (But the code has to be executable).