The Problem.
The Navier-Stokes equations are given by
where
|
The domain is a bend with the following 4 boundaries:![]() |
These conditions are assigned to the boundary pieces:![]() |
Use PDELab to ...
Why use PDELab?
Step 1:When PDELab top level window appears,
select 2-D and
FDM
and click on
New File.
The PDELab 2-D Finite Difference Method Session appears.
The Session toolkit is to the right of the Session window.
Step 2: Click on the Framework Editor in the Session toolkit.
Step 3: Choose CADSOL from the Framework menu.
The Framework Editor allows users to select the framework for defining the problem.
In this case, selecting CADSOL tells the symbolic processor that
Jacobians must be computed for the PDE System and for the boundary conditions
which are entered by the user. The framework selection also signals the fortran code generator that
CADSOL format functions must be generated.
Enter 3
for the Number of Equations and
click on PDE System.
Enter the Navier-Stokes equation in the PDE System editor as shown here. Click on
Done when finished.
Step 4: Since CADSOL requires that the general domain specified by the user must be
mapped to a rectangle, the number of boundary conditions for a CADSOL problem is 4.
Therefore, the Number of Boundary Pieces field cannot be modified when the CADSOL framework
is selected. Click on Boundary Conditions to
enter the four sets of boundary conditions. Three equations are entered for each of the four
boundary pieces in the mapped domain. Click on OK
when finished.
Click on the Non-Linear Info button so that the
specialized parameters for non-linear problems can be entered. These parameters are
Tolerance, Maximum Number of Iterations, and the Initial Guess for the solution
components U1, U2 and U3. We use the default values for all
parameters, and use zero as the initial guess for all solution components. Click on
OK when finished.
Step 5:The information for the PDE system and boundary conditions has now been entered.
Click on Generate Framework. The Maxima symbolic processor
is accessed for the Jacobian computations, and the GenCray fortran code generator
generates the appropriate fortran functions for the CADSOL problem specification.
Any input errors are tagged by Maxima and printed out in the Maxima window of the Framework Editor.
When the input has been successfully processed, select
Quit from the File menu.
The PDELab language program appears in the Session window. Click
here to see a portion of this generated program.
The
entire program, including all symbolic computations and all CADSOL definition fortan routines,
is generated automatically by PDELab.
Look at the functions that define the PDE and boundary conditions (cdsu01, cdsu02),
the functions that define the Jacobian (cdsu03, cdsu04), and the "guess" function.
The call to the CADSOL solver appears as a PDELab triple. The default values for
order (2),
linear system solver method (10), and
tolerance (10-4) appear as
parameters to the CADSOL triple. Note that one of the CADSOL parameters requests PDELab format output .
Additional output in the neutral format (for the mesh) and component
format (for the solution values) will be generated automatically, unless otherwise specified.
Step 6: We will now specify the domain. We could draw the domain using the 2D BoundaryTool, but decide instead to write our own parameterization of the boundary of the domain directly in the Session window. Click on the bar at the top of the session window : Click here to edit session. Change the boundary segment from
boundary.
cadsol on x = 0
on x = 1
on y = 0
on y = 1
to
boundary. cadsol on x=cos(t),y=sin(t) for t= 0. to 3.1416 cadsol on x=t, y=0 for t= -1.0 to -2.0 cadsol on x=2.*cos(t),y=2.*sin(t) for t=3.1416 to 0. cadsol on x=t, y=0 for t= 2.0 to 1.0
Step 7: Click on the 2D BoundaryTool. The
parameterized boundary we just defined is dynamically loaded into PDELab
(assuming you had no typing errors in the boundary definition).
If you click on
Set Conditions, you will see that the
conditions are set to "cadsol". This is correct!
You have already specified the boundary conditions in the Framework Editor, and the
functions describing those conditions are in the subprograms segment.
Click on Cancel to dismiss the Boundary Conditions Editor.
WARNING! In the CADSOL framework, it is the user's responsibility to
make sure that the numbering of the boundary conditions given in the
Framework Editor corresponds to the numbering of the boundary pieces in the
domain definition. Click on Show Piece # and check that the piece numbering does
indeed correspond to the order in which the boundary conditions were given in the
Framework Editor.
Step 8:We will now generate the body-oriented grid. Do not close the BoundaryTool;
it must be up when the Grid Generator is invoked.
Click on the GridGenerator.
The domain boundary appears in the window with the piece numbers identified.
Click on Define Mapping. The default mapping of a four piece boundary to a rectangle is the Identity Map. Note that when your domain has more than four pieces, you must enter a correct mapping of those pieces to a rectangle. Click on Cancel to dismiss the Define Mapping editor, and click on Set Mesh Points. Pieces 1 and 3 will have 60 grid points, and pieces 1 and 3 will have 10 points (the default). Enter 60 for pieces 1 and 3 and then click on Continue.
We can now generate the body-oriented grid. Click on
Generate Mesh. The resulting mesh is shown to the left.
Click on Save to save the grid to a PDELab format file.
A File Name dialog appears, and you must specify a name for the
body-oriented grid file. Then click on
OK to dismiss the dialog. A mesh segment will appear in the
Session window. It is placed immediately after the boundary segment and
indicates that a file containing the body-oriented grid now exists and will be
used in the problem solution process.
mesh.
read structured from file &
(filename='navier.grid', &
i1mtyp=5, nx=11, ny=61, meshtype=5)
You can now close the Grid Generator by clicking on
Quit. Then close the BoundaryTool by clicking on
Quit.
Step 9: you can view the CADSOL solver parameters by bringing up the `triple' menu. Any CADSOL parameter that may be set by the user is listed here. You can view and/or modify the values for any of the parameters. Dismiss the Module Specification Editor by clicking on Cancel.
Step 10: You can save the PDELab language program to a `.e' file by clicking on the SaveAs button in the Session toolkit. A File Name dialog requests a name for the .e file.
Step 11: We are now ready to enter the ExecuteTool environment, where the
PDELab language program will be processed. A fortran main program will be generated
from the .e file. It will be compiled and linked with the PDELab module libraries and
the standard PDELab I/O libraries. Click on the
ExecuteTool button in the Session toolkit.
Step 12: The PDELab .e file is loaded
automatically.
Click on the Run button
The trace of the process for compiling and linking the PDELab executable appears
in the trace window. When the compiling and
linking process is complete, the executable program is run and the solution and
trance files are generated and placed in your user directory.
Click on Quit to exit the ExecuteTool.
Step 13:
The solution output has been generated during execution.
You should find the output file containing the PDELab format data in the
location specified by the save segment. If no path was specified,
this file is located in the execution directory.
The file contains the solution and its derivatives.
Click on the OutputTool in the Session toolkit.
Select PDELab Solution in the File menu. Select
the output file that was generated by your program when the OutputTool requests the file name.
The Select Solution Box is displayed after the two files are loaded.
The selection box contains the solutions for U1, U2 and U3.
![]() Velocity in the X-direction. |
![]() Velocity in the Y-direction. |
![]() The Vorticity. |
Step 14: Select U1 from the Select Solution Box. Then choose the Contour2D visualization package and press Run Tool. When the visualizer is displayed, select Render Contour from the View menu. The solution u is shown. Select File-Quit-OK to exit the tool. You can return to the OutputTool and from the Solutions Selection Panel under Solutions in the OutputTool menu bar, de-select U1 and select U2. In the same manner, use Contour2D to visualize U2. Select File-Quit-OK to exit the tool. Similary, view U3 with Contour2D.