You are on page 1of 25

Department of Biochemical

and Chemical Engineering

Dynamic simulation

Sven Wegerhoff
Room: G2-3.28
Phone: 5142
Prof. Engell

Katja Pelz
Room: G2-5.10 a
Phone: 5165

On
nly for private us
se in the context of this course

Dynamic Simulation

Dynamic Simulation
Part V:
PDEs in gPROMS

Many processes in chemical


engineering are described by
parameter systems
y
distributed p

Example: axial heat transfer


in adiabatic plug flow

Describes the spatial variation of


the states within the system
Partial differential equations
q
cf. Lecture Dynamic Models

Examples

T(t,z=0)
(
)

T(t,z=L)
(
)

T
T
k z 2T
u

t
z F cP z 2

W
Wave
equation
ti

Diffusion

Needed to solve a PDE

Dynamic plug flow reactor

Initial conditions (t = 0)

Heat transfer

(Boundaries (z = 0 and z = L))

On
nly for private us
se in the context of this course

Motivation

Recap PDEs

A PDE is numerically solved by


transforming the PDE into a system of
ODEs

Spatial coordinate is discretized in N+1


discretization points
Partial derivatives are approximated at
the discretization points

Common used algorithm

Backward, forward
Backward
forward, centered difference
methods
x xi 1 (t ) xi (t )
Backward dif
ference method: t
h

x3 (t , z )

x 4 (t , z )

x1 (t , z )

Idea:

x(t , z )

x2 (t , z )

x(t , z )
x0 (t , z )
z0

z1

z2

z3

z4

Example:

x
x

, x( z 0, t ) 2, x( z , t 0) 0
t
z

x1
1 1 0 x1 1 2


h 1 1 x2 h 0
t x2
D

On
nly for private us
se in the context of this course

Axial heat transfer in a tube

1) Create a new model HeatTransferTube


HeatTransferTube
2) Specify all parameters in the model
3) Implement these parameters in
gPROMS

T(t,z=0)

T(t,z=L)

T
T
2T
F cP
u
kz 2
t
z
z

T (t , z 0) Tin
PARAMETER
c_p
AS
k_z
AS
Rho_F
AS
TubeLength AS
TubeRadius AS

REAL
REAL
REAL
REAL
REAL

kz

T
z

0
z L

T (t 0, z ) T0

On
nly for private us
se in the context of this course

First task

D
Y
N
On
nly for private us
se in the context of this course

Distribution domain

In our example, the temperature


T varies with time and axial position

Distribution domain defines an


additional dimension of the system
system. In
our example, the axial domain of the
Temperature T.

General syntax
DISTRIBUTION_DOMAIN
Domain AS [xmin : xmax]

T(t,z=0)

T(t,z=L)

T
T
k z 2T
u

t
z F cP z 2
T (t , z 0) Tin
T
z

0,

T (t 0, z ) T0

z L

In our example
DISTRIBUTION_DOMAIN
Axial AS [0 : TubeLength]

On
nly for private us
se in the context of this course

T f (t , z )

D
Y
N
On
nly for private us
se in the context of this course

Variables which do not depend on


the spatial variation of the new
g
domain are defined as usual,, e.g.
Variable AS VariableType

T(t,z=0)

T
T
k z 2T
u

t
z F cP z 2

In our example
T_in AS Temperature

Variables which depend on the


spatial variation are defined as
follows

T(t,z=L)

Task
Define all variables and implement
these variables in gPROMS

Variable AS DISTRIBUTION(DOMAIN,) OF VariableType


In our example:
T AS DISTRIBUTION(Axial) OF Temperature

On
nly for private us
se in the context of this course

Variable

D
Y
N
On
nly for private us
se in the context of this course

Interval

Mathematical
notation

Interpretation

gPROMS
notation

Closed

[0,L]

z [0, L] 0 z L

0:L

Left-open/Right-closed

(0,L]

z (0, L] 0 z L

0|+ : L

Right open/Left closed


Right-open/Left-closed

[0 L)
[0,L)

z [0, L) 0 z L

0 : L|L|

Open

(0,L)

z (0, L) 0 z L

0|+ : L|-

Example: dispersion in a tube


z=0

z=L

Open

z=0

z=L

Right-open/
Left-closed
Left
closed

z=0

z=L

z=0

Left-open/
Right-closed
Right
closed

z=L

Closed

On
nly for private us
se in the context of this course

