How to Access DataBase

From KratosWiki
(Difference between revisions)
Jump to: navigation, search
Line 10: Line 10:
 
The "Nodes" constitute one of the building blocks of the Kratos interface and provide the richest database structure. Conceptually each nodes allocates a portion of memory sufficient to contain a database with all of its data.  In the practice the memory needed is defined by the user which at the beginning of the program has to select and add to the model part the list of variables that will be needed during the analysis.
 
The "Nodes" constitute one of the building blocks of the Kratos interface and provide the richest database structure. Conceptually each nodes allocates a portion of memory sufficient to contain a database with all of its data.  In the practice the memory needed is defined by the user which at the beginning of the program has to select and add to the model part the list of variables that will be needed during the analysis.
  
As a concept we should also note that for some variables a "history" (the value of this variables in the past steps) will be needed, while for others only the current value will be necessary. In order to make this possible the Kratos provides two different implementations for the "Historical Database" and for the "Non-Historical one". The two databases are independent from each other and  
+
As a concept we should also note that for some variables a "history" (the value of this variables in the past steps) will be needed, while for others only the current value will be necessary. In order to make this possible the Kratos provides two different implementations for the "Historical Database" and for the "Non-Historical one".  
 +
 
 +
The two databases are independent from each other and '''are not syncronized'''
 +
 
 +
=== Historical Database ===
 +
The "Historical Database" stores the present value of a variable and the value it took in the previews steps. The Number of steps stored depends on the size of "Buffer". This can be modified by the function "SetBufferSize" while the present value can be obtained by "GetBufferSize()"
 +
 
 +
to make an example
 +
  model_part.SetBufferSize(3)
 +
  unsigned int model_part.GetBufferSize(); ##now outputs 3
 +
implies storing the current step + the 2 last steps.
 +
 
 +
The list of the variables to be stored and the buffer size needs to be known in order to use the Historical Database. This is obtained by providing at the beginning of the analysis the list of all the variables that will be involved in the calculation.
 +
to make an example if a given solver will need the variables TEMPERATURE and VELOCITY, the user should provide '''before creating the list of nodes''' the two commands
 +
  model_part.AddNodalSolutionStepVariable(TEMPERATURE)
 +
  model_part.AddNodalSolutionStepVariable(VELOCITY)
 +
In the practice each solver provides the list of its variables through the function AddVariables(...) (examples of this can be found in any of the "test examples"
 +
 
 +
=== Non-Historical Database ===
  
  
 
== Elemental Database ==
 
== Elemental Database ==

Revision as of 14:54, 30 November 2007

Accessing to the database is one of the most frequent operations in a Finite Element context.

In a Finite Element context we often need to store information on the Nodes and on the Elements. This data may take different forms (scalars, vectors, matrices ... ) and needs to be widely accessible inside a finite element program. In the Kratos, this data is stored direcly in the objecect from which it will be accessed, meaning that the nodes will contain the nodal data, and the elements the elemental data.

The Kratos provides both a nodal and elemental "Variable Database", which allows to store in a flexible way VARIABLES of different type. A detailed description of the design concepts together with a study of the perfomance issues can be found in Pooyan's Thesis. The aim of current "How To" is just to provide a brief introduction on the usage of the cpp interface.


Contents

Nodal Database

The "Nodes" constitute one of the building blocks of the Kratos interface and provide the richest database structure. Conceptually each nodes allocates a portion of memory sufficient to contain a database with all of its data. In the practice the memory needed is defined by the user which at the beginning of the program has to select and add to the model part the list of variables that will be needed during the analysis.

As a concept we should also note that for some variables a "history" (the value of this variables in the past steps) will be needed, while for others only the current value will be necessary. In order to make this possible the Kratos provides two different implementations for the "Historical Database" and for the "Non-Historical one".

The two databases are independent from each other and are not syncronized

Historical Database

The "Historical Database" stores the present value of a variable and the value it took in the previews steps. The Number of steps stored depends on the size of "Buffer". This can be modified by the function "SetBufferSize" while the present value can be obtained by "GetBufferSize()"

to make an example

  model_part.SetBufferSize(3)
  unsigned int model_part.GetBufferSize(); ##now outputs 3

implies storing the current step + the 2 last steps.

The list of the variables to be stored and the buffer size needs to be known in order to use the Historical Database. This is obtained by providing at the beginning of the analysis the list of all the variables that will be involved in the calculation. to make an example if a given solver will need the variables TEMPERATURE and VELOCITY, the user should provide before creating the list of nodes the two commands

  model_part.AddNodalSolutionStepVariable(TEMPERATURE)
  model_part.AddNodalSolutionStepVariable(VELOCITY)

In the practice each solver provides the list of its variables through the function AddVariables(...) (examples of this can be found in any of the "test examples"

Non-Historical Database

Elemental Database

Personal tools
Categories