next up previous contents index
Next: I.7 Modification of Standard Up: I. FeResPost Reference Manual Previous: I.5 The ``ResKeyList'' class   Contents   Index

Subsections


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.

Table I.6.1: The different methods that have been defined in ``Post'' module. userManual.Post.methods.tab
(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:

The redirection of standard output is useful when FeResPost is not run in ``console'' mode. Moreover, it is sometimes handy to separate the outputs of FeResPost, and does of the ruby post-processing program.


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):


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):

Also other functions that have no correspondence in Result class methods can be used to define new Results Most of the dyadic functions insert a pair ``key-value'' in the created Result only if the corresponding key is found in the two Result arguments. ``Post.Post.minmin'', ``Post.Post.maxmax'' and the `Post.Post.mergemerge'' methods are an exception: if a given key is found in only one of the two argument it is inserted in the new Result.


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:

These four methods have been defined to allow the use of FeResPost ruby extension without modifying standard classes like ``Float'' and ``Array''. Otherwise the corresponding operators defined in the ``dflt.ResultResult'' class should be used. (See section I.4.6.)


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:

  1. A String corresponding to the name of the session file.
  2. 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.
The session file from which Groups are read is as defined in section I.1.2.1. Examples of use of the method follow:
        ...
        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:

  1. The first argument of the method is a String containing the name of the output session file.
  2. 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.

The following statements:
        ...
        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:

The verbosity level may presently range from 0 to 2. 0 corresponds to no information messages. The amount of information messages increases with 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:

Examples of valid Strings corresponding to CLA identifiers:
		    "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 $ a$ is present, and one calculates the response at output location $ j$ :

$\displaystyle S_{ja}=\left\vert H_{ja}\right\vert^2 S_a .
$

In previous expression: Note that the input and output PSD have always positive real values for all components.

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

$\displaystyle \overline{u}_j=\sqrt{\int_0^\infty S_{ja}(f) df} .
$

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

$\displaystyle \overline{u}_j=\sqrt{\int_{f_{\text{min}}}^{f_{\text{max}}} S_{ja}(f) df} .
$

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

$\displaystyle \int_0^\infty S_{ja}(f) df\approx \sum_{i=1}^{N-1}\int_{f_i}^{f_{i+1}}S_{ja}(f) df .
$

Assuming a log-log dependence of $ S_{ja}(f)$ between $ {f_i}$ and $ f_{i+1}$ , one has

$\displaystyle S_{ja}(f)=\frac{S_{ja}(f_i)}{f_i^\alpha}f^\alpha$    with $\displaystyle f_i<f<f_{i+1} ,
$

in which

$\displaystyle \alpha=\frac{ \log{(S_{ja}(f_{i+1})/S_{ja}(f_i)}) }{ \log{(f_{i+1}/f_i)}}\ .
$

The integral in range $ \left[f_i,f_{i+1}\right]$ is then calculated by:

$\displaystyle \int_{f_i}^{f_{i+1}} S_{ja}(f) df= \left\{
\begin{array}{ll}
...
...right)^\alpha-f_i \right) & \text{ if }\alpha\not=-1
\end{array}
\right.
$

If one assumes that function $ S_{ja}(f)$ varies linearly between $ f_i$ and $ f_{i+1}$ , then the integral in range $ \left[f_i,f_{i+1}\right]$ becomes simply:

$\displaystyle \int_{f_i}^{f_{i+1}} S_{ja}(f) df=\frac{\left(S_{ja}(f_i)+S_{ja}(f{i+1})\right)\left(f_{i+1}-f_i\right)}{2}\ .
$

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:
  1. ``bOutputPsd'' is a logical parameter that specifies whether the output PSD must be returned by the method.
  2. ``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.)
  3. ``inputResults'' is an Array of Result objects containing the transfert function $ H_{ja}$ (complex Result) or only its magnitude $ \left\vert H_{ja}\right\vert$ (Real result).
  4. ``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.
  5. ``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.
  6. ``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.
  7. ``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.
Note that the different Result arguments must have the same size and keys. The method returns an Array of 3 elements:
  1. 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.
  2. The second element corresponding to the integrated output PSD: Note that the optional ``addRes'' parameter defines the start for the integration.
  3. 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:

The method returns an Array of ``OutputValues'' similar to the Array of input arguments.

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:

Of course, the adoption of pre-defined criteria has also some disadvantages:

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


next up previous contents index
Next: I.7 Modification of Standard Up: I. FeResPost Reference Manual Previous: I.5 The ``ResKeyList'' class   Contents   Index
FeResPost 2017-05-28