Jump to navigation Jump to search
258 bytes added ,  14:19, 19 July 2012
no edit summary
We want to solve the equation
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad in \Omega</math><math> \varphi(x, y)\ =\ x + y </math> with mixed Dirichlet / Neumann boundary conditions
<math> \varphiu(x, y)\ =\ u_d(x + , y )\qquad \mbox{ on } \Gamma_D </math>
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} \qquad \mbox{ on } \Gamma_N</math>
<b> Create the mesh and precompute the mesh properties </b>
<b> Construct an initial guess</b>
For a We need this even if our problem is linear problem only and stationaryas we are going to use the values at boundary nodes are actually relevant<br>to set Dirichelet boundary conditions. Get the node coordinates from the mesh structure
xu = mesh.p(1,:).';
yu = mesh.p(2,:).';
nelems = columns(mesh.t);</pre>nnodes = columns(mesh.p); <pre>
uin = 3*xu;
<b> Set the coefficients for the problem:</b>
Get the number of elements and nodes in the mesh
nelems = columns(mesh.t);
nnodes = columns(mesh.p);
epsilon = .1;
alfa = ones(nelems,1);gamma = ones(nnodes,1);eta phi = epsilon*ones(nnodes,1);beta = xu+yu;delta = ones(nelems,1);zeta = ones(nnodes,1);f = ones(nelems,1);g = ones(nnodes,1);
AdvDiff = bim2a_advection_diffusion(mesh,alfaepsilon,gamma1,eta,betaphi);
Mass = bim2a_reaction(mesh,delta,zeta);
b = bim2a_rhs(mesh,f,g);


Navigation menu