# List of useful custom expressions

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 The current User's Guide is very much a work in progress, any help would be greatly appreciated! If you'd like to contribute something, just hit the 'Edit' tab at the top.

The purpose of this page is to serve as a repository for useful custom expressions. For general information about how to use custom expressions in OpenRocket, see the users guide, section 9.

## Rocket dynamics

Basic properties of the physics of rocketry and kinematics. Can be quite useful from an educational point of view. Download all rocket dynamics expressions (.ork)

### Kinetic energy (Ek)

The energy in Joules (J) which the rocket possesses due to its translational motion. See  Equation:

```0.5 * m * Vt^2
```

### Gravitational potential energy (Egp)

The energy in Joules (J) which the rocket possesses due to its position in a gravitational field. The zero point is defined to be at mean sea level. Equation:

```m * g * h
```

### Chemical potential energy (Ecp)

The chemical energy stored in the propellant. Equation:

```mp * 500000
```

Here a representative figure for the potential energy of a solid rocket fuel of 500 kJ/kg is used.

### Momentum (p)

The magnitude of the translational momentum vector. See  Equation:

```m * Vt
```

### Angular momentum (L)

The magnitude of the angular momentum vector of the rocket about the roll axis. In Newton-meter-seconds (Nms). See  Equation:

```Ir * dΦ
```

### Mass ratio (mr)

The ratio of the current mass to the launch mass. Equation:

```m / m
```

### Specific impulse (Isp)

A measure of how efficient a rocket is in in turning propellant flow into thrust. Specific impulse is relative to the earth-weight of propellant and has units of seconds (s). See . Equation:

```(trapz(Ft[:]))/(9.81*(mp-mp))
```

This gives the overall specific impulse for the flight. Note: you are probably mostly interested in the final value that this converges to. Future versions of openrocket may allow a quantity to be calculated only at the end of the flight.

### Effective exhaust velocity (Ve)

Average exhaust speed along the axis of the engine. In m/s. Equation:

```Isp*9.81
```

### Tsiolkovsky delta-V (Tdv)

Gives the maximum change in speed of the rocket (m/s) in the ideal case of no external forces. Equation:

```Ve*log(m/m)
```

## Aerodynamics

Note that some of these expressions depend on variables such as the center of pressure location and angle of attack which are only defined after launch guide clearance and before recovery device deployment.

### Air Density (ρ)

Density of the air (kg/m^3). Equation:

```P/(287.05* T)
```

### Gamma (γ)

This is the ratio of specific heats for dry air. Gamma is technically a variable that changes with temperature, though for most purposes a value of 1.4 suffices. Equation:

```1+(0.401/(1+exp(0.003567*(T-1918))))
```

### Corrective moment coefficient (Ccm)

A coefficient proportional to the corrective force that the rocket creates in response to a disturbance. See  Equation:

```Vt^2*Ar*(Cn/α)*(Cp-Cg)*(P/(287.058*T)) / 2
```

### Natural frequency (fnat)

The frequency at which the angle of attack of the rocket will oscillate following a disturbance. See  Equation (in Hz):

```sqrt(Ccm/Il)/6.2831
```

### Damping moment coefficent (Cdm)

A coefficient proportional to the rate at which any osculations resulting from a disturbance will die away. It is the sum of a propulsive damping term and a aerodynamic damping term. See 

This property can not be expressed as a custom expression, but is available as a simulation listener. To obtain this quantity, add the following simulation listener to your simulation settings for one or more of your simulations. Note that you don't actually have to run the simulation yet, just add it to at least one simulation.

```net.sf.openrocket.simulation.listeners.example.DampingMoment

```

### Damping ratio (ζ)

A dimensionless quantity proportional to the rate of decay of oscillations and independent of the rocket velocity. As the damping ratio tends to 1 the system is critically damped and oscillations tend to zero. In the presence of constant crosswind some oscillation reduces weathercocking and overall a good balance is achieved with damping ratios between .05 and .3. See  for more details.

```Cdm/(2*sqrt(Il*Ccm))
```

Note: requires damping moment listener

### Dynamic pressure (Q)

A pressure term (Pa) associated with the flow of a gas. It is proportional to the aerodynamic stress on the rocket. See . Note this is the usual version for incompressible flow.

Equation:

```0.5 * Vt^2 * P / (T*287)
```

This is an extended version of the dynamic pressure equation that should hold at all speeds. It requires gamma to function. (Pa): Equation:

```0.5* γ* P*(M^2)
```

### Max-Q (Qm)

Simply the maximum dynamic pressure experienced during the flight.

Equation:

```max(Q[:])
```

Note: with this and the later expressions, you are probably mostly interested in the final value of this at the end of the simulation.

### Max-Q time (tQm)

The time (in seconds) after launch when the forces on the rocket are the greatest.

Equation:

```tnear(Q[:],Qm)
```

### High-Q duration (tQh)

The total time (in seconds) during the flight for which the dynamic pressure on the rocket is within 90% of the maximum.

Equation:

```t*binf(Q[:],0.9*Qm,Qm)
```

### Stagnation Temperature (Ts)

This is the temperature experienced by the rocket at high speeds. Requires gamma. (K) Equation:

```T*(1+(M^2)*0.5*(γ-1))
```

## Instrumentation

These expressions are related to instrumentation you might have flying on a rocket. Download all instrumentation expressions (.ork)

### Filtered acceleration (Af)

Emulates an accelerometer with some low pass filtering (.5 s time constant) and a given upper saturation level (30 m/s^2).

Equation:

```uclip( mean(At[t-.5:]), 30 )
```

Note: you may also want to break this up into acceleration Ax, Ay, Az.

The loss or attenuation due to distance in dB of a radio signal transmitted from the rocket to launch site. Here the radio frequency is given in MHz, 100 MHz in this example.

Equation:

```20 * log10(.0418 * sqrt(Px^2+Py^2+h^2) * 100)
```

## Rocket design

### Heating rate (Rh)

This estimates the rate of heat transfer in watts (W) due to friction from the air to the rocket. It is derived by using the drag force to get the change in momentum of a column of air around the rocket and from this the work done by the air on the rocket. It should be roughly proportional to velocity.

Equation:

```(Fd*287*T)/(2*Ar*Vt*P)
```

This could be a starting point to further analysis taking into account the geometry and material of the rocket to find the temperature distribution. Or it could be used for an experimental test.

### Total heating (Ht)

Simply integral of heating rate gives total heat transferred in Joules (J) Equation:

```trapz(Rh[:])
```

## Other

These are mostly just for fun

### Lorentz factor (γ)

Expression which appears in several equations in special relativity. Equation:

```1/sqrt(1 - (Vt^2 / 299792458^2 ))
```

### Relativistic mass (mrel)

The mass of an object in motion (kg)

```m*γ
```

### Relativistic energy (Er)

The total energy of a moving body in J

```sqrt( (m*299792458^2)^2 + (m*Vt*299792458^2)^2)
```