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: Yves Renard
Subject: Re: [Getfem-users] coupling PDEs with linear terms
Date: Thu, 9 Jun 2011 11:37:29 +0200
User-agent: KMail/1.13.5 (Linux/2.6.32-32-server; KDE/4.4.5; x86_64; ; )

Dear Alice,

The coupling term in your case is not the identity matrix but the mass matrix 
int phi_i, psi_j dx (due to the expression of the weak formulation of the 
problem) where phi_i are the shape functions of the finite element for 'u' and 
psi_j the shape functions of the finite element for 'p'. You can obtain this 
mass matrix with the command 'gf_asm'.

Yves.


On mercredi 8 juin 2011, you wrote:
> 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.


-- 

  Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
  Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE
  http://math.univ-lyon1.fr/~renard

---------



reply via email to

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