The augmented Lagrangian method is a refinement of the penalty method described above in which the equations
![]()
![]()
![]()
![]()
![]()
![]()
The lines starting with D declare that boundary segments tagged 1 and 2 are to be called wall and top respectively. It should be noted that different boundary tags can be given the same name. Conversely, for different problems, the same boundary tag can be assigned different names. (For example, if in another problem, the top boundary were to be used as the bottom of a different region, the tag 2 could variously be assigned both top and bottom. The interpretation of the name would be particular to the problem.)
The two problems, augment and delp, are explained below.
The macro run is generally straightforward. The algorithm will execute nstep iterations, assembling and solving the problems augment and delp at each iteration. At each iteration, there is a printout of the L1 norm of the difference between iterations and an arrow plot of the current solution is shown on the graphics screen. Various manipulations of the vector stack are necessary. This macro is explained in greater detail below.
We now investigate the Fasttalk code in more detail. We shall
assume that the last estimates of the velocity
and the
pressure
are located on V100 and V201
respectively.
A augment
e D_i{Pen}D_jU1_j+D_j{1.0/Re}D_jU1_i= \
{V100}_jD_jU1_i +D_i{V201}
b wall U1={0.0,0.0}
b top U1={1.0,0.0}
The problem augment is declared by the first line. The e
statement is, as explained above, a vector equation (indexed by the
i suffix) representing the momentum equation. Notice that there
are unknown terms on both the RHS and LHS. Although the equations are
often described as if the unknowns are on the left and the known terms
are on the right, as if set up for solution, there is no syntax
requirement for this in Fastflo, or even a requirement to have an
equals sign at all. The basic difference between this equation and
that for the penalty method is that the gradient of the pressure
appears as the last term.
The Dirichlet conditions in the b statements set the velocity to zero on the walls (the no-slip condition) and to the prescribed sliding velocity on the top. The use of the symbolic terms wall and top confers no particular advantage here. In more complex programming, however, such ability to declare names for boundary segments allows the programmer to code without having any particular mesh in mind; the numerical tags in the mesh can then be linked with a set of D statements at a later stage.
A [reduced] delp
e U1={Pen}D_j{-V100}_j
These lines describe the problem delp for the equation for the
pressure. It expresses the incompressibility constraint. In the
Navier-Stokes equations, it is well known that including this
equation at full accuracy can lead to an over-constrained problem, with
the appearance of checker-board instabilities in the pressure. A
common remedy is to interpolate the pressure on a sparser grid.
Fastflo supports this by linking the quadratic elements with
corresponding linear elements. Here the test functions from the
6-noded elements used for velocity are replaced by a smaller set of
linear shape functions drawn from 3-noded elements. This is achieved
by the option [reduced]. The shape functions used for
interpolating data are not changed, so the velocity that is
differentiated has quadratic interpolation.
When solved, this equation produces a result on the subset of corner
nodes, and this vector can only be used in expressions containing other
similar vectors; furthermore, it cannot be used in graphics or as data
to other problems (even reduced ones). Consequently, a command
expand is provided which linearly interpolates onto the other nodes,
creating a full vector which can be used for all purposes. The overall
construction is equivalent to finding
from the equation
.
< run
while iter < nstep
augment
solve
V500=V200-V100
test=L1 V500
show test
delp
solve
expand 1
V401=V401+V101
popp
V200=V100
black
arrow
popp
iter=iter+1
endwhile
>
The macro run assembles and solves the problems augment
and delp. This takes place nstep times, as controlled by
the while ... endwhile construction. Within each iteration,
the parameter iter is incremented by 1. We assume now and
verify later that the last estimates of ![]()
V500=V200-V100, test=L1 V500,
show test calculate the difference between the velocity estimates,
calculate the L1 norm of the difference, and print out the L1 norm.
Now it is time to update the pressure. The commands delp and solve assemble and solve the pressure update equation. After this process, the vector stack has the form
![]()
V401=V401+V101 calculates V200=V100, popp. The remaining commands
show an arrow plot and update the parameter iter.
In fluid dynamics problems, it is often useful to calculate the
streamfunction
for the flow. This is achieved by the
problem statement
A strf
e D_jD_jU1=[curlv] {-V100}
b top U1={0.0}
b wall U1={0.0}
which is incorporated in the file
cav_aug.prb
. When
assembled and solved, this problem finds
The special option [curlv] used in the e statement is
exactly what is needed to express the 2D operator on the RHS of the
equation. The boundary conditions are especially simple in this
example, because the entire boundary is a streamline, and the
streamfunction can be set there to any constant value. A more general
condition uses the defining equation
in the form
![]()
To complete this example, the following macro stream assembles
the problem strf, solves it, and makes a contour plot of
on the graphics screen. The vector stack is then popped to return the
current velocity estimate to V100. The macro stream is
also included in the file
cav_aug.prb
.
< stream
strf
solve
black
contour 101
popp
>
At this stage, it is time to load the files for the augmented
Lagrangian method and to run the code. Again, you might wish to
experiment with different sorts of control over the iteration,
different meshes, and different values for Re and Pen.
[
Another interesting exercise is to try to obtain a plot of the pressure