Manual
 Geometric Module
  [install dir]/include/csfl/geom
   

The geometric module gathers the necessary classes for geometries manipulation and its transformations (metric), allowing the generation and manipulation of the simulation numeric grid (class IGrid). The main operations are: generation, edit, merge, import and export in files ASCII (format " .sdf " and " .dat ").

The library CSFL-lib 1.0, had discreted the conservation equations in a system of general coordinates, it doesn't present any restriction in relation to grid to be used, since the same is structured [Maliska 2004].

The general curvilinear coordinates system allows the resolution of problems defined in complex geometries without the need of modifying the code computational then.

Great part of the difficulty found in the problems resolution defined in arbitrary geometries resides then in the obtaining of the grids that wich they will describe the physical domain.

In the library CSFL-lib 1.0 the geometry discretization can be made of four ways different:

  • Loading grids from file; 
  • Through special classes that represent geometries pre-definite;
  • Through routines for generation of the curvilinear coordinates system;
  • Through the function MergeGrids.

The different ways for obtaining of grids will be commented to proceed.

Notes: You should remember that in the library CSFL-lib 1.0 the referring information the problem geometry is controlled for the class IGrid or derived one of yours deriveds.


  Opening the grid from file
   

The CSFL-lib-1.0 library allows the grid to be used in the problem resolution to be opened from a file with the sdf format (standard dot file).

The file with sdf extension contains all the information about the grid:

  • The control volumes number in the direction i;
  • The control volumes number in the direction j;
  • The coordinates points that constitute the grid list.

The file structure is simple, what allows the user to edit his documents.

The edited grids in GridEditor 2.0 can also be saved with the format sdf.

Next will be presented the contents from “teste.sdf” file what represents the geometry of Figure 1.

   


xiso
Grid2D Created with CFD Sinflow Library 1.0 - SINMEC/UFSC/BR
Read/Write Sequence: row x columns
ni 3
nj 2
values
0 0
0.5 0.5
1 0
1.5 0.5
0 1
0.2 1.5
1 1
1.5 1.5
0 2
0.5 2
1 2
1.5 2

     
   
Figure 1 – Specified geometry by file “teste.sdf”, The yellow line represents domain south face.

     
   

The first three lines of the file are not considered for determination of the grid. They are generic information about the grid, which the contents is up to the user.

The grid fourth line informs the control volumes in the direction i number. The fifth line informs the control volumes in the direction j number.

Starting at the seventh line the values of the grid knots coordinates x and y are presented.

The values presented in the sense line X column, it means, the values x and y of the lines 7, 8, 9 and 10 represent the line in yellow of the Figure 1.

The next Code demonstrates the process of reading the grid by CFD SinFlow 1.0 Library:

     
   


IGrid grid;

// Mesh input file

::istream fg( "teste.sdf"); 

grid.Read(fg); 

fg.close();

   

Here the object grid is created through its building default [Barton 1994], because no argument was passed in its declaration. The building default of the IGrid object creates a 0x0grid, that is to say, a Grid where all the parameters are null.

Only when the Read (fg) function grid is called the object grid starts to represent the geometry defined in the Figure 1.

Note: The Read (: :istream &) function overwrite the grid previously stored by the IGrid object, independently of its the size.



  Special Classes that represent predefined Geometries
   


The CSFL-lib-1.0 library has a derived classes series of the IGrid class and they represent predefined geometries, facilitating the problem resolution defined in simple geometries.

The different classes will be commented after:

   

IgridCartesian Class:

   

The IGridCartesian class represents a Cartesian grid equally spaced.

In the declaration of an IGridCartesian object are passed as parameters:

  • the control volumes number in the direction x;
  • the control volumes number in the direction h;
  • the spacing value of the grid in the direction x;
  • the spacing value of the grid in the direction h;
  • the angle between the lines x and h. For an inclined cavity resolution it is enough to vary this argument value.

  Next, will be demonstrate how an object declaration of the IGridCartesian class should be made:


   


int ni = 5;
int nj = 5;
double dx = 0.2;
double dy = 0.2;
double angulo = 60.0;

IGridCartesian grid( ni, nj, dx, dy, angulo );

   
The object grid above represents the geometry illustrated in the Figure bellow:

   

Figure 2 – Cartesian Grid Equally Spaced.

     
    IgridNoEqualCartesian Class
   

The IGridNoEqualCartesian class represents a non-uniform Cartesian grid.

