Adding Dirichlet into NonLinearProblem
Dear all,
I try to use a Newton linearization as a class in python AND implement nonhomogeneous Dirichlet conditions, where am I doing wrong?
Here is the model problem (cleaned so much that it is not a nonlinear problem anymore but anyhow) the boundary in the first iteration is correct but then it is overwritten with zero (for Newton perturbation this is fine) and I want to put it back in every single iteration. I tried in the def F and def J to do it, but no success! Any better ideas? Or should I copy the whole NonlinearProblem class every time :(
#------
from dolfin import *
parameters[
class iterate(
def __init__(self, a, L, bc, exter_B):
self.L = L
self.a = a
self.bc = bc
self.exter = exter_B
def F(self, b, x):
for condition in self.bc: condition.apply(b, x)
def J(self, A, x):
for condition in self.bc: condition.apply(A, x)
mesh = Box(0, 0, 0, 1000.0, 1000.0, 1000.0, 20, 50, 20)
V = VectorFunctionS
D = mesh.topology(
bottom = compile_
top = compile_
# dummy object into the abstract solver
neumann_domains = MeshFunction(
neumann_
shear = Expression('5.0')
bc1 = DirichletBC(
bc2 = DirichletBC(V, (0.0,0.0,0.0), bottom)
bc=[bc1,bc2]
dv = TrialFunction(V) # increment
w = TestFunction(V) # test
v = Function(V) # actual velocity from previous iteration
i, j, k, l = indices(4)
G = 80000.0
lmbd = 120000.0
def vij(v):
return as_matrix(
S = as_matrix(
form = S[i,j]*
gain = derivative(
problem = iterate(gain, form, bc, neumann_domains)
solver = NewtonSolver(
solver.
solver.
solver.
#------
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Garth Wells
- Solved:
- Last query:
- Last reply: