# Metafor

ULiege - Aerospace & Mechanical Engineering

### Site Tools

doc:user:tutorials:tuto1

# Differences

This shows you the differences between two versions of the page.

 doc:user:tutorials:tuto1 [2015/02/12 17:18]ziane [Boundary Conditions] doc:user:tutorials:tuto1 [2016/07/11 16:45] (current)boemer [Temporal Integration] Both sides previous revision Previous revision 2016/07/11 16:45 boemer [Temporal Integration] 2016/07/11 16:42 boemer [Temporal Integration] 2016/07/11 16:40 boemer [Contact] 2016/07/11 16:06 boemer [Mesh] 2016/07/11 15:47 boemer 2016/07/11 15:47 boemer 2016/07/11 15:46 boemer [Geometry] 2016/07/11 15:37 boemer [Heading] 2016/03/30 15:23 external edit2015/02/13 12:07 ziane [Boundary Conditions] 2015/02/12 17:18 ziane [Boundary Conditions] 2015/02/12 14:06 ziane 2015/01/20 15:38 carretta 2015/01/09 12:01 boman [How to write an input file?] 2015/01/07 12:50 boman 2015/01/07 12:02 boman [How to write an input file] 2015/01/07 12:02 boman [First Test Case] 2014/10/02 09:35 joris 2014/08/07 22:45 joris 2014/05/07 16:30 boman [En vidéo] 2014/05/07 12:34 boman 2014/01/15 16:50 joris [Extraction de courbes] 2014/01/15 15:15 joris [Conditions limites : Fixations & déplacements imposés] 2014/01/12 19:54 joris [Maillage] 2014/01/12 19:54 joris [Maillage] 2013/11/29 12:12 external edit2013/07/12 18:37 joris 2013/07/12 18:03 joris 2013/07/12 15:47 joris 2013/07/12 15:46 joris 2013/07/12 15:42 external edit2013/07/12 15:10 joris 2013/07/12 15:09 joris 2013/07/12 14:18 external edit2013/07/12 13:32 joris 2013/07/11 18:10 joris Next revision Previous revision 2016/07/11 16:45 boemer [Temporal Integration] 2016/07/11 16:42 boemer [Temporal Integration] 2016/07/11 16:40 boemer [Contact] 2016/07/11 16:06 boemer [Mesh] 2016/07/11 15:47 boemer 2016/07/11 15:47 boemer 2016/07/11 15:46 boemer [Geometry] 2016/07/11 15:37 boemer [Heading] 2016/03/30 15:23 external edit2015/02/13 12:07 ziane [Boundary Conditions] 2015/02/12 17:18 ziane [Boundary Conditions] 2015/02/12 14:06 ziane 2015/01/20 15:38 carretta 2015/01/09 12:01 boman [How to write an input file?] 2015/01/07 12:50 boman 2015/01/07 12:02 boman [How to write an input file] 2015/01/07 12:02 boman [First Test Case] 2014/10/02 09:35 joris 2014/08/07 22:45 joris 2014/05/07 16:30 boman [En vidéo] 2014/05/07 12:34 boman 2014/01/15 16:50 joris [Extraction de courbes] 2014/01/15 15:15 joris [Conditions limites : Fixations & déplacements imposés] 2014/01/12 19:54 joris [Maillage] 2014/01/12 19:54 joris [Maillage] 2013/11/29 12:12 external edit2013/07/12 18:37 joris 2013/07/12 18:03 joris 2013/07/12 15:47 joris 2013/07/12 15:46 joris 2013/07/12 15:42 external edit2013/07/12 15:10 joris 2013/07/12 15:09 joris 2013/07/12 14:18 external edit2013/07/12 13:32 joris 2013/07/11 18:10 joris 2013/07/11 17:53 joris 2013/07/11 17:50 joris 2013/07/11 15:25 joris 2013/07/10 17:04 joris [Conditions limites : Fixations & déplacements imposés] 2013/07/09 14:02 joris 2013/07/05 16:12 joris [Conditions limites : Fixations & déplacements imposés] 2013/07/03 10:36 joris [Définition des éléments volumiques] 2013/07/02 19:32 joris created Line 49: Line 49: The first line imports the Python/C++ interface of Metafor (called ''wrap'') in the current namespace, so that all compiled C++ objects of Metafor are available in Python. The first line imports the Python/C++ interface of Metafor (called ''wrap'') in the current namespace, so that all compiled C++ objects of Metafor are available in Python. - The ''math'' module is also imported, in this case, to use the functions sine and cosine later. + The ''math'' module is also imported, in this case, to use the sine and cosine functions later. metafor = Metafor() metafor = Metafor() domain = metafor.getDomain() domain = metafor.getDomain() - The main object of the module ) is now created as an instance of the ''Metafor'' class. This command ''Metafor()'' creates an [[doc:user:tutorials:tuto0#objets|object]] Metafor, from which we can extract a ''Domain''. The domain is a container (see [[doc:user:general:références#References]]). It contains all objects that are required by the model (geometry, elements, nodes, fixations and other boundary conditions, materials, ...). + The main object of the module is now created as an instance of the ''Metafor'' class. This command ''Metafor()'' creates an [[doc:user:tutorials:tuto0#objets|object]] Metafor, from which we can extract a ''Domain''. The domain is a container (see [[doc:user:general:références#References]]). It contains all objects that are required by the model (geometry, elements, nodes, fixations and other boundary conditions, materials, ...). The analysis will then handle data from this domain to, for example, integrate temporally over its evolution equations. The analysis will then handle data from this domain to, for example, integrate temporally over its evolution equations. Line 134: Line 134: * 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). * 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). - In this example, ''[[doc:user:geometry:user:points]]'' are defined with the first method, as the function named "define". The first argument is a user number, which must be strictly positive and different for each entity in a common set. The next three arguments are the spatial coordinates $x, y \mbox{ and } z$. Since the geometry was set to plane strain, the default plane $z=0$ is considered and only $x$ and $y$ are given. + In this example, ''[[doc:user:geometry:user:points]]'' are defined with the first method, i.e. with the "define"-function. The first argument is a user number, which must be strictly positive and different for each entity in a common set. The next three arguments are the spatial coordinates $x$, $y$ and $z$. Since the geometry was set to plane strain, the default plane $z=0$ is considered and only $x$ and $y$ are given. Line 229: Line 229: The meshers ([[doc:user:geometry:mesh:1d|1D Mesher]], [[doc:user:geometry:mesh:2d|2D Mesher]]) are linked to the entity that must be meshed and executed with the command ''execute()''. For face 1, the [[doc:user:geometry:mesh:2d|integrated mesher TIM]] (Transfinite Interpolation Method), suitable for quadrangles where two opposite edges have the same numbers of elements, is used. The meshers ([[doc:user:geometry:mesh:1d|1D Mesher]], [[doc:user:geometry:mesh:2d|2D Mesher]]) are linked to the entity that must be meshed and executed with the command ''execute()''. For face 1, the [[doc:user:geometry:mesh:2d|integrated mesher TIM]] (Transfinite Interpolation Method), suitable for quadrangles where two opposite edges have the same numbers of elements, is used. - As for the geometry, it is recommended to visually check whether the piece was meshed properly by opening a ''VizWin'' window with the following lines : + As for the geometry, it is recommended to visually check whether the geometry was meshed properly by opening a ''VizWin'' window with the following lines : Line 354: Line 354: - Setting fixed ends or displacements is done is the same way as the definition of points in the geometry, with the single ''define()'' command. For the non-zero displacement of the die, the geometric entity ''curveset(5)'' is first given, then the direction ''TY,RE'' (= displacement  along ''Y''), the amplitude -0.4 and finally the temporal evolution, with the reference to the function ''fct''. This means that the movement will be described with ''d(t) = -0.4 * fct(t) = -0.4 * t'' + Setting fixed ends or displacements is done in the same way as the definition of points in the geometry, with the single ''define()'' command. For the non-zero displacement of the die, the geometric entity ''curveset(5)'' is first given, then the direction ''TY,RE'' (= displacement  along ''Y''), the amplitude -0.4 and finally the temporal evolution, with the reference to the function ''fct''. This means that the movement will be described with ''d(t) = -0.4 * fct(t) = -0.4 * t''. ==== Contact ==== ==== Contact ==== Line 388: Line 388: The deformable entity is specified with the command ''push()'', the rigid one with ''setTool()''. The deformable entity is specified with the command ''push()'', the rigid one with ''setTool()''. - It should be noted that the contact interaction number must be different that the ''FieldApplicator'' number defined earlier, since both objects are included in the same set ''InteractionSet''. + It should be noted that the contact interaction number must be different from the ''FieldApplicator'' number defined earlier, since both objects are included in the same set ''InteractionSet''. ==== Temporal Integration ==== ==== Temporal Integration ==== The description of this model is now over. What is left to consider is the way the ''Metafor'' analysis, in charge of running the simulation, will integrate the equations temporally. The description of this model is now over. What is left to consider is the way the ''Metafor'' analysis, in charge of running the simulation, will integrate the equations temporally. - Many options are available, however the simplest one is chosen here, which is a quasi-static integration (where the inertia is neglected). What remains to define is the temporal interval on which the simulation will be run, and the way the results will be saved (see [[doc:user:integration:general:time_step]]). + Many options are available, however the simplest one is chosen here, which is a quasi-static integration (where the inertia is neglected). What remains to be defined is the temporal interval during which the simulation will be run, and the way the results will be saved (see [[doc:user:integration:general:time_step]]). Line 412: Line 412: - Afterwards, the ''MechanicalIterationManager'' is considered (see [[doc:user:integration:general:mim_tim]]). This object sets the parameters of Newton-Raphson algorithm, used to solve the equilibrium equations. Here, a maximum of 7 mechanical [[doc:user:general:glossaire#iterations]] is set, with the default tolerance of 1.0e-4. + Afterwards, the ''MechanicalIterationManager'' is considered (see [[doc:user:integration:general:mim_tim]]). This object sets the parameters of the Newton-Raphson algorithm, used to solve the equilibrium equations. Here, a maximum of 7 mechanical [[doc:user:general:glossaire#iterations]] is set, with the default tolerance of 1.0e-4. ==== Curves Extraction  ==== ==== Curves Extraction  ==== Line 419: Line 419: valuesmanager = metafor.getValuesManager() valuesmanager = metafor.getValuesManager() valuesmanager.add(1, MiscValueExtractor(metafor,EXT_T),'time') valuesmanager.add(1, MiscValueExtractor(metafor,EXT_T),'time') - valuesmanager.add(2, DbValueExtractor(curveset(1), Field1D(TY,GF2)), SumOperator(), 'force') + valuesmanager.add(2, DbNodalValueExtractor(curveset(1), Field1D(TY,GF2)), SumOperator(), 'force') The first line fetches the ''ValuesManager'', in charge of handling the result curves, from the analysis ''Metafor''. The first line fetches the ''ValuesManager'', in charge of handling the result curves, from the analysis ''Metafor''.