This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to slove this coupled BVP equation

0 votes

Here is the coupled equation

u1'' = u1 + u1^3 - 2* u1u2-(1/r)u1'
u2'' = u2 -2u2^3 + u2^3-(1/r)u2'- (u1*u1)
with this condition
u1(0)=0, u1'(\infinite)=0
u2'(0)=0,u2'(\infinite)=0 (The mixed boundary condition)

from dolfin import *

# Number of elements
nel = 30

# Polynomial order
p = 2

# Create mesh and function space
mesh = IntervalMesh(nel,0,1)

V = FunctionSpace(mesh,"CG",p)

# Product space 
V2 = V*V

# Define boundary values 
boundary= Expression("x[0]")

def u0_boundary(x,on_boundary):
    return on_boundary

# Dirichlet boundary conditions
bc = DirichletBC(V2.sub(0),boundary,u0_boundary)
bcs = [bc,0]

# Define variational problem
(u1,u2) = TrialFunctions(V2)
(v1,v2) = TestFunctions(V2)

f1 = Expression("-u1-u1*u1*u1+2*u1*u2")
f2 = Expression("-u2+2*u2*u2-u2*u2*u2+u1*u1")
g  = Expression("pow(x[0],-1)")
a = inner(grad(u1),grad(v1))*dx + g*grad(u1)*v1*dx + \
    g*grad(u2)*v2*dx + inner(grad(u2),grad(v2))*dx

L = f1*v1*dx + f2*v2*dx + v1*ds +v2*ds

u = Function(V2)
solve(a == L, u, bcs)

u1,u2 = u.split()
plot(u1,title="u_1")
plot(u2,title="u_2")
interactive()
asked Apr 9, 2014 by pengfuping FEniCS Novice (120 points)
edited Apr 10, 2014 by pengfuping

Use latex commands to format your maths and to improve your chances on an answer.

There is no question in your description. Please state your question clearly.

...