Definition of intervals in gPROMS

Implementation of partial derivations


Partial derivations are implemented in gPROMS by the PARTIAL operator
Only exception is the time derivation:

dT
T
or
t
dt

$T
On
nly for private us
se in the context of this course

For derivations of 1st order: PARTIAL (Variable,DistributionDomain)


T
z

PARTIAL(T,Axial)
( ,
)

(uc)
z

T
kr

z z

PARTIAL(u*c,Axial)
PARTIAL(u
c,Axial)

PARTIAL(k_r*PARTIAL(T,Axial),Axial)

Partial derivation of higher order


In principle the same as for partial derivations of 1st order
PARTIAL(Variable,DistributionDomain,DistributionDomain,)
2T
z 2
3T
z 3
2 (uc )
z 2
2T
zr

On
nly for private us
se in the context of this course

PARTIAL(T,Axial,Axial)
PARTIAL(T,Axial,Axial,Axial)
PARTIAL(u*c,Axial,Axial)
(u c, a , a )
PARTIAL(T,Axial,Radial)

Boundary
To solve a PDE, initial conditions and
boundary conditions are needed

In BOUNDARY the corresponding


boundary conditions are defined

TWall
z

T(t,z=0)
L

Syntax:

T
T
k z 2T
u

t
z F cP z 2
T (t , z 0) Tin

Variable(index) = BoundaryCondition;
In our example:
BOUNDARY
#z=0
T(0) = T_in;
T i
#z=L
-k_z*PARTIAL(T(RopeLength),Axial) = 0;

T(t,z=L)

k z T
T
F cP z

0
z L

T (t 0, z ) T0

On
nly for private us
se in the context of this course

D
Y
N
On
nly for private us
se in the context of this course

A PDE is implemented in the discretized form


for each domain
x(t , z )

x3 (t , z )

Syntax:
FOR z:=z_min TO z_max DO

x 4 (t , z )

x1 (t , z )

FOR y:=y_min TO y_max DO

x 2 (t , z )

FOR
Equation
END
END

x(t , z )
x0 (t , z )

END

In our example

T
T
k z 2T
u

t
z F cP z 2

z0

z1

z2

z3

z4

EQUATION
FOR z:=0|+ TO RopeLength|- DO
$T(z) = -u*PARTIAL(T(z),Axial)+k_z/(Rho_F*c_p)*PARTIAL(T(z),Axial,Axial);
END

On
nly for private us
se in the context of this course

Equation

D
Y
N
On
nly for private us
se in the context of this course

Task:
Create a new
process
Set the unit
On
nly for private us
se in the context of this course

PROCESS

D
Y
N

SET
Additionally to the numerical values of the parameters, the discretization method
has to be defined in the SET section

Syntax:
y
Domain := [[Numerical method , Order,, Elements];
];
Types of discretization methods

Numerical method

gPROMS

Order

Centered finite difference method

CDFM

2,4,6

Backward finite difference method

BDFM

1,2

Forward difference method

FFDM

1,2
,

Orthogonal collocation on finite elements method

OCFEM

2,3,4

p with using
g the backward finite difference method with order 1 and 20 elements
In our example
SET

Axial
a := [[BDFM , 1,, 20];
0];

On
nly for private us
se in the context of this course

Parameter values

Parameter

Value

1000 kg/m3

5m

kz

0 58 W/(mK)
0.58

cp,F

4200 J/mol

Discretization method:
Backward finite difference method with order 1 and 15 elements (=N)

On
nly for private us
se in the context of this course

Numerical values of the model

D
Y
N
On
nly for private us
se in the context of this course

Variable
Value

TIn
25C
25
C

u
0.5 m/s

On
nly for private us
se in the context of this course

Assign

D
Y
N

D
Y
N
On
nly for private us
se in the context of this course

INITIAL
The initial condition, the
condition at t = t0, has to be
defined for the whole domain
domain,
i.e. in our example

TWall
z

T(t,z=0)

T(t,z=L)

INITIAL
WITHIN HT DO
FOR z:= 0|+ TO TubeLength|- DO
T(z) = 10;
END
END

T
T
k z 2T
u

t
z F cP z 2
T (t , z 0) Tin

k z T
T
F cP z

0
z L

T (t 0, z ) 10C

On
nly for private us
se in the context of this course

D
Y
N
On
nly for private us
se in the context of this course

You might also like