In the declaration of an IGridNoEqualCartesian object are passed as parameters:

  • the control volumes number in the direction x;
  • the control volumes number in the direction h ;
  • A pointer for a vector that stores the grid spacing values in the direction x;
  • A pointer for a vector that stores the grid spacing values in the direction h.

Next, will be demonstrate how an object declaration of the IGridNoEqualCartesian class should be made:

   


int ni = 2;
int nj = 2;
Vector dx(2);
Vector dy(2);

dx(0) = 0.5;
dx(1) = 1.0;

dy(0) = 0.5;
dy(1) = 1.0;

IGridNoEqualCartesian grid( ni, nj, &dx, &dy );

   
The grid object above represents the geometry illustrated in the Figure bellow:

   

Figure 3 – Cartesian Grid non-uniform.

   



IgridPolar Class

   

The IGridPolar class represents a polar uniform grid.

In the declaration of an IGridPolar object are passed as parameters:

  • the control volumes number in the direction x ;
  • the control volumes number in the direction h ;
  • the internal radius value;
  • the external radius value;
  • the initial angle value;
  • the final angle value.

Next, will be demonstrate how an object declaration of the IGridPolar class should be made:


   


int ni = 5;
int nj = 3;
double ri = 0.5;
double re = 1.0;
double anguloinicial = 0.0;
double angulofinal = 100.0/180 * 3.141592;


IGridPolar grid( ni, nj, ri, re, anguloinicial, angulofinal );


   
The grid object above represents the geometry illustrated in the Figure bellow:
   

Figure 4 – Polar Grid Equally Spaced.

   

IgridNoEqualPolar Class
   

The IGridNoEqualPolar class represents a non-uniform grid polar.

In the declaration of an IGridNoEqualPolar object are passed as parameters:

  • The control volumes number in the direction x ;
  • The control volumes number in the direction h ;
  • A pointer for a vector that stores the polar grid radiuss values in the direction x;
  • A pointer for a vector that stores the grid angles values in the direction h.

Next, will be demonstrate how an object declaration of the IGridNoEqualPolar class should be made:

   
 
int ni = 2;
int nj = 2;
Vector r(3);
Vector angulo(3);

r(0) = 0.5;
r(1) = 1.0;
r(2) = 3.0;

angulo(0) = 0.0;
angulo(1) = 3.1415/4.0;
angulo(3) = 3.1415;

IGridNoEqualPolar grid( ni, nj, r, angulo );
   
The grid object above represents the geometry illustrated in the Figure bellow:

   

Figure 5 – Polar Grid non-uniform.

   
IgridMixed Class
   
The IGridMixed class represents one grid in a mixed geometry, Figure 6.

   

Figure 6 – Mixed geometry.

   


In the declaration of an IGridMixed object are passed as parameters:

  • the control volumes number in the direction x;
  • the control volumes number in the direction h;
  • the value of the radius of the mixed grid;
  • the rectangular area height value of the mixed grid;
  • the rectangular area width value of the mixed grid.

Next, will be demonstrate how an object declaration of the IGridMixed class should be made:


   


int ni = 3;
int nj = 6;
double r = 1.0;
double w = 0.6;
double h = 0.4;

IGridMixed grid( ni, nj, r, w, h );

   
The grid object above represents the geometry illustrated in the Figure bellow:

   

Figure 7 – Mixed Grid.

   

IGridTrapezoidal Class
   


The IGridTrapezoidal class represents a grid defined in a geometry defined by four points.

In the declaration of an IGridTrapezoidal object are passed as parameters:

  • the control volumes number in the direction x;
  • the control volumes number in the direction h;
  • the Southwest geometry Point;
  • the Southeast geometry Point;
  • the Northwest geometry Point;
  • the Northeast geometry Point.

Next, will be demonstrate how an object declaration of the IGridTrapezoidal class should be made:

   


int ni = 3;
int nj = 6;
IDPoint so, se, no, ne;

so = IDPoint( 0.0, 0.0 );
se = IDPoint( 5.0, 1.0 );
no = IDPoint( -1.0, 3.0 );
ne = IDPoint( 0.5, 6.0 );

IGridTrapezoidal grid( ni, nj, so, se, no, ne );

   
The grid object above represents the geometry illustrated in the Figure bellow:

   

Figure 8 – Trapezoidal Grid.

   
IGridSpiral Class
   


The IGridSpiral class represents a grid defined in a spiral form geometry.

In the declaration of an object IGridSpiral are passed as parameters:

  • the control volumes number in the direction x ;
  • the control volumes number in the direction h ;
  • the initial internal radius;
  • the final internal radius;
  • the radius initial external;
  • the final external radius;
  • the initial angle;
  • the final angle. 

