### Solve dual nonlinear equation: ETSc error code is: 63

217
views
0
5 months ago by
Greetings.
I am trying to solve a boundary value problem:
$-\Delta\theta+\left(\theta^4-\varphi\right)=0,$Δθ+(θ4φ)=0,
$-\Delta\varphi+\left(\varphi-\theta^4\right)=0$Δφ+(φθ4)=0,
with conditions:
$\frac{\delta\theta}{\delta_n}|_{\Gamma}=f,\frac{\delta\varphi}{\delta n}|_{\Gamma}=g$δθδn |Γ=ƒ ,δφδn |Γ=g.

Code that I have:
from dolfin import *
import dolfin.cpp.mesh
omega = dolfin.cpp.mesh.UnitSquareMesh(64, 64)
p1 = FiniteElement("CG", omega.ufl_cell(), 2)
W = FunctionSpace(omega, p1 * p1)
theta, phi = split(Function(W))
v, h = split(TestFunction(W))
f, g = Expression("sin(x[0])*x[1]", degree=2), Expression("0.7*x[0]", degree=2)
+ inner((theta ** 4 - phi), v) * dx \
+ inner((phi - theta ** 4), h) * dx \
- f * v * ds - g * h * ds
w = Function(W)
solve(F == 0, w)​

gives me after the first iteration:

Solving nonlinear variational problem.
Newton iteration 0: r (abs) = 1.073e-01 (tol = 1.000e-10) r (rel) = 1.000e+00 (tol = 1.000e-09)
...
...traceback...
*** -------------------------------------------------------------------------
*** Error:   Unable to successfully call PETSc function 'MatSetValuesLocal'.
*** Reason:  PETSc error code is: 63 (Argument out of range).
*** Where:   This error was encountered inside /tmp/dolfin/dolfin/la/PETScMatrix.cpp.
*** Process: 0
***
*** DOLFIN version: 2017.2.0
*** Git changeset:  4c59bbdb45b95db2f07f4e3fd8985c098615527f
*** -------------------------------------------------------------------------

Similar issues: [1], [2], [3] did not help.
I would appreciate any help with it.

Community: FEniCS Project

4
5 months ago by
You have to define w previous to the definition of your variational problem. Try this:

from dolfin import *

omega = UnitSquareMesh(64, 64)
p1 = FiniteElement("CG", omega.ufl_cell(), 2)
W = FunctionSpace(omega, p1 * p1)

w = Function(W)
theta, phi = split(w)
v, h = split(TestFunction(W))

f, g = Expression("sin(x[0])*x[1]", degree=2), Expression("0.7*x[0]", degree=2)
solve(F == 0, w)​