# HMRES_complexvonmisesadd()

Use to add complex vonmises results to a data type.

## Syntax

`int HMRES_complexvonmisesadd(HM_entityidtype id, double magnitude, double phase, double offset);`

## Type

HyperMesh hmreslib Function

## Description

Use to add complex vonmises results to a data type.

## Inputs

`id`- The ID of the node or element.
`magnitude`- The magnitude component of the complex number.
`phase`- The phase component of the complex number in degrees.
`offset`- The offset applied to the sine wave.

## Example

Use to add complex vonmises results to a data type. hmreslib stores complex results in polar format (magnitude/phase). This presents a problem, as vonmises stress cannot be represented as a complex number. Instead, hmreslib stores vonmises stress squared. This requires that a complex number and an offset be written to the results file.

To calculate the correct values for the magnitude, phase, and offset, a three point method can be used. First obtain the square of vonmises stress at a base angle of 0, 45, and 180 degrees. After these three values are found, the following equations provide the correct magnitude, phase, and offset:

```
VM1, VM2, and VM3 are the three points where vonmises squared is evaluated at 0, 45, and 90 degrees respectively.
alpha = 2*VM2-VM1-VM3
beta = VM3-VM1
gamma = VM1+VM3
offset = gamma/2.0
magnitude = 0.5*sqrt(alpha*alpha+beta*beta)
phase = 180.0*atan2(beta,alpha)/PI
```

## Errors

None.