The first picture is solved with fenics 2019.1.0, and the second is solved with dolfinx 0.6.0. Why does the second picture have such a bright spot (red box) with solving the same equations and same configuration?

sorry for my mistake，the first picture is solved in dolfinx 0.6.0 ,and the seconds picture is in fenics 2019.1.0

Without supplying a code, Im not sure how one should be able to help you

the following are codes of fenics v2019.1.0 and dolfinx v0.6.0, the variable **weights** is a ndarray .

```
'''
dolfinx v0.6.0
'''
from mpi4py import MPI
from dolfinx import mesh
from dolfinx.fem import FunctionSpace
from dolfinx import fem
import ufl
import numpy as np
domain = mesh.create_unit_square(MPI.COMM_WORLD, 511, 511)
xy = ufl.SpatialCoordinate(domain)
node = geom_node_scale
tol = np.finfo(np.float64).eps
r_n = [(xy[0] - (xc + tol))**2 + (xy[1] - (yc + tol))**2 for xc, yc in node]
S_n = np.copy(weights)
I_n = [S_n[i] / r_n[i] for i in range(len(node))]
J_n = [1 / r_n[i] for i in range(len(node))]
weights = 1/((1/softmax(weights)).min()*softmax(weights))
q=-sum(J_n*weights)
f=-sum(I_n*weights)
V = FunctionSpace(domain, ("Lagrange", 1))
uD = fem.Function(V)
uD.vector.set(3)
domain.topology.create_connectivity(domain.topology.dim-1, domain.topology.dim)
boundary_facets = mesh.exterior_facet_indices(domain.topology)
boundary_dofs = fem.locate_dofs_topological(V, domain.topology.dim-1, boundary_facets)
bc = fem.dirichletbc(uD, boundary_dofs)
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
a= -ufl.dot(ufl.grad(u),ufl.grad(v))*ufl.dx+q*u*v*ufl.dx
L=f*v*ufl.dx
problem = fem.petsc.LinearProblem(a, L, bcs=[bc],
)
uh = problem.solve()
```

```
'''
fenics 2019.1.0
'''
import numpy as np
import sympy as sym
x, y = sym.symbols('x[0], x[1]')
node = geom_node_scale
r_n = [(x - xc)**2 + (y - yc )**2 for xc, yc in node]
S_n = np.copy(weights)
I_n = [S_n[i] / r_n[i] for i in range(len(node))]
J_n = [1 / r_n[i] for i in range(len(node))]
weights = 1/((1/softmax(weights)).min()*softmax(weights))
S_xy = 3
J_xy = sum(J_n*weights)
I_xy = sum(I_n*weights)
u_code = sym.printing.ccode(S_xy)
q_code = sym.printing.ccode(J_xy)
f_code = sym.printing.ccode(I_xy)
import fenics as fe
u_D = fe.Expression(u_code, degree=1)
q = -fe.Expression(q_code, degree=1)
f = -fe.Expression(f_code, degree=1)
mesh = fe.UnitSquareMesh(511, 511)
V = fe.FunctionSpace(mesh, 'Lagrange', 1)
def boundary(x, on_boundary):
return on_boundary
bc = fe.DirichletBC(V, u_D, boundary)
u = fe.TrialFunction(V)
v = fe.TestFunction(V)
F = -fe.dot(fe.grad(u), fe.grad(v)) * fe.dx + q*u*v*fe.dx - f * v * fe.dx
a = fe.lhs(F)
L = fe.rhs(F)
A = fe.assemble(a)
b = fe.assemble(L)
bc.apply(A, b)
uh = fe.Function(V)
U = uh.vector()
fe.solve(A, U, b)
```

Well, first of all, what is

This means that one cannot reproduce the behavior you are talking about.

Secondly, there is a fundamental difference between

and

as the first one interpolates the solution into a first order Lagrange space, while the second one evaluates the expression at quadrature points (more accurate).

the variable **geom_node_scale** is a ndarray which shape is same as the variable **weights** . And, how can I implement the same functionality of

```
q= -fe.Expression(q_code, degree=1)
f = -fe.Expression(f_code, degree=1)
```

in dolfinx v0.6.0?

Why would you do that? It is less accurate.

If you really want to decrease the accuracy, you could interpolate the ufl expression into a dolfinx function, as mentioned in

in fenics 2019.1.0 ,I want to define the q and f the use them in the variational problem . Now , in dolfinx v0.6.0 , the q and v is ufl form,I didn’t know how to define the q and u to implement the same functionality

I dont understand your problem. You have a slightly different solution between dolfin and dolfinx, as you are using a slightly more accurate representation of `q`

and `f`

in dolfinx than in dolfin.

Your code runs and produces a result.

As a beginner for fenics, I’m sorry for my naive question.

when I just modify the value of uD from 3 to 1 , the results of dolfinx and fenics are completely different, which is my major confusion.

I want to know why and what causes so much difference. the above(values range in [0,1]) is in fenics v2019.1.0, and the below (values range in [0，2.5+ ]) is in dolfinx vq0.6.0

Also , I found that when I change the FunctionSpace to the second-order finite element

the results will same as i that in fenics v2019.1.0( V is first-order finite element) 。

You have different ranges on your color map above, so I cant say if they are different or not.

You have also not produced your visualization/plotting script/procedure.

You have still not produced a reproducible example, as you haven’t supplied enough info to reproduce the problem.