1% `MaterialLaw` keywords
2
3
4# The `@Author` keyword
5
6The `@Author` keyword is used give the name of the person who wrote
7the `mfront` file.
8
9All the following words are appended to the author's name up to a
10final semi-colon.
11
12Note: The name of the person who formulated the material property,
13behaviour or model shall be given in the description section (see the
14`@Description` keyword).
15
16## Example
17
18~~~~ {#Author .cpp}
19@Author Éric Brunon;
20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22
23
24# The `@Bounds` keyword
25
26The `@Bounds` keyword let the user define the domain of validity of
27the law.
28
29The `@Bounds` keyword is followed by a variable name, the keyword in
30and an interval. The interval may contain the infinity, represented by
31the '*' character.
32
33## Effect
34
35What happens if a variable if found to be out of its bounds depends on
36the interface used. Most interfaces let the user choose one of three
37following policies:
38
39- `None`, which means that nothing is done.
40- `Warning`, which means that a message is displayed, but computations
41  are not stopped.
42- `Strict`, which means that computations are stopped with an error
43  message.
44
45## Example
46
47~~~~{.cpp}
48@Bounds T in [293.15:873.15];
49~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50
51
52# The `@Constant` keyword
53
54The `@Constant` keyword let the user define a constant value.  This
55keyword is a synonym of `@StaticVariable` for a real variable.
56
57This keyword must be followed by the name of the constant and its
58value.
59
60## Example
61
62~~~~{.cpp}
63@Constant A 1.234e56;
64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
66
67
68# The `@Date` keyword
69
70The `@Date` keyword allows the user to precise when the mfront file
71was written.
72
73All the following words are appended to the date up to a final
74semi-colon.
75
76## Example
77
78~~~~{.cpp}
79@Date 2008-11-17;
80~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
82
83# The `@Description` keyword
84
85The `@Description` describes the material property, behaviour or model
86which is implemented in a mfront file.
87
88This keyword is followed by a block containing all the relevant piece
89of information including:
90
91- the references of the article or technical report from which the
92  material property, behaviour or model is extracted
93- the name of the authors
94- the modifications made
95
96## Example
97
98~~~~{.cpp}
99@Description
100{
101  Corrélation établie sur la nuance V-4Cr-4Ti.
102
103  Propriétés extraites du document :
104
105  Propriétés et comportement mécanique d alliages
106   de Vanadium avant, après et sous irradiation
107
108  Marion Le Flem, Jean-Luc Bechade, Annick Bougault,
109  Aurore Michaux, Lionel Gosmain, Jean-Louis Seran
110  DMN/SRMA/LA2M/NT/2008-2967/A
111}
112~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113
114# The `@Function` keyword
115
116The `@Function` keyword introduces the C++ code computing the value a
117the material property.
118
119Note: the default output is called `res`. This is changed by the
120`@Output` keyword.
121
122## Note
123
124Although most interfaces use double for floatting point operations,
125this may not be always the case. A special `typedef` named `real` is
126thus introduced by the interfaces. We advice the user to use this
127`typedef` to define their local variables.
128
129## Example
130
131~~~~{.cpp}
132@Function
133{
134  const real C0 =    575.57;
135  const real C1 = -21094.;
136  Cp = C0+C1/T;
137}
138~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139
140# The `@Import` keyword
141
142The `@Import` keyword allows the inclusion of one or several
143(external) mfront files. This keyword is followed by a string or an
144array of strings. Each string stands for a mfront file name that is
145meant to be imported.
146
147This instruction interrupts the treatment of the current file and
148starts the sequential treatment of each file to be imported.
149
150## Search paths
151
152Files to be imported are searched, in that order:
153
154- starting from the current directory.
155- starting from directories specified with one of the `--search-path`
156  or the `--include` (`-I`) `mfront`' command line options.
157- staring from directories specified through the `MFRONT_INCLUDE_PATH`
158  environment variable.
159
160## Example
161
162~~~~{.cpp}
163@Import "SlidingSystemsCC.mfront";
164~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165
166# The `@Includes` keyword
167
168The `@Includes` introduces a block were the user may define some
169preprocessor directives, typically #include directives (hence the
170name).
171
172## Example
173
174~~~~{.cpp}
175@Includes{
176#include<fstream>
177}
178~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179
180# The `@Input` keyword
181
182The `@Input` keyword specifies one or several inputs of a material
183law. This keyword is followed by the names of the inputs, separated by
184commas.
185
186The following characters are legal as the first character of an
187identifier, or any subsequent character:
188
189`_` `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`
190`n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`
191`A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`
192`N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`
193
194The following characters are legal as any character in an identifier
195except the first:
196
197`0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
198
199## External name
200
201It is recommended to associate to an input a glossary or an entry
202name through the methods `setGlossaryName` or `setEntryName`
203respectively.
204
205## Example
206
207~~~~{.cpp}
208@Input T,p;
209T.setGlossaryName("Temperature");
210p.setGlossaryName("Porosity");
211~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212
213# The `@Interface` keyword
214
215The `@Interface` keyword let the user specify interfaces to be
216used. The keyword is followed by a list of interface name, separated
217by commas.
218
219Using this keyword is considered a bad pratice. The user shall use the
220`--interface` command line argument to specify which interface shall
221be used.
222
223## Example
224
225~~~~{.cpp}
226@Interface castem;
227~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228
229# The `@Law` keyword
230
231The `@Law` keyword allows the user to associate a name to the material
232law being treated. This keyword is followed by a name.
233
234This name must be a valid C++ identifier. The following characters are
235legal as the first character of an identifier, or any subsequent
236character:
237
238`_` `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`
239`n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`
240`A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`
241`N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`
242
243The following characters are legal as any character in an identifier
244except the first:
245
246`0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
247
248## Name of the generated functions or classes
249
250The names of the generated functions or classes depend on the law name
251as specifified with the `@Law` keyword but may also include the
252material name, as specified by the `@MaterialLaw` keyword.
253
254## Example
255
256~~~~{.cpp}
257@Law ThermalExansionCoefficient_SRMA;
258~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259
260
261# The `@Library` keyword
262
263The `@Library` keyword let the user specify part of the generated
264libary name. This keyword is followed by the name of library.
265
266This name must be a valid C++ identifier. The following characters are
267legal as the first character of an identifier, or any subsequent
268character:
269
270`_` `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`
271`n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`
272`A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`
273`N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`
274
275The following characters are legal as any character in an identifier
276except the first:
277
278`0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
279
280## Example
281
282~~~~{.cpp}
283@Library AlcyoneLibrary;
284~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
285
286# The `@Link` keyword
287
288The `@Link` keyword let the user specify additional linker flags used
289to build their shared library/executables. This keyword must be
290followed by a string or an array of strings.
291
292Usage of the `@Link` keyword is deprecated a linker flags are not
293portable. The user may prefer using the `LDFLAGS` environment
294variable.
295
296## Example
297
298~~~~{.cpp}
299// explicit link with libm.so
300// (not necessary in pratice)
301@Link "-lm";
302~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303
304
305# The `@MFront` keyword
306
307The `@MFront` keyword leads to the generation of sources from some
308mfront files as a subprocess of the current file treatment. This
309keyword is followed by a pair of strings or array of strings. The
310first member of the pair describes which a list of files to be
311treated. The second member of the pair describes a list of interfaces.
312
313## Example
314
315~~~~{.cpp}
316@MFront {"YoungModulus.mfront",{"c","excel"}};
317~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318
319
320# The `@Material` keyword
321
322The `@Material` keyword let the user specify which material is treated
323by the current file. This keyword is followed by the name of the
324material.
325
326This name must be a valid `C++` identifier. The following characters
327are legal as the first character of an identifier, or any subsequent
328character:
329
330`_` `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`
331`n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`
332`A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`
333`N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`
334
335The following characters are legal as any character in an identifier
336except the first:
337
338`0` `1` `2` `3` `4` `5` `6` `7` `8` `9`
339
340## Example
341
342~~~~{.cpp}
343@Material UO2;
344~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345
346# The `@MaterialLaw` keyword
347
348The `@MaterialLaw` keyword imports the definition of a material law
349defined in a mfront file and compiles, as part of the current library,
350an function using the `mfront` interface. This function is available
351in every standard code blocks.
352
353The `@MaterialLaw` keyword is followed by a string or an array of
354string identifying `mfront` files.
355
356## Search paths
357
358Files to be imported are searched, in that order:
359
360- starting from the current directory.
361- starting from directories specified with one of the `--search-path`
362  or the `--include` (`-I`) `mfront`' command line options.
363- staring from directories specified through the `MFRONT_INCLUDE_PATH`
364  environment variable.
365
366## Note
367
368The `mfront` interface has been created to avoid names conflict.
369
370For internal reasons, `mfront` reports the creation of an auxiliary
371library which is of no use.
372
373## Example
374
375~~~~{.cpp}
376@MaterialLaw "UO2_YoungModulus.mfront";
377~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
378
379# The `@Output` keyword
380
381The `Output` keyword changes the name of the output variable. By
382default, this name is `res`. This keyword is followed by the new name
383of the output variable.
384
385## Example
386
387~~~~{.cpp}
388@Output b ;
389~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
390
391# The `@Parameter` keyword
392
393The `@Parameter` keyword declares a new parameter or a list of new
394parameters. Optionally, the default value of the declared parameters
395may also be given following various C++ standard assignment syntaxes.
396
397The default value of a parameter can also be declared after its
398declaration using the `setDefaultValue` method.
399
400## Example
401
402~~~~{.cpp}
403@Parameter  R0 = 500;
404@Parameter  Q1{1000000000},b1{0.000001};
405@Parameter  Q2(0),b2(0);
406@Parameter  fc;
407fc.setDefaultValue(1.e-2);
408~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
409
410
411# The `@Parser` keyword
412
413The `@Paser` keyword is a deprecated synonymous of `@DSL`.
414
415# The `@PhysicalBounds` keyword
416
417The `@PhysicalBounds` keyword let the use define the physical domain
418of a variable.
419
420The `@PhysicalBounds` keyword is followed by a variable name, the
421keyword in and an interval. The interval may contain the infinity,
422represented by the '*' character.
423
424## Effect
425
426In implicit schemes, if physical bounds are set on a integration
427variable, this variable is bounded to satisfy them during the internal
428iterations.
429
430If a variable is found to be out of its physical bounds, the
431computations are stopped. The tests are performed at different stages
432of the integration depending on the nature of the variable.
433
434## Example
435
436~~~~{.cpp}
437// a temperature (in Kelvin) can't be negative
438@Bounds T in [0:*[;
439~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
440
441
442# The `@StaticVar` keyword
443
444The `@StaticVar` keyword is a deprecated synonymous of
445`@StaticVariable`.
446
447# The `@StaticVariable` keyword
448
449The `@StaticVariable` keyword let the user define a constant
450value. Unlike parameters (see the `@Parameter` keyword), static
451variables' values can't be changed after compilation.
452
453This keyword must be followed by the type of the constant, its name,
454an equal sign and its value.
455
456## Example
457
458~~~~{.cpp}
459@StaticVariable real A = 1.234e56;
460~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
461