As you can see in the example, we are doing 500 iterations and we adapt the
mesh every 100 iterations. This is done with the counter count
which is
initialized to 1 before the loop, then it is incremented every iterations
until 100. Then we use the if-then
construction to test whether the
counter is equal to 100 or not. If it is the case, we adapt the mesh
according to two functions u,p
; we put i,j,k
to
their positive value so that the matrices will be reconstructed and finally we
reinitialize the counter to 1
.
After the adpatation, the mesh is automatically redrawn(there is no need to use a trick like
w=0; plot(w);to visualize the newly adapted mesh.
Note the new argument for border
. This last argument is the reference
of the first point of this border(it is optional); this allows to define
precisely the references of each edges of the boundary. It is strongly
advised to use this when you do mesh adaptation [con]mesh adaptation, otherwise you will have
undefined edges and vertices references.