[Kratos] Passing information to conditions

Jordi Cotela jcotela en cimne.upc.edu
Mar Oct 5 09:59:07 CEST 2010

Hello Giuseppe,
Riccardo and I have been discussing the problem you have with your
condition. We think that it is an interesting question, so I have taken
the liberty to send a copy of the answer to the Kratos mailing list.

There are different ways you can pass information to a Condition (or to
an Element) and I will discuss some of them briefly.

The most obvious one you already tried, which is using nodal data. This
option is good for data that changes between nodes, but not optimal
otherwise (specially in terms of memory occupation, as you are storing a
lot of duplicate data).

An alternative is to define it as a material property. This is a good
option for variables that can take (a limited number of) different
values in different regions of your model.

Finally, for variables that you need to define once per model (even if
they change in time), the recommended option is to pass them as Process

In the three cases discussed above, you need to declare the data you
will provide as a Kratos variable. You can define a new variable for
your application using the KRATOS_DEFINE_VARIABLE and
KRATOS_CREATE_VARIABLE macros (see examples in
incompressible_fluid_application.h and .cpp or any other application).

If you create a variable using type "Matrix", you will be able to resize
it using the matrix .resize(NumRows,NumColumns) method.

To access a variable from your code:
- For nodal variables, see the related how-to in the wiki
- For material properties you need to use the GetProperties() method of
the corresponding element object. for example, you could access it from
your condition class with "this->GetProperties()[VARIABLE]"
- For process info, you can only access it in functions that receive a
ProcessInfo& as input. In this case, you would do

Feel free to contact for more detailed instructions.

Jordi Cotela Dalmau

Les dades de caràcter personal contingudes en aquest missatge es
registraran en un fitxer per facilitar la gestió de les comunicacions
del CIMNE. Es poden exercir els drets d'accés, rectificació,
cancel·lació i oposició, per escrit a les nostres oficines del CIMNE,
Gran Capità s/n, Edifici C1, Campus Nord UPC, 08034 Barcelona, Espanya.

Los datos de carácter personal contenidos en el mensaje, se registrarán
en un fichero para facilitar la gestión de las comunicaciones de CIMNE.
Se pueden ejercitar los derechos de acceso, rectificación, cancelación y
oposición por escrito, dirigiéndose a nuestras oficinas de CIMNE, Gran
Capitán s/n, Edificio C1 - Campus Norte UPC, 08034 Barcelona, España.

All personal data contained in this mail will be processed
confidentially and stored in a file property of CIMNE in order to manage
corporate communications. You may exercise the right of access,
rectification, deletion and objection by letter sent to CIMNE, Gran
Capitán, Edificio C1 - Campus Norte UPC, 08034 Barcelona, Spain.

More information about the Kratos mailing list