nonlinear pde with nonconstant coefficients

Asked by Ralph

I am trying to implement a NonlinearPDE with non-constant coefficients. It is of the form

-h(y)*u_x + ( phi(y) * u_y )_y + Y(y, u) = 0

where u is the unknown function, x and y are the two spatial variables and _x and _y denote partial deriviatves. In other words, the pde has second order partials in y but only first order partials in x. These parts of the operator are linear. Y, however, is a nonlinear function of the independent variable y and the unknown u. It seems that I should define X to be the vector

X = < h(y)*u, phi(y)*u_y >

but I have not been able to do this in a way that is acceptable to escript. The example in the User's Guide creates X as the gradient of a symbol. Any suggestions or examples of NonlinearPDEs implemented in escript would be appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
esys-escript Edit question
Assignee:
No assignee Edit question
Solved by:
Jaco
Solved:
Last query:
Last reply:
Revision history for this message
Best Jaco (j-duplessis1) said :
#1

Hi Ralph,

You can try to use the NonlinearPDE in escript to solve your problem. Here is an example I have put together for you.

from esys.escript import *
from esys.finley import Rectangle
from esys.weipa import saveSilo
dom = Rectangle(l0=1.,l1=1.,n0=100, n1=100)
y=dom.getX()[1]
u = Symbol('u',(), dim=2)
X = Symbol('X',(2,), dim=2)#setting the shape to (2,) makes X a vector
phi = 1 + y**2
h=1 + y
X[0]=0
X[1]=grad(u)[1]*phi
Y = y*u # this is the Non linear functionf from the pde
Y1 = h*grad(u)[1]-Y #this is the onle that we put into the non linear pde class
print(Y1)
p = NonlinearPDE(dom, u, debug=NonlinearPDE.DEBUG0)
gammaD=whereZero(y)
p.setValue(X=X,q=gammaD,Y=Y1,r=1)
v = p.getSolution(u=0)
saveSilo("solution",solution=v)

note that the general form of the nonlinear pde is: -Div(X) + Y = 0

As a forewarning this method may not converge depending on h, phi, Y and the boundary conditions.

Revision history for this message
Ralph (ralphw-a) said :
#2

Thanks Jaco, that solved my question.