Next, will be demonstrate how an object declaration of the IGridSpiral class should be made:


   


int ni = 4
int nj = 11;

double ri_inicial = 0;
double ri_final = 2;
double re_inicial = 1;
double re_final = 4;
double angulo_inicial = 0;
double angulo_final = 2* 3.1415;

IGridSpiral grid( ni, nj, ri_inicial, ri_final, re_inicial, re_final,
angulo_inicial, angulo_final);


   
The grid object above represents the geometry illustrated in the Figure bellow:

   

Figure 9 – Grid for one spiral geometry.

     
  Routines of Curvilinear Coordinates Generation
   


Others tools available in the CSFL-lib-1.0 library for the complex geometries discretization are the widespread curvilinear coordinates system generation routines. In this case the problem geometry contour is just specified and the lines coordinates are obtained numerically.

In the CFD SinFlow Library 1.0 the curvilinear coordinates system generalized can be obtained through methods that use differential elliptic equations or through Lagrange interpolation and Hermite of first order [Maliska 2004].


   
Figure 10 – Ring geometry to be discritized.

   
1) Geometry
   


In first place you should specify the points that will define the geometry problem, that means, specifiy the points that constitute the external contour of the grid.

The class that stores an object contour is the IDPolygon class that represents a polygon.

   

To use the IDPolygon class the user must include the file:

include <csfl/sys/geom/dpolygon.h>

To specify the grid external points the user must in first place determine the control volumes number that will be generated in the directions i and j.

   
In the CFD SinFlow Library 1.0 was assumed that the first polygon point would be the Northwest domain point.

It is now necessary to specify the points that will define the internal domain area (area in red of the Figure 10).

These points are fixed points of the domain and will be passed as parameters for the coordinates generation differential elliptic equations.

The class that stores the fixed domain points is the IFixedNode class. (for more details see the tutorial 5)

   

Below other grid obtained with the coordinates generation routines is presented, and this mesh generation code can be found in the file:

[CSFLinstalldir] /examples/source/con_mesh/kernel/con_mesh_kernel_mesh.cpp


   


Figure 11 – Grid obtained with the generation system of curvilinear coordinates routines.

     
  Merge Grids Function
   


Another available tool in the CFD SinFlow Libradius 1.0 for grids generation is the Merge Grids function.

This function allows two grids junction in only one grid, allowing the geometries creation relatively complex, but that can be divided in simple areas for later on be united.

Note: the user should remember that the CSFL-lib-1.0 library just works with structured grids and it doesn't use the multi-blocks technique, for this reason the two grids to be united should have in the junction face the same control volumes number.


   


Figure 12 – Geometry in U form.

   
The geometry represented above can be divided in three discretization, represented below:

   


Figure 13 – Dute division in three parts.

   


The IMergeGrids () function receives as parameters:

  • the address of the first IGrid object that you want to be unite;
  • the address of the second IGrid object that you want to be unite;
  • one TDirection type identifier, that indicates in which face of the first IGrid object the union will happen;
  • one TDirection type identifier will be accomplished, that indicates in which face of the second IGrid object the union will happen;
  • one boolean will be accomplished indicated that the second IGrid object should be moved until that the faces coincide.

The IMergeGrids () Function returns a pointer for an IGrid object type.

The first step is to unite the area 1 with the area 3. In this case the faces to be united are the area 1 east face and the area 3 South face (Figure 13).

    The gridm pointer was created to receive the value returned by the MegeGrids() function. This pointer is passed to the merge1 object copy building [Barton 1994]; witch represents the area 13 in Figure 14.

   


Fig. 14 – Situação após a primeira união.

   


The union was only possible because the control volumes number in the south face of the area 3 coincided with the control volumes number of the face east of the area 1, otherwise the MergeGrids () function would return to a null pointer.

The merge1object borders represented in the Figure 14 were determinated after the mesh Northwest point analysis, because the MergeGrids () Function doesn't conserve the original objects borders orientation.


   

Figure 15 – Grid for tube in U obtained with the MergeGrids() function.

   



Next, another grid obtained with the MergeGrids() function. This grid generation code can be found in the file:

[CSFLinstalldir]/examples/source/con_mesh/kernel/con_mesh_kernel_mesh_merge2.cpp


   

Figure 16 – Grid obtained with the MergeGrids() function for one contraction canal. It was used two Cartesian grids and one trapezoidal grid.

 
© SINMEC/EMC/UFSC, 2001. All rights reserved.