doc:user:tutorials:tuto1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:user:tutorials:tuto1 [2014/05/07 16:30] – [En vidéo] boman | doc:user:tutorials:tuto1 [2016/07/11 16:45] (current) – [Temporal Integration] boemer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | |
+ | ====== | ||
Line 7: | Line 8: | ||
- | Je suppose dans cette section que vous avez suivi et compris le document [[doc: | + | Before reading this page, the document [[doc: |
- | + | ||
- | + | ||
- | + | ||
- | Sur cette page, je décris, ligne après ligne, les étapes qui mènent à la mise au point d' | + | |
- | + | ||
- | + | ||
+ | In the following document are described, line after line, the steps leading to the development of a input file where a cylindrical die will crush a block of material in plane strain. Here is a preview of the final deformation. | ||
< | < | ||
Line 27: | Line 22: | ||
\\ | \\ | ||
+ | Since Metafor is continuously improved and modified, the syntax of some commands may have slightly changed since the writing of this documentation. However, this input file is part of the [[doc: | ||
- | Vu que Metafor est en constante évolution, il est possible que la syntaxe de certaines commandes ait changé. Ce test fait partie de la [[doc: | + | ===== Input-file Description ===== |
+ | A Metafor input file is a Python module which defines an object called '' | ||
+ | {{ doc: | ||
+ | To sum up, one input file = one (or several) Python files = one Metafor object. | ||
+ | ==== Heading ==== | ||
- | + | The module | |
- | + | ||
- | ===== Description du jeu de données ===== | + | |
- | + | ||
- | + | ||
- | + | ||
- | Un jeu de données Metafor est un module | + | |
- | + | ||
- | + | ||
- | + | ||
- | {{ doc: | + | |
- | + | ||
- | + | ||
- | + | ||
- | __En résumé:__ un jeu de données = un (ou plusieurs) fichiers python = un objet '' | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ==== Entête ==== | + | |
- | + | ||
- | + | ||
- | + | ||
- | Le module débute avec quelques commentaires | + | |
- | + | ||
# -*- coding: latin-1; -*- | # -*- coding: latin-1; -*- | ||
Line 74: | Line 42: | ||
# Tutorial | # Tutorial | ||
- | + | The line " | |
- | + | ||
- | La ligne " | + | |
- | + | ||
from wrap import * | from wrap import * | ||
import math | import math | ||
- | + | The first line imports the Python/C++ interface of Metafor (called | |
- | + | ||
- | Comme tous les [[doc: | + | The '' |
- | + | ||
metafor = Metafor() | metafor = Metafor() | ||
domain = metafor.getDomain() | domain = metafor.getDomain() | ||
+ | The main object of the module is now created as an instance of the '' | ||
- | + | The analysis will then handle data from this domain to, for example, integrate temporally over its evolution equations. | |
- | On crée ensuite l' | + | |
- | + | ||
- | L' | + | |
- | La seule [[doc: | + | The only [[doc: |
Line 108: | Line 67: | ||
- | Le paramètre | + | The parameter |
Line 114: | Line 73: | ||
- | ==== Paramètres | + | ==== Parameters |
+ | Parameters should always be used instead of numbers, to easily modify the model. Indeed, one [[doc: | ||
- | |||
- | Il est souvent très utile de paramétrer un modèle pour pouvoir facilement modifier des grandeurs. Il faut toujours préférer des paramètres que des valeurs écrites "en dur". En effet, un calcul [[doc: | ||
Line 129: | Line 87: | ||
- | On définit 4 paramètres | + | Four parameters are defined: the length and width of the rectangle |
Line 137: | Line 95: | ||
+ | ==== Geometry ==== | ||
- | ==== Géométrie ==== | ||
- | |||
- | |||
- | |||
- | On va ensuite créer une géométrie " | ||
+ | Now, a " | ||
geometry = domain.getGeometry() | geometry = domain.getGeometry() | ||
- | geometry.setDimPlaneStrain() | + | geometry.setDimPlaneStrain(1.0) |
- | + | The first line retrieves the reference from the domain. The second line sets the type of geometry. Here, plane strain is chosen, but axisymmetric or 3D are also possible (see [[doc: | |
- | La première ligne récupère la référence en faisant la demande au domaine. La seconde ligne fixe le type de géométrie. Il s'agit de l' | + | |
{{ doc: | {{ doc: | ||
- | < | + | < |
- | La création d'une géométrie suit toujours le même schéma | + | Defining a geometry always follows the same pattern |
- | + | * The '' | |
- | Pourquoi parle-t-on de B-REP simplifié (voir figure ci-dessous)? | + | * A '' |
+ | * A '' | ||
+ | * A '' | ||
+ | * Finally, a '' | ||
+ | This is called a simplified B-REP (see figure below) because geometric and topological concepts are mixed for curves and points. In a traditional B-REP, a curve would be defined as an edge consisting of two vertices, to which a geometry is associated. | ||
{{ doc: | {{ doc: | ||
- | A chaque entité géométrique est associé un ensemble ('' | + | To each geometric entity is associated a '' |
- | + | ||
- | + | ||
- | + | ||
- | La définition des objets dans les ensembles se fait par deux techniques en fonction de la taille de l'objet à créer: | + | |
- | * Pour les objets de petite taille qui demandent peu de paramètres pour être totalement définis (les '' | + | Geometric objects can be defined in two ways, depending |
- | * Pour les objets qui nécessitent plus d' | ||
+ | * Small objects which require few parameters to be defined, like '' | ||
+ | * Bigger objects which require more arguments, like curves, are defined using a temporary object, which is filled and copied. For example, a curve is created by first defining a line (see below). | ||
- | Ici, pour les '' | + | In this example, '' |
Line 198: | Line 150: | ||
- | Nous continuons ensuite par les objets | + | Next, the '' |
Line 210: | Line 162: | ||
+ | The first line retrieves a reference pointing towards the set of all curves, named '' | ||
- | La première ligne récupère une référence vers l' | + | The arc is defined to model a [[doc: |
- | Il faut remarquer également que l'arc de cercle est destiné à modéliser une [[doc: | + | After the curves come the '' |
- | + | ||
- | + | ||
- | + | ||
- | Suivent les '' | + | |
wireset = geometry.getWireSet() | wireset = geometry.getWireSet() | ||
- | wireset.add( Wire(1, [curveset(1), | + | wireset.add(Wire(1, |
- | Même méthode pour le wire constitué des 4 lignes. Celles-ci sont spécifiées par le [[doc: | + | Wires are defined in the same way as curves. Two arguments are required, the user number and the Python |
- | + | Finally, the highest order element for a 2D case, the '' | |
- | + | ||
- | Nous passons au dernier niveau pour un test 2D, la '' | + | |
Line 241: | Line 188: | ||
- | La méthode utilisée est identique (création de l' | + | At this point, the whole geometry is defined, so it is recommended to check whether this was done properly. To do so, viewing tools coming from the '' |
- | + | ||
if 1: | if 1: | ||
Line 251: | Line 196: | ||
win.open() | win.open() | ||
+ | With these lines, a new '' | ||
+ | These lines are included in a "'' | ||
- | de lancer metafor et d' | ||
+ | To view the geometry, Metafor must be run and the module loaded with the GUI or imported with the command | ||
import apps.qs.tutorial | import apps.qs.tutorial | ||
- | |||
- | |||
- | |||
- | On a créé un objet de type '' | ||
- | |||
- | Nous avons mis ces objets dans un "bloc '' | ||
- | |||
Line 270: | Line 210: | ||
+ | Another way to check the geometry is with the function '' | ||
+ | ==== Mesh ==== | ||
- | Une autre manière de vérifier la géométrie est l' | ||
- | |||
- | ==== Maillage ==== | ||
- | |||
- | |||
- | |||
- | Nous passons maintenant au maillage de la géométrie. Puisque Metafor définit la totalité des conditions aux limites sur la géométrie, | ||
+ | Now, the model must be meshed. This could also be done later one, because the boundary conditions are defined based on the user geometry and not on the mesh itself. Indeed, the user will not have to handle neither mesh, elements nor nodes. It is always much better to define boundary conditions based on the user geometry, since the mesh is the first parameter that is usually changed to verify the solution. Therefore, if some conditions are defined based on nodes number, they must be changed every time the mesh is refined. All of this to say that meshing the part could be done later on. | ||
SimpleMesher1D(curveset(1)).execute(n1) | SimpleMesher1D(curveset(1)).execute(n1) | ||
Line 287: | Line 223: | ||
+ | As could be seen above, an object in a set is accessed with the use of parentheses (there is one exception regarding the [[doc: | ||
- | A ce stade, il faut savoir que, pour accéder à un objet dans un ensemble, il faut utiliser l' | ||
- | |||
- | |||
- | |||
- | Les mailleurs ([[doc: | ||
+ | The meshers ([[doc: | ||
- | Tout comme nous avons vérifié la géométrie utilisateur, il est possible de vérifier visuellement la géometrie du maillage en créant une fenêtre | + | As for the geometry, it is recommended to visually check whether the geometry was meshed properly by opening a '' |
Line 309: | Line 242: | ||
- | La géométrie à afficher est appelée | + | The geometry to display is called |
Line 316: | Line 249: | ||
+ | It is also possible to use the function '' | ||
- | Il est possible également d' | ||
- | ==== Définition des éléments volumiques | + | ==== Defining volume elements |
+ | Now that the geometry is defined, physical properties must be assigned to the domain, by associating ([[doc: | ||
- | + | === Material | |
- | Nous allons maintenant définir la physique du problème en commençant par informer le domaine des entités physiques ([[doc: | + | |
- | + | ||
- | + | ||
- | + | ||
- | === Materiau | + | |
- | + | ||
- | + | ||
- | + | ||
- | Définissons tout d' | + | |
+ | First, the volume behavior of the block which is to be crushed is defined. This is done by [[doc: | ||
materialset = domain.getMaterialSet() | materialset = domain.getMaterialSet() | ||
Line 345: | Line 271: | ||
materialset(1).put(YIELD_NUM, | materialset(1).put(YIELD_NUM, | ||
- | + | A law to model hardening is also required. This law must be defined in the set '' | |
- | + | ||
- | Nous avons également besoin d'une loi d' | + | |
Line 357: | Line 280: | ||
+ | When looking at the commands above, [[doc: | ||
- | On constate que [[doc: | + | A reference point towards the newly created object can be retrieved with the parenthesis operator (materialset1 = materialset(1)), |
- | Une [[doc: | + | After defining the type of material, the material function |
- | En particulier, on a associé une loi d' | + | With this function, a hardening law was also associated to the material using the '' |
- | + | ||
- | + | ||
- | + | ||
- | === Propriétés élémentaires === | + | |
- | + | ||
- | + | ||
- | + | ||
- | Avant de définir les éléments finis, on a besoin de créer un objet [[doc: | + | |
+ | === Element Properties === | ||
+ | Before defining Finite Elements, an object called '' | ||
prp1 = ElementProperties(Volume2DElement) | prp1 = ElementProperties(Volume2DElement) | ||
prp1.put(MATERIAL, | prp1.put(MATERIAL, | ||
prp1.put(CAUCHYMECHVOLINTMETH, | prp1.put(CAUCHYMECHVOLINTMETH, | ||
+ | | ||
+ | It is when defining an Element Properties that the desired type of Finite Element is specified. Here, the type '' | ||
+ | It is also at this point that the use of the selective SRI integration with pressure report is set, to avoid locking. | ||
- | On en profite pour spécifier à ce niveau qu'on veut effectuer une sous-intégration sélective de type SRI avec report de pression pour éviter le locking. La [[doc: | + | === Element Generator |
- | + | ||
- | + | ||
- | + | ||
- | === Générateur d' | + | |
- | + | ||
- | + | ||
- | + | ||
- | Il faut enfin ajouter un générateur d' | + | |
+ | Finally, an element generator is used to apply the newly defined Element Properties to the meshed geometry. In Metafor, these objects are called [[doc: | ||
app = FieldApplicator(1) | app = FieldApplicator(1) | ||
Line 398: | Line 312: | ||
+ | The '' | ||
- | Le '' | + | Then, this element must be applied to a part of the meshed geometry, with the command |
+ | Afterwards, the Element Properties is added to the interaction, | ||
+ | Before going further, a "'' | ||
- | Le lien entre l' | ||
+ | ==== Boundary Conditions ==== | ||
+ | === Fixed end === | ||
- | Pour voir si tout s'est bien passé, il est peut être utile d'effectuer un "'' | + | Now, the boundary conditions are considered. The set which handles all boundary conditions commands is called the '' |
- | ==== Conditions limites : Fixations & déplacements imposés ==== | + | |
- | === Fixations === | + | The X component of line 4 and the Y component of line 1 must be [[doc: |
- | + | ||
- | Passons aux conditions aux limites. L' | + | |
- | + | ||
- | Nous voulons | + | |
Line 421: | Line 334: | ||
loadingset.define(curveset(1), | loadingset.define(curveset(1), | ||
+ | In these lines, the object '' | ||
- | Dans ces commandes, L' | ||
+ | === Loadings (non-zero displacement, | ||
- | + | In this test case, the motion of the die over time must be described. To do so, a [[doc: | |
- | === Chargements (déplacement non nul, charge statique appliquée, ...) === | + | |
- | + | ||
- | + | ||
- | + | ||
- | Dans l' | + | |
Line 440: | Line 348: | ||
- | + | This non-zero displacement is defined with the '' | |
- | Le déplacement se définit grace à l' | + | |
| | ||
Line 448: | Line 354: | ||
- | + | Setting fixed ends or displacements | |
- | La [[doc: | + | |
==== Contact ==== | ==== Contact ==== | ||
Line 456: | Line 360: | ||
- | Le contact est géré par des éléments de contact. | + | Contact is managed by contact |
- | + | ||
- | Le matériau (matériau #2 dans le '' | ||
+ | The material chosen is called '' | ||
Line 469: | Line 371: | ||
materialset(2).put(PEN_NORMALE, | materialset(2).put(PEN_NORMALE, | ||
- | + | Then, the ElementProperties | |
- | + | ||
- | On crée ensuite des propriétés élémentaires pour lier le matériau aux futurs éléments et définir le type d' | + | |
Line 478: | Line 377: | ||
prp2.put (MATERIAL, 2) | prp2.put (MATERIAL, 2) | ||
- | + | Finally, the element generator. Several can be chosen, depending on how contact | |
- | + | ||
- | Il existe plusieurs générateurs d' | + | |
Line 490: | Line 386: | ||
interactionset.add(ci) | interactionset.add(ci) | ||
- | + | The deformable entity is specified with the command | |
- | l' | + | |
+ | It should be noted that the contact interaction number must be different from the '' | ||
+ | ==== Temporal Integration ==== | ||
+ | The description of this model is now over. What is left to consider is the way the '' | ||
- | Notons que l' | + | Many options are available, however the simplest one is chosen here, which is a quasi-static integration |
- | ==== Paramètres de l' | + | |
- | + | ||
- | + | ||
- | + | ||
- | La description du modèle étant terminée, nous allons maintenant nous occuper de la manière dont l' | + | |
- | + | ||
- | + | ||
- | + | ||
- | Beaucoup d' | + | |
Line 512: | Line 400: | ||
tsm.setNextTime(1.0, | tsm.setNextTime(1.0, | ||
+ | The '' | ||
+ | First, the initial time, t=0 and the initial time step, dt=0.01s are set using the command '' | ||
- | On utilise le gestionnaire de pas de temps (objet '' | + | Then, the command |
Line 521: | Line 410: | ||
mim.setMaxNbOfIterations(7) | mim.setMaxNbOfIterations(7) | ||
mim.setResidualTolerance(1.0e-4) | mim.setResidualTolerance(1.0e-4) | ||
+ | | ||
+ | Afterwards, the '' | ||
+ | ==== Curves Extraction | ||
- | + | It is also possible | |
- | Nous faisons appel ensuite à l' | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ==== Extraction de courbes ==== | + | |
- | + | ||
- | + | ||
- | + | ||
- | Si on veut aller plus loin, il est possible | + | |
- | + | ||
valuesmanager = metafor.getValuesManager() | valuesmanager = metafor.getValuesManager() | ||
valuesmanager.add(1, | valuesmanager.add(1, | ||
- | valuesmanager.add(2, | + | valuesmanager.add(2, |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | Ces courbes peuvent être visualisées dans '' | + | |
- | + | ||
- | + | ||
- | + | ||
- | La première ligne va chercher le gestionnaire de courbes dans l' | + | |
- | + | ||
- | + | ||
- | + | ||
- | La ligne suivante définit la courbe numéro 1 qui va archiver la valeur du temps à chaque pas de temps. | + | |
- | + | ||
- | + | ||
- | + | ||
- | On définit ensuite une courbe (de numéro arbitraire 2) qui extrait la valeur '' | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ===== Lancer le calcul ===== | + | |
+ | The first line fetches the '' | ||
+ | The second line defines the first curve, which will save the time value at each time step. | ||
+ | The third line defines a second result curve which extracts the value '' | ||
- | Le calcul se charge par '' | + | These curves can be viewed in real time in '' |
+ | ===== Running the simulation ===== | ||
+ | First, the test case must be loaded using the command '' | ||
+ | Then, the integration is started with the command '' | ||
- | On obtient la célèbre | + | If everything was done properly, this famous |
Line 589: | Line 441: | ||
- | + | At the same time, the [[doc: | |
- | Tandis que la fenêtre | + | |
Line 604: | Line 455: | ||
- | ===== Visualiser les résultats | + | ===== Viewing Results |
- | ==== Recharger les configurations sauvegardées | + | ==== Loading Saved Configurations |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | Grâce à '' | + | |
+ | Using '' | ||
{{ doc: | {{ doc: | ||
+ | This was explained in details in [[doc: | ||
- | Pour plus de détails sur la procédure, voir [[doc: | ||
Line 628: | Line 473: | ||
+ | ==== Viewing Curves Using Excel ==== | ||
+ | Run Excel, and load the desired '' | ||
- | ==== Les courbes sous Excel ==== | + | A box opens to configure the importation. At this point, it is important |
- | + | ||
- | + | ||
- | + | ||
- | Ouvrez Excel et chargez les fichiers '' | + | |
- | + | ||
- | Une boite de dialogue s' | + | |
- | + | ||
{{ doc: | {{ doc: | ||
+ | Once both files are imported, the two data columns must be placed on a single sheet, and a 2D plot must be defined when selecting the data. | ||
- | + | The result is shown on the following | |
- | Une fois les deux fichiers importés, placez les deux colonnes dans une seule feuille de calcul et définissez un graphique 2D en sélectionnant les données. | + | |
- | + | ||
- | Le résultat est montré sur la figure | + | |
- | + | ||
{{ doc: | {{ doc: | ||
Line 654: | Line 489: | ||
- | ==== Les courbes sous Matlab ==== | + | ==== Viewing Curves Using Matlab ==== |
- | + | It is much easier using Matlab. Simply load the curves using the command | |
- | + | ||
- | Sous matlab, c'est beaucoup plus simple: | + | |
- | + | ||
- | + | ||
- | + | ||
- | Lancez matlab et chargez les courbes avec la commande | + | |
{{ doc: | {{ doc: | ||
- | |||
- |
doc/user/tutorials/tuto1.1399473009.txt.gz · Last modified: 2016/03/30 15:22 (external edit)