Manual
  Numeric module
  [install dir]/include/csfl/num
   


The numeric module is responsible for the problem modeling of the computational fluid dynamics, allowing the formulation of the joining pressure-speed together with the energy equation. The main classes are derived of a "sequencer" (ISequencer class), responsible for the implementation of the iterative solution of the numeric problem.


- Sequencer:

The hierarchy of the sequencer class (ISequencer) is organized according to the figure 1, presenting the several derived classes. The use of this hierarchy classes can be seen as:

- for the solution of the energy equation, it is enough to create as sequencer the ISequencerEnergy class; 

- for resolution of the momentum equations (in the directions u and v) and the mass conservation we can use the ISequencerSimple or ISequencerSimplec, in agreement with the method of joining pressure-speed that will be use;

- If the problem demands the solution of the four equations mentioned the sequencer above should be of the ISequencerSimpleEnergy or ISequencerSimplecEnergy type (examples of the sequencer applications can be seen in the tutorials 5).

   


Figure 1: Hierarchical organization of the sequencer classes.
   

- Simulation:

After having done the declaration and configuration of an object of the "sequencer" type (see the tutorials) the Run () function must be called of the same to make the simulation. The iterative process (created by the Run () function for each sequencer type) can be seen in the figures 2-4.
   

Figure 2: Iterative looping of the ISequencerEnergy.



Figure 3: Iterative looping of the ISequencerSimple and ISequencerSimplec.



Figure 4: Iterative looping of the ISequencerSimpleEnergy and ISequencerSimplecEnergy
   

The different sequencers types allow several internal configurations through its function-member. The most used function-member is explained and exemplified in the tutorials. The others are approached in the manual classes of the library.


- The results exit :
The numeric module has the ISequencerIO class with methods that allow the exits in screen or file of the several attributes of the sequencer that it is being used (see the tutorials).

- Actions:


The interaction with the user during the simulation the library is accomplished by the actions. These actions, placed in strategic points inside of the iterative looping, makes the methods call to them attributed. The user can attribute a method for each action that will be executed when the iterator reaches the call of the respective action (see the tutorials for the use of the actions). For a function to be executed through an action it should belong to a derived class of the ISFLObject class, to receive as parameter an object of the ISFLObject type and to return void. The action will always pass as parameter for the function the pointer "this" of the class where the action meets.

Example: a function puts in the screen the errors of each iteration in the resolution of a linear system. The declaration of the class and of the function could be something as:

   


class IMonitor :
public ISFLObject
{
public:
IMonitor() : ISFLObject(), count( 0 ) {}
void OutputSolverError( ISFLObject *_object )
{
  ISolverIteract *solver = NULL;
solver = dynamic_cast<ISolverIteract*>( _object );
if ( solver == NULL )
return;
 count++;
::cerr << count << ": " << solver->SolverError() << ::endl;
}
private:
  int count;
};

   

With this we will attribute to the ActionSolve action (originating from some iterative solver of the library) the OutputSolverError function of the IMonitor class. Like this, if the TDMA solver was used we would have the following code:


   


IMonitor *output = new IMonitor();

ISolverIterTdma *solver = new ISolverIterTdma( lsys, 1.0e-05, 1000 );
solver->ActionSolve = ExecuteMethod(&IMonitor::OutputSolverError,output);

   

In the code above, the lsys object represents the linear system (ILinearSystem) that the solver will solve. By this way, for each iteration of the solver it will leave in the screen the accountant's value (count) and the current error.

- The “Actions” map:

In the figures 5-7 are indicated the actions positions inside of the sequencer after the call of the Run () function. Each number in the figures below represents an action listed in the Table 1.


   
Figure 5: Actions starting from the Run () function of the ISequencerEnergy.




Figure 6: Actions starting from the Run () function of the ISequencerSimple and ISequencerSimplec.




Figure 7: Actions starting from the Run () function of the ISequencerSimpleEnergy and ISequencerSimplecEnergy.



    Table 1: Relation of the actions and classes to which they belong .
. . . Action Classe .
1 . . ActionRequestRun ISequencer .
2 . . ActionRequestBegin ISequencer .
3 . . ActionBegin ISequencer .
4 . . ActionRequestIteract ISequencer .
5 . . ActionRequestSolutionTemperature ISequencerEnergy .
6 . . ActionSolutionTemperature ISequencerEnergy .
7 . . ActionSolutionTemperatureError ISequencerEnergy .
8 . . ActionIteract ISequencer .
9 . . ActionRequestEnd ISequencer .
10 . . ActionEnd ISequencer .
11 . . ActionRequestSolutionPV ISequencerPV .
12 . . ActionRequestIteractPV ISequencerPV .
13 . . ActionIteractPV ISequencerPV .
14 . . ActionPVError ISequencerPV .
15 . . ActionSolutionPV ISequencerPV .
16 . . ActionSolutionPVError ISequencerPV .
17 . . ActionTemperatureError ISequencerEnergy .
18 . . ActionIteractError ISequencerSimple(c)Energy .
19 .   ActionSolutionError ISequencerSimple(c)Energy .



   

In the PVCoupling () function exist actions that were not mentioned in the list of the Table 1. This function accomplishes four steps: 

1. Calculation of the estimates speeds: the actions ActionCalculateUVelocity and ActionCalculateVVelocity, located respectively after the estimate of the speeds U and V. 

2. calculation of P' (correction of the pressure field): the actions ActionCalculateFaceVelocity and ActionCalculatePLine; a

3. correction of the pressure field: at the end of the step is the action ActionUpDatePressure; 

4. correction of the speeds: the actions ActionUpDateFaceVelocity and ActionUpDateVelocity. 

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