Model and integral operators¶
tamaas::Model (and its counterpart
Model) is both a central class in Tamaas and one of the simplest. It mostly serves as holder for material properties, fields and integral operators, and apart from a linear elastic behavior does not perform any computation on its own.
Model type used in normal frictionless contact: traction and displacement are 2D fields with only one component.
Model type used in frictional contact: traction and displacement are 2D fields with three components.
Model type used in elastoplastic contact: tractions are the same as with
tamaas::surface_2dbut the displacement is a 3D field.
The enumeration values suffixed with
_1d are the one dimensional (line contact) counterparts of the above model types. The domain physical dimension and number of components are encoded in the class
Model creation and basic functionality¶
physical_size = [1., 1.] discretization = [512, 512] model = tm.ModelFactory.createModel(tm.model_type.basic_2d, physical_size, discretization)
For models of type
volume_*d, the first component of the
discretization arrays corresponds to the depth dimension (\(z\) in most cases). For example:
tm.ModelFactory.createModel(tm.model_type.basic_2d, [0.3, 1, 1], [64, 81, 81])
creates a model of depth 0.3 and surface size 12, while the number of points is 64 in depth and 812 on the surface. This is done for data contiguity reasons, as we do discrete Fourier transforms in the horizontal plane.
If ran in an MPI context, the method
createModel expects the global system sizes
and discretization of the model.
Deep copies of model objects can be done with the
import copy model_copy = copy.deepcopy(model)
Note that it only copies fields, not operators or dumpers.
nu can be used to set the Young’s modulus and Poisson ratio respectively:
model.E = 1 model.nu = 0.3
Fields can be easlily accessed with the
 operator, similar to Python’s dictionaries:
surface_traction = model['traction'] # surface_traction is a numpy array
To know what fields are available, you can call the
list function on
a model (
list(model)). You can add new fields to a model object with the
model['new_field'] = new_field, which is convenient for
dumping fields that are computed outside of Tamaas.
A model can also be used to compute stresses from a strain field:
import numpy strain = numpy.zeros(model.shape + ) # Mandel--Voigt notation stress = numpy.zeros_like(strain) model.applyElasticity(stress, strain)
print(model) gives a lot of information about the model: the model type,
shape, registered fields, and more!
Integral operators are a central part of Tamaas: they are carefully designed for
performance in periodic system. When a
object is used with contact solvers or with a residual object (for plasticty),
the objects using the model register integral operators with the model, so the
user typically does not have to worry about creating integral operators.
Integral operators are accessed through the
operators property of a model object. The
operator gives access to the operators, and
list(model.operators) gives the
list of registered operators:
# Accessing operator elasticity = model.operators['hooke'] # Applying operator elasticity(strain, stress) # Print all registered operators print(list(model.operators))
At model creation, these operators are automatically registered:
hooke: Hooke’s elasticity law
von_mises: computes Von Mises stresses
deviatoric: computes the deviatoric part of a stress tensor
eigenvalues: computes the eigenvalues of a symetric tensor field
The submodule tamaas.dumpers contains a number of classes to save model data into different formats:
pip install uvw
This dumper is made for visualization with VTK based software like Paraview.
Dumps a model to a compressed Numpy file.
The dumpers are initialzed with a basename and the fields that you wish to write to file (optionally you can set
True to dump all fields in the model). By default, each write operation creates a new file in a separate directory (e.g.
UVWDumper creates a
paraview directory). To write to a specific file you can use the dump_to_file method. Here is a usage example:
from tamaas.dumpers import UVWDumper, H5Dumper # Create dumper uvw_dumper = UVWDumper('rough_contact_example', 'stress', 'plastic_strain') # Dump model uvw_dumper << model # Or alternatively model.addDumper(H5Dumper('rough_contact_archive', all_fields=True)) model.addDumper(uvw_dumper) model.dump()
model.dump() call will trigger all dumpers. The resulting files will have the following hierachy:
./paraview/rough_contact_example_0000.vtr ./paraview/rough_contact_example_0001.vtr ./hdf5/rough_contact_archive_0000.h5
parallel output with MPI.