# How to begin modelling with ASCEND

*This article is incomplete or needs expanding. Please help out by adding your comments.*

This is an attempt at helping beginners learn ASCEND. Art has started the page that will walk through the process of developing a reusable model for a **tank**. I am experimenting with adding equations (in latex) and code and scripts to see how unwieldy it could get (The objective is to keep it as simple as possible and not too intimidating to a beginner, yet highlight important issues on how to model correctly. We should provide links on this page to the models that can be downloaded and run). I will be working on cubic equations of state.

## Contents

- 1 Collect equations you need for the model
- 2 Translate those equations into the ASCEND language
- 3 Write METHODS that will make it easy to read the MODELS
- 4 Make the MODEL reusable by clearly setting METHODS that are private to those that are not
- 5 Example of how a reusable MODEL can be reused
- 6 Thermodynamic Models that come with ASCEND

## Collect equations you need for the model

Note that where *T*_{c} is the critical temperature and *T*_{r} is the reduced temperature and similarly

where *P*_{c} is the critical pressure and *P*_{r} is the reduced pressure

### Generic cubic Equations of State

#### Setting parameters to get PengRobinson, Redlich Kwong, Soave Redlich Kwong and VdW

##### Pengrobinson

are constants and is the Pitzer acentric factor

## Translate those equations into the ASCEND language

PSI :== 0.42748; OMEGA :== 0.07780; sigma :== 2.414213562; eps :== 0.414213562; Tr = T/Tc; Pr = P/Pc; alpha = (1.0 + (0.37464+1.54226*omega-0.26992*omega^2)*(1.0-Tr^(0.5)))^2; q = PSI*alpha/(OMEGA*Tr); beta = OMEGA*Pr/Tr; Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));

## Write METHODS that will make it easy to read the MODELS

ASCEND comes with several METHODS that are executed automatically. ClearAll, default_self, values and specify for example. The objective is to set the system to be square, so you have a solution - that is, the number of unknowns should equal the number of independent equations.

### Set Pressure, Temperature, calculate Volume

### Set Temperature, Volume, calculate Pressure

### Set Volume, pressure, calculate temperature

## Make the MODEL reusable by clearly setting METHODS that are private to those that are not

## Example of how a reusable MODEL can be reused

### Calculate fugacity coefficients for a binary system

## Thermodynamic Models that come with ASCEND

Rackett, UNIFAC, WILSON, Ideal