#### COORDINATE_SYSTEM

###### Coordinate system
*COORDINATE_SYSTEM
"Optional title"
csysid, $x_0$, $y_0$, $z_0$, pid
$\hat{x}_x$, $\hat{x}_y$, $\hat{x}_z$, $\bar{y}_x$, $\bar{y}_y$, $\bar{y}_z$
##### Parameter definition
VariableDescription
csysid Unique identification number
$x_0$, $y_0$, $z_0$ Initial coordinate of origin
pid Optional part ID
default: not used
$\hat{x}_x$, $\hat{x}_y$, $\hat{x}_z$ Initial direction of local x-axis
$\bar{y}_x$, $\bar{y}_y$, $\bar{y}_z$ Vector needed for the definition of the local y- and z-axis
##### Description

This command defines a local cartesian coordinate system. The system is forced to follow the translation and rotation of the finite element in which it is embedded at time 0 (Lagrangian description of motion). Hence, the origin of the system must be located on the surface of, or embedded inside, the finite element mesh.

The origin is initially located at ($x_0$, $y_0$, $z_0$) and the local x-direction is ($\hat{x}_x$, $\hat{x}_y$, $\hat{x}_z$). The local z-direction is defined as $\hat{\mathbf{z}} = \hat{\mathbf{x}} \times \bar{\mathbf{y}} / \vert \hat{\mathbf{x}} \times \bar{\mathbf{y}} \vert$ and the local y-direction as $\hat{\mathbf{y}} = \hat{\mathbf{z}} \times \hat{\mathbf{x}}$.

The part ID (pid) is only needed when the initial location of the origin is right in the boundary between two different parts and when the system needs to be tied to one of these parts.

Note that, for fixed (Eulerian) coordinate systems, there is a special command COORDINATE_SYSTEM_FIXED.

##### Example
###### Coordinate system and a fixed coordinate system

A simple model demonstrating differences between COORDINATE_SYSTEM and COORDINATE_SYSTEM_FIXED.

Cube 1 is created with a fixed coordinate system while the other cubes are created with a tilted coordinate system with its origin located on the boundary between them. The coordinate system is given an optional part ID of 3 which ties it to cube 3. The cubes are set in motion and as cube 3 separates from cube 2, the coordinate system is forced to follow cube 3 while the fixed coordinate system remains at its initial location.

*UNIT_SYSTEM
SI
*PARAMETER
%tend = 0.01, "Termination time"
%disp_x = 2, "Displacement in X of cube"
%disp_y = 2, "Displacement in Y of cube"
%L = 1, "Side length cube"
#
# --- TIME and OUTPUT ---
#
*TIME
[%tend], , , 1e-4
*OUTPUT
[%tend/5]
#
# --- MESH ---
#
*COMPONENT_BOX
1, 1, 2, 2, 2, 1
[-%L], [-%L/2], [-%L/2], 0, [%L/2], [%L/2]
*COMPONENT_BOX
2, 2, 2, 2, 2, 2
[-%L], [-%L/2], [-%L/2], 0, [%L/2], [%L/2]
*COMPONENT_BOX
3, 3, 2, 2, 2, 2
0, [-%L/2], [-%L/2], [%L], [%L/2], [%L/2]
#
# --- MATERIAL ---
#
*MAT_RIGID
1, 7800
*PART
1, 1
2, 1
3, 1
#
# --- COORDINATE SYSTEMS ---
#
*COORDINATE_SYSTEM_FIXED
1, 1, 0.5, 0.5
*COORDINATE_SYSTEM
2, 1, 2.5, 0.5, 3
cos(45), sin(45), 0, 2, 1, 1
#
# --- MOTION IN GLOBAL X-DIRECTION ---
#
*BC_MOTION
"All cubes"
1
ALL
D, X, 1
*FUNCTION
1
smooth_d(%disp_x, 0, %tend)
#
# --- MOTION IN GLOBAL Y-DIRECTION (CUBE 3) ---
#
*BC_MOTION
"Cube 3"
4
P, 3
D, Y, 2
*FUNCTION
2
smooth_d(%disp_y, 0, %tend)
*END