Difference between revisions of "TrackError Custom Task"

From OSUPDOCS
Jump to navigation Jump to search
Line 36: Line 36:
  Parameter archiveTime,(timeInterval)
  Parameter archiveTime,(timeInterval)
  Parameter firstArchiveTime,(firstTime)
  Parameter firstArchiveTime,(firstTime)
Parameter Cumulative,(cumulative)
  Parameter P,(Pvalue)
  Parameter P,(Pvalue)
Parameter Cumulative,(cumulative)
  Parameter function,(xpPexpr)
  Parameter function,(xpPexpr)
     . . .
     . . .
Line 46: Line 46:
     <Parameter name='archiveTime'>(timeInterval)</Parameter>
     <Parameter name='archiveTime'>(timeInterval)</Parameter>
     <Parameter name='firstArchiveTime'>(firstTime)</Parameter>
     <Parameter name='firstArchiveTime'>(firstTime)</Parameter>
    <Parameter name='cumulative'>(cumulative)</Parameter>
     <Parameter name='P'>(Pvalue)</Parameter>
     <Parameter name='P'>(Pvalue)</Parameter>
    <Parameter name='cumulative'>(cumulative)</Parameter>
     <Parameter name='function'>(xpPexpr)</Parameter>
     <Parameter name='function'>(xpPexpr)</Parameter>
         . . .
         . . .
Line 57: Line 57:
* <tt>(firstTime)</tt> - Enter the time to start error metric calculations (in [[ConsistentUnits Command#Legacy and Consistent Units|alt time units]]). After this time is reached, subsequent calculations will be spaced by the entered <tt>(timeInterval)</tt> This parameter is ignored unless the <tt>(timeInterval)</tt> parameter is set as well.
* <tt>(firstTime)</tt> - Enter the time to start error metric calculations (in [[ConsistentUnits Command#Legacy and Consistent Units|alt time units]]). After this time is reached, subsequent calculations will be spaced by the entered <tt>(timeInterval)</tt> This parameter is ignored unless the <tt>(timeInterval)</tt> parameter is set as well.


Next, you enter up to 10 <math>|x_p|^P</math> expressions for evaluating error metric. The expression (written in the style of [[User Defined Functions|user-define function]], but can contain more variables:
Next, you enter up to 10 <tt>(xpPexpr)</tt><math>=|x_p|^P</math> expressions for evaluating error metrics. The expressions are written in the style of [[User Defined Functions|user-defined function]], but can contain different variables:
 
* <tt>t</tt> for simulation time (in [[ConsistentUnits Command#Legacy and Consistent Units|alt time units]])
* <tt>x</tt>, <tt>y</tt>, and <tt>z</tt> for particle position (in [[ConsistentUnits Command#Legacy and Consistent Units|length units]])
* <tt>xo</tt>, <tt>yo</tt>, and <tt>zo</tt> for original particle position (in [[ConsistentUnits Command#Legacy and Consistent Units|length units]])
* <tt>vx</tt>, <tt>vy</tt>, and <tt>vz</tt> for particle position (in [[ConsistentUnits Command#Legacy and Consistent Units|velocity units]])
* <tt>sxx</tt>, <tt>syy</tt>, <tt>szz</tt>, <tt>sxy</tt>, <tt>sxz</tt>, and <tt>syz</tt> for particle stress (in [[ConsistentUnits Command#Legacy and Consistent Units|pressure units]])
 
To determine the type of error metric, enter <tt>(cumulative)</tt> and <tt>(Pvalue)</tt> options before entering the <tt>(xpPexpr)</tt> expressions. Once these parameters as set, they apply to all subsequent <tt>(xpPexpr)</tt> expression unless changed to new values. Their functions are


* <tt>t</tt> for simulation time (in [[ConsistentUnits Command#Legacy and Consistent Units|alt time units]])
<ul>
* <tt>x</tt>, <tt>y</tt>, and <tt>z</tt> for particle position (in [[ConsistentUnits Command#Legacy and Consistent Units|length units]])
<li><tt>(cumulative)</tt> - set to 0 or 1. If 0, the error metric is found for each time step. If 1, the error metric aveagre all time steps with calculations.</li>
* <tt>xo</tt>, <tt>yo</tt>, and <tt>zo</tt> for original particle position (in [[ConsistentUnits Command#Legacy and Consistent Units|length units]])
<li><tt>(Pvalue)</tt> - determines the error metrix that is calculations. If <tt>(Pvalue)=P&gt;0</tt> and <tt>(cumulative)=0</tt>, the error metric calculated is<br>
* <tt>vx</tt>, <tt>vy</tt>, and <tt>vz</tt> for particle position (in [[ConsistentUnits Command#Legacy and Consistent Units|velocity units]])
</li>
* <tt>sxx</tt>, <tt>syy</tt>, <tt>szz</tt>, <tt>sxy</tt>, <tt>sxz</tt>, and <tt>syz</tt> for particle stress (in [[ConsistentUnits Command#Legacy and Consistent Units|pressure units]])
</ul>

Revision as of 22:03, 27 August 2019

A custom task to archive simulations results compared to theoretical predictions

Introduction

This tasks can compare particle values to a theoretical model and archive some metric for accuracy of the simulation. It is useful for tracking convergence of MPM simulations.

Simulation Error Metrics

Imagine a generic distance from particle value to a theoretical expectation for that value equal to [math]\displaystyle{ |x_p| }[/math]. For example, the distance could be difference between particle stress in the x directions and expected stress:

      [math]\displaystyle{ |x_p| = |\sigma_{p,xx} - \sigma_{xx}({\rm theory})| }[/math]

If the particle value is a vector, the distance would be a vector distance. For example, velocity distance would be:

      [math]\displaystyle{ |x_p| = \sqrt{\bigl(\vec V_p-\vec V({\rm theory})\bigr)\cdot\bigl(\vec V_p-\vec V({\rm theory})\bigr)} }[/math]

The P-norm for a give distance is defined as:

      [math]\displaystyle{ ||x||_P = \left( \sum_{p=1}^{N_p} |x_p|^P\right)^{1/P} }[/math]

where [math]\displaystyle{ N_p }[/math] is the number of particles. The root-mean-squared distance is defined as:

      [math]\displaystyle{ {\rm RMS} = \sqrt{{1\over N_p} \sum_{p=1}^{N_p} |x_p|^2} }[/math]

This task can archive mean P-norm values and RMS distances for any entered function of [math]\displaystyle{ |x_p|^P }[/math]. These mean values can be for each time step or cumulatively averaged over all time steps.

Task Scheduling

In scripted files, a TrackError custom task is scheduled using

CustomTask TrackError
Parameter archiveTime,(timeInterval)
Parameter firstArchiveTime,(firstTime)
Parameter Cumulative,(cumulative)
Parameter P,(Pvalue)
Parameter function,(xpPexpr)
   . . .

In XML files, this tasks is scheduled using a Schedule element, which must be within the single <CustomTasks> block:

<Schedule name='TrackError'>
   <Parameter name='archiveTime'>(timeInterval)</Parameter>
   <Parameter name='firstArchiveTime'>(firstTime)</Parameter>
   <Parameter name='cumulative'>(cumulative)</Parameter>
   <Parameter name='P'>(Pvalue)</Parameter>
   <Parameter name='function'>(xpPexpr)</Parameter>
        . . .
</Schedule>

where the first two parameters, both of which are optional, are

  • (timeInterval) - Enter the time interval (in alt time units) between calculations of error metrics. If this parameter is omitted, the calculations are done on the same steps as the particle archives.
  • (firstTime) - Enter the time to start error metric calculations (in alt time units). After this time is reached, subsequent calculations will be spaced by the entered (timeInterval) This parameter is ignored unless the (timeInterval) parameter is set as well.

Next, you enter up to 10 (xpPexpr)[math]\displaystyle{ =|x_p|^P }[/math] expressions for evaluating error metrics. The expressions are written in the style of user-defined function, but can contain different variables:

To determine the type of error metric, enter (cumulative) and (Pvalue) options before entering the (xpPexpr) expressions. Once these parameters as set, they apply to all subsequent (xpPexpr) expression unless changed to new values. Their functions are

  • (cumulative) - set to 0 or 1. If 0, the error metric is found for each time step. If 1, the error metric aveagre all time steps with calculations.
  • (Pvalue) - determines the error metrix that is calculations. If (Pvalue)=P>0 and (cumulative)=0, the error metric calculated is