Archive

Posts Tagged ‘PDE’

FreeFem++ Tutorial – Part 1

February 24, 2016 1 comment

First of all, FreeFem is a numerical computing software which allows a fast and automatized treatment of a variety of problems related to partial differential equations. Its name, FreeFem, speaks for itself: it is free and it uses the finite element method. Here are a few reasons for which you may choose to use FreeFem for a certain task:

  1. It allows the user to easily define 2D (and 3D) geometries and it does all the work regarding the construction of meshes on these domains.
  2. The problems you want to solve can be easily written in the program once we know their weak forms.
  3. Once we have variables defined on meshes or solutions to some PDE, we can easily compute all sorts of quantities like integral energies, etc.

Before showing a first example, you need to install FreeFem. If you are not familiar with command line work or you just want to get to work, like me, you can install the visual version of FreeFem which is available here. Of course, you can find example programs in the FreeFem manual or by making a brief search on the internet.

I’ll present some basic stuff, which will allow us in the end to solve the Laplace equation in a circular domain. Once we have the structure of the program, it is possible to change the shape of the domain in no time.

Read more…

Simple triangle mesh – Matlab code

April 20, 2015 Leave a comment

There are cases when you need to define a simple, regular mesh on a nice set, like a triangle, or a polygon. There are software which are capable of creating such meshes, but most of them will require some computation time (Delaunay triangulation, plus optimization, edge swapping, etc.). I propose to you a simple algorithm for defining a mesh on a triangle. Of course, this can be extended to polygons or other cases (I used a variant of it to create a mesh of a spherical surface).

The idea is very simple: start with three points {P_1,P_2,P_3}, and define the (only) initial triangle as {T = [1,\ 2,\ 3]}. Then, at each step, take a triangle {t_i} from the list {T}, add the midpoints of {t_i} to the list of points and replace the triangle {t_i} with the four smaller triangles determined by the vertices and midpoints of {t_i}. This is a basic mesh refining strategy. Thus, in short, we start with a triangle and do a number of mesh refinements, until we reach the desired side-length. Of course, at each step we should be careful not to add the midpoint of an edge two times (once for every neighbouring triangle), but in what follows, I will always remove duplicates by bruteforce in the end (not the most economic solution).

Read more…

Categories: Uncategorized Tags: , ,

Regularity of the weak solution Part 1

October 27, 2012 Leave a comment

I will present here how to recover the regularity of a weak solution for the Dirichlet problem. The arguments can easily be adapted to most of the weak formulations involving the Laplace operator, the essential tool being the estimate of the {L^2} norm of the derivatives of the solution {u}. The arguments are adapted from H. Brezis, Functional Analysis, Sobolev Spaces and Partial Differential Equations, Chapter 9, and the tool named the method of translations is due to L. Niremberg.

Consider the problem

\displaystyle \begin{cases} -\Delta u= f & \text{ in }\Omega \\ \hfill u=0 & \text{ on }\partial \Omega. \end{cases}

whose weak variational form is

\displaystyle \int_\Omega \nabla u \nabla v = \int_\Omega fv,\ \forall v \in H_0^1(\Omega).

Note that in the variational form we only assume {u \in H^1(\Omega)}, and to be able to recover the PDE we need to use Green’s formula, which is valid if {u \in H^2(\Omega)}.

Read more…

Weak formulation for Laplace Equation with Robin boundary conditions

October 22, 2012 6 comments

Consider {\Omega \subset \Bbb{R}^N} an open set with Lipschitz boundary and consider on {\Omega} the following problem

\displaystyle \begin{cases} -\Delta u =f &\text{ in }\Omega \\ \frac{\partial u}{\partial n}+\beta u =0 & \text{ on }\partial \Omega. \end{cases}

where {\beta>0} is a constant. This is the Laplace equation with Robin boundary conditions. I will prove that the problem is well posed and for each {f \in L^2(\Omega)} there exists a solution {u \in H^2(\Omega)}.

Read more…

Finite Difference Method for 2D Laplace equation

October 19, 2012 17 comments

[Edit: This is, in fact Poisson’s equation.]

[For solving this equation on an arbitrary region using the finite difference method, take a look at this post.]

I will present here how to solve the Laplace equation using finite differences 2-dimensional case:

\displaystyle \begin{cases} - \Delta u=1 & \text{ in }\Omega=[0,1]^2 \\ u=0 &\text{ on }\partial \Omega. \end{cases}

Read more…

Lax Milgram application

October 14, 2012 Leave a comment

Let {I=(0,2)} and {V=H^1(I)}. Consider the bilinear form

\displaystyle a(u,v)= \int_0^2 u'(t)v'(t)dt +\left( \int_0^1 u(t)dt\right)\left( \int_0^1 v(t)dt\right).

1. Check that {a(u,v)} is a continuous symmetric bilinear form and that {a(u,u)=0} implies {u=0}.

2. Prove that {a} is coercive.

3. Deduce that for every {f \in L^2(I)} there exists a unique {u \in H^1(I)} satisfying

\displaystyle (1) \ \ \ \ a(u,v)=\int_0^2 fv,\ \forall v \in H^1(I).

What is the corresponding minimization problem?

4. Show that the solution of {(1)} belongs to {H^2(I)} (and in particular {u \in C^1(\overline{I})}). Determine the equation and the boundary conditions satisfied by {u}.

5. Assume that {f \in C(\overline{I})}, and let {u} be the solution of {(1)}. Prove that {u} belongs to {W^{2,p}(I)} for every {p<\infty}. Show that {u \in C^2(\overline{I})} if and only if {\int_If=0}.

6. Determine explicitly the solution {u} of {(1)} when {f} is a constant.

7. Set {u=Tf}, where {u} is the solution of {(1)} and {f \in L^2(I)}. Check that {T} is a self-adjoint compact operator from {L^2(I)} into itself.

8. Study the eigenvalues of {T}.

H. Brezis, Functional Analysis

Read more…

One dimensional trace of a Sobolev function

October 7, 2012 Leave a comment

Check that the mapping {u\mapsto u(0)} from {H^1(\Bbb{R})} to {\Bbb{R}} is a continuous linear functional on {H^1(0,1)}. Deduce that there exists a unique {v_0 \in H^1(0,1)} such that

\displaystyle u(0)=\int_0^1(u'v_0'+uv_0).

Show that {v_0} is the solution of some differential equation with appropriate boundary conditions and compute {v_0} explicitly.

H. Brezis, Functional Analysis, Ex 8.18

Read more…

%d bloggers like this: