- I.6.1 Manipulation of FeResPost standard output
- I.6.2 Monadic functions for new Result creation
- I.6.3 Dyadic functions for new Result creation
- I.6.4 ``Operator'' methods
- I.6.5 Reading and writing of Groups
- I.6.6 Setting verbosity for debugging purposes
- I.6.7 Conversion of CLA idfiers
- I.6.8 SQL``BLOB'' methods
- I.6.9 Random or PSD integration methods
- I.6.10 Predefined criteria

I.6 The ``Post'' module

The ``Post'' module contains the definition of methods belonging to no particular class. These methods are all devoted to manipulation of Results or Groups.

A list of the methods defined in ``Post'' module is given in Table I.6.1.

(FeResPost list of classes is given in
Table 1
page .) |
||

Method Name |
Description |
Example |

Manipulation of FeResPost standard output |
||

Post.openMsgOutputFileopenMsgOutputFile | I.6.1 | |

Post.closeMsgOutputFilecloseMsgOutputFile | I.6.1 | |

Post.writeAboutInformationwriteAboutInformation | I.6.1 | |

Post.writeMsgOutputLinewriteMsgOutputLine | I.6.1 | |

Monadic functions for new Result creation |
||

Post.expexp | I.6.2 | |

Post.loglog | I.6.2 | |

Post.exp10exp10 | I.6.2 | |

Post.log10log10 | I.6.2 | |

Post.absabs | I.6.2 | |

Post.invinv | I.6.2 | |

Post.sqsq | I.6.2 | |

Post.sqrtsqrt | I.6.2 | |

Post.sgnsgn | I.6.2 | |

Dyadic functions for new Result creation |
||

Post.minmin | I.6.3 | |

Post.maxmax | I.6.3 | |

Post.cmpcmp | I.6.3 | |

Post.mergemerge | I.6.3 | |

Post.mergeKeepFirstmergeKeepFirst | I.6.3 | |

Post.mergeKeepLastmergeKeepLast | I.6.3 | |

Post.powpow | I.6.3 | |

Post.atan2atan2 | I.6.3 | |

Post.vectProductvectProduct | I.6.3 | |

Post.sumVectProductsumVectProduct | I.6.3 | |

Groups and Patran session files |
||

Post.readGroupsFromPatranSessionreadGroupsFromPatranSession | I.6.5 | I.6.5 |

Post.writeGroupsToPatranSessionwriteGroupsToPatranSession | I.6.5 | I.6.5 |

Control of verbosity for debugging purposes |
||

Post.setVerbosityLevelsetVerbosityLevel | I.6.6 | |

Post.getVerbosityLevelgetVerbosityLevel | I.6.6 | |

Conversion of CLA identifiers |
||

Post.convertIdfierToStringconvertIdfierToString | I.6.7 | |

Post.convertStringToIdfierconvertStringToIdfier | I.6.7 | |

BLOBs for SQL |
||

Post.convertBlobconvertBlob | I.6.8 | |

Random |
||

Post.calcRandomResponsecalcRandomResponse | I.6.9 | IV.2.4.7 |

Predefined criteria |
||

Post.calcPredefinedCriterioncalcPredefinedCriterion | I.6.10 | IV.2.4.3 and chapter IV.4 |

I.6.1 Manipulation of FeResPost standard output

Four methods of ``Post'' Module allow to manipulate the information, warning and error messages issue by FeResPost:

- ``Post.openMsgOutputFileopenMsgOutputFile'' opens a output file and redirects the standard output used by FeResPost to issue its messages. The method has up to two String arguments: the name of the output file, and the opening mode ("w" for write and "w+" for append). The second argument is optional. If omitted, "w" is considered by FeResPost.
- ``Post.closeMsgOutputFilecloseMsgOutputFile'' closes the output file and restore the standard output for FeResPost messages.
- ``Post.writeAboutInformationwriteAboutInformation'' writes the FeResPost information message to standard output, or corresponding output files. (Information contains among other things the version of FeResPost and its date of compilation.)
- ``Post.writeMsgOutputLinewriteMsgOutputLine'' writes a line in the standard output stream. (The stream can of course be a file.)

I.6.2 Monadic functions for new Result creation

In section I.4.3, one defines functions that allow the creation of new Result objects from existing ones. Here, one present short-cuts to some of these functions (for the following functions, x and y are Result objects):

- y=Post.Post.expexp(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("exp")''.
- y=Post.Post.loglog(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("log")''.
- y=Post.Post.exp10exp10(x) is equivalent ``to y=x.Result.deriveScalToScalderiveScalToScal("exp10")''.
- y=Post.Post.log10log10(x) is equivalent ``to y=x.Result.deriveScalToScalderiveScalToScal("log10")''.
- y=Post.Post.absabs(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("abs")'',

``y=x.deriveVectorToOneScal("abs")'' or ``y=x.deriveTensorToOneScal("abs")''. - y=Post.Post.invinv(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("inv")''.
- y=Post.Post.sqsq(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("sq")''

or ``y=x.deriveVectorToOneScal("sq")''. - y=Post.Post.sqrtsqrt(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("sqrt")''.
- y=Post.Post.sgnsgn(x) is equivalent to ``y=x.Result.deriveScalToScalderiveScalToScal("sgn")''.

I.6.3 Dyadic functions for new Result creation

In section I.4.3, one defines functions that allow the creation of new Result objects from existing ones. Here, one present short-cuts to some of these functions (for the following functions, x, y and z are Result objects):

- z=Post.Post.powpow(x,y) is generally equivalent to ``z=x.Result.deriveDyadicderiveDyadic("pow",y)''. But the ``pow'' method defined in ``Post'' module also allows to replace the first ``x'' operand by a Real value. However, at least one of the two arguments must be a Result object.
- z=Post.Post.atan2atan2(x,y) is generally equivalent to ``z=x.Result.deriveDyadicderiveDyadic("atan2",y)''. But the ``atan2'' method defined in ``Post'' module also allows to replace the first ``x'' operand by a Real value. However, at least one of the two arguments must be a Result object.
- z=Post.Post.vectProductvectProduct(x,y) is generally equivalent to ``z=x.Result.deriveDyadicderiveDyadic("vectProduct",y)''. However the first argument can be replaced by a vector (Array of three real elements). However, at least one of the two arguments must be a Result object.
- z=Post.Post.sumVectProductsumVectProduct(x,y) is equivalent to ``z=x.Result.deriveDyadicderiveDyadic("sumVectProduct",y)''.

- z=Post.Post.minmin(x,y) returns a Result build by selecting the minimum values of x and y. The method works with scalar, vectorial or tensorial results. Either x or y can be replaced by a Real value.
- z=Post.Post.maxmax(x,y) returns a Result build by selecting the maximum values of x and y. The method works with scalar, vectorial or tensorial results. Either x or y can be replaced by a Real value.
- z=Post.Post.cmpcmp(x,y) returns a Result build by setting the corresponding values to -1 if x<y, 0 if x==y and 1 if x>y. Both results must be scalar. Either of the two Results can be replaced by a real argument.
- z=Post.Post.mergeKeepFirstmergeKeepFirst(x,y) returns a Result build by merging the two arguments. When a key is present in the two argument Results, the values extracted from the first Result are kept.
- z=Post.Post.mergemerge(x,y) is identical to z=Post.Post.mergeKeepFirstmergeKeepFirst(x,y).
- z=Post.Post.mergeKeepLastmergeKeepLast(x,y) returns a Result build by merging the two arguments. When a key is present in the two argument Results, the values extracted from the second Result are kept.

I.6.4 ``Operator'' methods

Four ``operator'' methods (functions) are defined in the ``Post'' module: ``Post.opAddopAdd'', ``Post.opSubopSub'', ``Post.opMulopMul'' and ``Post.opDivopDiv''. These four methods correspond to the four ``+'', ``-'', ``*'' and ``/'' operators defined in ``dflt.ResultResult'', ``dflt.GroupGroup'' and ``dflt.ResKeyListResKeyList'' classes:

- If first argument is a ``dflt.GroupGroup'' object, the second argument must also be a ``dflt.GroupGroup'' object.
- If first argument is a ``dflt.ResKeyListResKeyList'' object, the second argument must also be a ``dflt.ResKeyListResKeyList'' object.
- If either first or second argument is a ``dflt.ResultResult'' object, then the possible arguments
are those of the corresponding operators in ``dflt.ResultResult'' class (section I.4.6).
The first argument can be a ``dflt.ResultResult'' object, a real value, a complex value, an Array of three real values or three complex values, or a matrix of real elements.

The second argument can be a ``dflt.ResultResult'' object, a real value, a complex value, an Array of three real values, or a matrix of real elements.

I.6.5 Reading and writing of Groups

Method ``Post.readGroupsFromPatranSessionreadGroupsFromPatranSession'' reads Groups from a Patran session file and returns a Hash containing the list of Groups. The keys are Group names, and the values are the Groups. The method has two arguments:

- A String corresponding to the name of the session file.
- A DataBase. This argument is optional. If it is provided, the reading method removes from the created Groups all the entities undefined in the DataBase argument.

... h=Post::readGroupsFromPatranSession("groups.ses") ... h=Post::readGroupsFromPatranSession("groups.ses",DB) ...

Method ``Post.writeGroupsToPatranSessionwriteGroupsToPatranSession'' is used to save groups in a Patran session file. This method does the inverse of method ``Post::readGroupsFromPatranSession''. The method has two arguments:

- The first argument of the method is a String containing the name of the output session file.
- The second argument if the list of Groups. This can be a Hash
similar to the one produced by method ``Post::readGroupsFromPatranSession'',
of an Array of Group objects.
When the second argument is a Hash, the String keys are used as reference names for the groups. If the second argument is an Array of Groups, their names are used in the session file.

... h=Post::readGroupsFromPatranSession("groups.ses") ... Post::writeGroupsToPatranSession("hash.ses",h) Post::writeGroupsToPatranSession("values.ses",h.values) ...produce equivalent Patran session files, but the order in which the Groups are defined may differ.

I.6.6 Setting verbosity for debugging purposes

Two methods allow to set the verbosity level of several operations. The level of verbosity is a parameter global for FeResPost and may be used to write several information messages during operations in which the risk of inconsistent data has been deemed high. These information messages may be used to debug FeResPost, or your programs using FeResPost. Actually, the majority of programming errors you will find will be related to your own program, but the printing of FeResPost messages may help you to help find your errors. The two methods defined in ``Post'' Module are:

- ``Post.setVerbosityLevelsetVerbosityLevel'' has one ``level'' integer argument and is used to set the level of verbosity.
- ``Post.getVerbosityLevelgetVerbosityLevel'' returns an integer corresponding to the verbosity level.

Presently, the operations influenced by the verbosity level are the operations related to reading finite element models, accessing Results in disk files, Gmsh output...

I.6.7 Conversion of CLA idfiers

Two methods are defined to convert CLA identifiers to Strings, or Strings to CLA identifiers. (See chapter II.0 for the notion of identifier.) The two methods are defined in the ``Post'' Module:

- ``Post.convertIdfierToStringconvertIdfierToString'' has one CLA identifier argument and returns a String.
- ``Post.convertStringToIdfierconvertStringToIdfier'' performs the reverse operation.

"testLam", "15", "[15,testLam]", ...

I.6.8 SQL``BLOB'' methods

The methods ``Post.convertBlobconvertBlob'' returns a ``Result'' or ``Group'' object corresponding to a String argument. The String must correspond to a valid FeResPost BLOB object produced by method ``toBlob'' of one of the FeResPost classes.

I.6.9 Random or PSD integration methods

Method ``Post.calcRandomResponsecalcRandomResponse'' is used to calculate a PSD and/or integrate a PSD and/or a transfert function. We summarize here the theoretical background extracted from [Sof10] that is necessary to understand what the method does. Reader is referred to [Sof10] for more information.

The purpose of a random calculation is to assess structural response as power spectral density assuming that structure behavior to a given type of excitation is known by its transfert function, and that the excitation is specified as an input power spectral density (PSD).

More precisely, one assumes that a unique excitation is present, and one calculates the response at output location :

In previous expression:

- is the structure transfert function at location for an excitation . This transfert function depends on the frequency and is supposed to be obtained by computing a frequency response analysis with Nastran with a unit excitation.
- is the input PSD depending on the kind of excitation and unit system used in the finite element analysis, its units are , , ... The input PSD is scalar.
- is the output PSD at location . Depending on the kind of quantity that is calculated, the output PSD units may differ: for displacements, for accelerations, for stresses, for forces... FeResPost considers that the output PSD can be scalar, vectorial or tensorial depending on the kind of quantity that is calculated.

Once a PSD is calculated, an equivalent RMS output can be calculated as follows:

Practically, FeResPost calculates the integral on a finite range of frequencies:

Practically, the transfert function is known by its values at different frequencies , . Then the integrations above are replaced by integrations on smaller frequency ranges:

Assuming a log-log dependence of between and , one has

in which

The integral in range is then calculated by:

If one assumes that function varies linearly between and , then the integral in range becomes simply:

Note that in Nastran, the assumption of log-log or linear interpolation on each frequency interval is managed by the option RMSINT.

``calcRandomResponse'' method in ``Post'' Module can be used to calculate output PSD from a transfert function, to integrate the PSD, and/or calculate the RMS value. The method is called as follows:

... arr=calcRandomResponse(bOutputPsd,bOutputIntPsd,bOutputRMS, inputResults,freqs,psdIn,integType,addRes) psdOut=arr[0] intPsdOut=arr[1] rms=arr[2] ...The method has 6 or 7 arguments:

- ``
`bOutputPsd`

'' is a logical parameter that specifies whether the output PSD must be returned by the method. - ``
`bOutputIntPsd`

'' is a logical parameter that specifies whether the integration of the output PSD*at each frequency*must be returned by the method. (If one does not require the value at each frequency, only the last value is returned.) - ``
`inputResults`

'' is an Array of Result objects containing the transfert function (complex Result) or only its magnitude (Real result). - ``
`freqs`

'' is an Array of real values corresponding to the frequencies at which the transfert function and input PSD have been discretized. The size of this array must correspond to the size of the ```inputResults`

'' Array. - ``
`psdIn`

'' is an Array of real values corresponding to the input PSD level (excitation) at discretization frequencies. The number of elements in this Array must match the number of elements in ```inputResults`

'' and ```freqs`

'' Arrays. - ``
`integType`

'' is a String that specifies the interpolation and integration rule on frequency intervals. Possible values are ``LogLog'' or ``LinLin''. If another value is provided, ``calcRandomResponse'' raises an exception. - ``
`addRes`

'' is a Real Result that must be considered as the initial value from which the integration of output PSD starts. (This parameter can be very useful when integration is ``sliced'' on sub-ranges of the entire frequency range.) If no starting value is specified, parameter can be omitted. If parameter is ``nil'', one also considers that no starting value is specified.

- The first element corresponds to the output PSD. It is an Array of Result objects that is
filled if ``
`bOutputPsd`

'' argument is true. Otherwise, ``nil'' is returned. - The second element corresponding to the integrated output PSD:
- If ``
`bOutputIntPsd`

'' is true, then this element is an Array of Result object corresponding to the integration at each frequency. - If ``
`bOutputIntPsd`

'' is false, then this element is a Result object corresponding to the last value of the integrated output PSD.

- If ``
- The third output corresponds to the RMS value of the output PSD. This is a Result object.
Practically, the components of the output RMS are calculated as the square root of the corresponding
component of the integrated output PSD. (Or the last value of the integrated output PSD, if
``
`bOutputIntPsd`

'' is set to ``true''.)

I.6.10 Predefined criteria

Method ``Post.calcPredefinedCriterioncalcPredefinedCriterion'' allows to calculate a pre-defined criterion ``hard-coded'' in C++. The parameters of the method are:

- ``CritName'', a String argument that specifies which criterion is required.
- ``InputValues'', an Array containing the arguments for the calculation. (Each argument may be a DataBase, a String an integer, a real value, a Boolean Value, a Result object, a Group object, ...)

Note that the arguments that are passed by reference in function Post.calcPredefinedCriterioncalcPredefinedCriterion can be modified in the predefined criterion. Each predefined criterion should be documented, and the possible side effects of the method should be clearly explained.

Some advantages of using predefined criteria are listed below:

- The predefined criteria give a lower level access to the FeResPost object at C++ level. This allows to perform operations on the objects that could be tricky with higher level language access, and this allows optimizations of the computations. (A marvelous example of optimization is presented in section IV.2.4.3.)
- As the predefined criteria are provided in a compiled shared library, it becomes possible to hide the immplementation to the final user of FeResPost.
- Once a predefined criterion is programmed and debugged, it is easier to guaranty that the same calculation is performed with ruby extension, COM component or .NET assembly.

- The programming of a criterion is C++ can be difficult and errors difficult to track.
- The addition of a criterion, or the modification of an existing criterion requires the re-compilation of FeResPost library.
- Also, if a user has developed is own pre-defined criterion, a recompilation of each new version of FeResPost is necessary to include his criterion.

So far, only a limited number of predefined criteria have been included in FeResPost. They are presented in Appendix IX.D.