getfem-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Getfem-users] coupling PDEs with linear terms


From: Alice Nicolas
Subject: Re: [Getfem-users] coupling PDEs with linear terms
Date: Wed, 08 Jun 2011 16:52:04 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10

I tried to implement coupled PDEs using the add_explicit_matrix brick:
 Eq(1): Laplacian(u)=p
 Eq (2): Laplacian(p)=x
u(0)=p(0)=0, u(1)=1/120, p(1)=1/6
 Although the program does work, it does not give the right solution.

I guess, I do not write correctly the tangent system. May I ask to one of you a critical eye on the part of code below? This would be of real help.
Thanks in advance.

Alice Nicolas

#evaluate the boundary conditions
gul = mfp.eval('0.')
gur=mfp.eval('1./120')
gpl = mfp.eval('0.')
gpr=mfp.eval('1./6')

# interpolate the source terms
fp = mfrhsp.eval('-x[0]')

# model
md = gf.Model('real')

# add variables and datas to model
md.add_fem_variable('u', mfu)
md.add_fem_variable('p', mfp)
md.add_initialized_fem_data('fp', mfrhsp, fp) # volumic source term

md.add_initialized_fem_data('gul', mfu, gul) # Dirichlet condition on u (left) md.add_initialized_fem_data('gur', mfu, gur)# Dirichlet condition on u (right) md.add_initialized_fem_data('gpl', mfp, gpl) # Dirichlet condition on p (left) md.add_initialized_fem_data('gpr', mfp, gpr)# Dirichlet condition on p (right)

# brick the problem
md.add_Laplacian_brick(mim, 'u')
md.add_Laplacian_brick(mim, 'p')
md.add_source_term_brick(mim, 'p', 'fp') # volumic source term in Eq. 2
B=gf.Spmat('identity',mfu.nbdof()) #add the coupling term in Eq. 1
md.add_explicit_matrix('u','p',B)

# Dirichlet conditions
md.add_Dirichlet_condition_with_penalization(mim, 'u', dirichlet_coefficient, left, 'gul') md.add_Dirichlet_condition_with_penalization(mim, 'u', dirichlet_coefficient, right, 'gur') md.add_Dirichlet_condition_with_penalization(mim, 'p', dirichlet_coefficient, left, 'gpl') md.add_Dirichlet_condition_with_penalization(mim, 'p', dirichlet_coefficient, right, 'gpr')

# assembly of the linear system and solve.
md.solve()


Le 07/06/2011 13:21, Yves Renard a écrit :
On lundi 6 juin 2011, Alice Nicolas wrote:
Dear getfem users,

I have a very beginner's question.
I am trying to solve a system of 2 PDE (variables u and p) that are
coupled through linear terms. As a crude example, Eq(1): Laplacian(u)=p,
Eq (2): Laplacian(p)=x, and boundary conditions.
I figured out that I need to add an explicit term to the tangent system
in order to account for the linear term -p in Eq (1). Is it the correct
way of tackling this problem? Would someone have some example of
programming such coupling of PDE (or of the declaration of the matrix
and the use of the add_explicit_matrix brick in case I am correct)?

Thank you very much for your invaluable help!!
Best regards,
Alice Nicolas
This is indeed the simplest mean to perform a coupling. The other mean is to
write a new brick, but this not possible for the moment directly with the
matlab/scilab/python interface.

Yves.





--
________________________________
Alice Nicolas
Laboratoire des Technologies de la Microelectronique
17 av des martyrs, 38054 Grenoble cedex, France
tel: 33 (0)4 38 78 94 04
fax: 33 (0)4 38 78 58 92
________________________________







reply via email to

[Prev in Thread] Current Thread [Next in Thread]