Вы находитесь на странице: 1из 121

0

Thermal Study of a new


Electrochromatographic device:
Design, Creation and Analysis of a
Simulation Program in MATLAB.

FINAL DEGREE PROJECT




August of 2011
Technische Universitt Kaiserslautern
Fachbereich Maschinenbau und Verfarenstechnik
Lehrstuhl fr Thermische Verfahrenstechnik
Prof. Dipl.-Ing. Dr. techn. H.-J. Bart


Pedro Fernndez Ramrez

Supervisor: M.Sc.Tobias Kiefer



i i

_______________________________________________________________________________________
i




Acknowledgements
To Tobias Kiefer, in first place for his character,
in second for all his help tutoring my project.
To Prof. Dr. Hans-Jrg Bart, for giving me the
opportunity of being part of the Department.

A todos los buenos profesores que he tenido,
en especial a Jos Luis Gmez Carrasco.
A mi tutor en Murcia, Vctor Meseguer Zapata,
por toda su ayuda.


Y por supuesto, a mis padres, hermanos y amigos.




i i

_______________________________________________________________________________________
ii

i i

_______________________________________________________________________________________
iii
Table of contents
Abstract ............................................................................................................................................................. vi
1. Introduction ................................................................................................................................................... 1
2. Theory ............................................................................................................................................................ 2
2.1 Introduction ............................................................................................................................................. 2
2.1.1 Electrophoresis .................................................................................................................................. 2
2.1.2 Chromatography................................................................................................................................ 3
2.1.3 Electrochromatography ..................................................................................................................... 4
2.2 Basis of Separation ................................................................................................................................... 5
2.2.1 Electrophoresis Principles ................................................................................................................. 5
2.2.2 Electroosmotic Flow .......................................................................................................................... 6
2.2.3 Chromatography Principles ............................................................................................................... 8
2.3 Description of the System ...................................................................................................................... 10
2.4 Energy Balance ....................................................................................................................................... 11
2.5 Mathematics: Method of Lines ............................................................................................................. 14
2.5.1 Spatial Discretization ....................................................................................................................... 14
2.5.2 Cash-Karp Method ........................................................................................................................... 16
2.5.3 Used Tools ....................................................................................................................................... 18
3. Development of the Program ...................................................................................................................... 19
3.1 Thermal Behavior Observed .................................................................................................................. 19
3.2 Resolution of the Energy Balance .......................................................................................................... 20
3.2.1 Steady State with Uniform Heating ................................................................................................. 20
3.2.2 Two-Dimensional Temperature Distribution. System of Blocks ..................................................... 21
3.2.3 Fixed Size Stencil.............................................................................................................................. 23
3.2.4 Variable Size Stencil ......................................................................................................................... 30
3.2.5 Cash-Karp Method Implementation ................................................................................................ 36
3.2.6 A technical solution for the unequal heat generation .................................................................... 41
3.2.7 Other Characteristics of the Simulation Program ........................................................................... 47
3.2.8 Factors not considered .................................................................................................................... 47
3.3 User Interface ......................................................................................................................................... 49
3.3.1 Single Simulation ............................................................................................................................. 49
3.3.2 Parameters Study ............................................................................................................................ 51

i i

_______________________________________________________________________________________
iv
4. Simulation Setting ........................................................................................................................................ 52
4.1 Standard Values ..................................................................................................................................... 52
4.2 Convection Coefficient Estimation ........................................................................................................ 53
4.3 Suspension Thermal Conductivity ......................................................................................................... 54
4.4 Heating Experiment with Ethanol ......................................................................................................... 56
5. Results and Discussion ................................................................................................................................. 58
5.1 Simulations versus Experiments ............................................................................................................ 58
5.2 Parameters Study ................................................................................................................................... 59
5.3 A Theoretical Approach to Unequal Heating ........................................................................................ 61
6. Conclusions .................................................................................................................................................. 67
7. Outlook ......................................................................................................................................................... 68
8. Literature ...................................................................................................................................................... 69

Appendix: Code of the Simulation Program








i i

_______________________________________________________________________________________
v
i i

_______________________________________________________________________________________
vi
Abstract
Electrochromatography is a promising method for separating substances that can improve usual
techniques, as HPLC or CE, at certain fields. However, the heat generation due to the application of an
electrical field in that operation limits the size of the apparatus that can be used, since temperature must
be strictly controlled for optimizing the method. In our department a new electrochromatographic device is
being developed, in which separation takes place in the interior of a thin layer, so the amount of sample to
be treated can be increased. The thermal study of that new device is exposed in the present work, in which
a computer program has been built for simulating the thermal behavior of the system.
For understanding that thermal behavior, it is necessary to solve its energy balance equation, a partial
differential equation. That has been solved employing the usually referred as Method of Lines, where in
first place the original problem is transformed into a system of ordinary differential equations imposing
spatial discretization. Depending on the accuracy that it is wanted to be reached in the simulation, the user
can choose between two different methods for spatial discretization. In second place, the resulting system
of differential equations is solved. For this proposal, Cash-Karp method, a member of the Runge-Kutta
family of ordinary differential equations solvers, has been implemented and optimized for its use in present
case, improving the calculation speed of usual Cash-Karp method for this concrete problem.
In the other hand, it has been observed experimentally that the heat is not equally generated. This problem
has been faced implementing in the program a regression model for predicting that thermal
heterogeneities. However, this is just a temporary solution, and it would be desirable to understand the
principles behind that phenomenon. A theoretical model that could explain that observations is proposed
at the last section of the work.
The simulation program has been built so it can be handled easily, by the creation of a user interface. The
user of the program can choose between simulating a single experience or a set of cases in order to analyze
the influence of certain variables, using the tool Parameters Study.
The program built helps to understand the thermal behavior of the device and allows the user to make
predictions about what would happen if an experiment is carried out at certain conditions.
i i

_______________________________________________________________________________________
vii


i i

_______________________________________________________________________________________
1
1. Introduction
In this Degree Thesis a thermal study of a new electrochromatic device has been completed. This study can
be divided in two main sections:
- In one hand, the theoretical considerations required for understanding the thermal behavior of the
system have been exposed and analyzed.
- On the other, having those considerations into account, a simulation program has been built in
order to be able to predict and explain the thermal behavior of the system.
Computer-Based simulation is a powerful tool for analyzing systems and make predictions about the
behavior those would exhibit in certain situations. Nowadays, it is possible to find professional software
displaying excellent results for thermal analysis, so before starting with the next section there is a question
that must be answered, why building another program for simulating the thermal behavior of a system?
There are some reasons for it. The first, and maybe more important, is for developing our original and
unique simulation program, so the thermal study can be realized without depending on factors beyond our
control.
Another important reason is the didactical value that design, create and analyze this program implies.
This Degree Thesis is part of a main project, consisting in the Development of a New
Electrochromatographic Device. That operation is usually carried out in the interior of a capillary tube, so
the amount of sample that can be treated is quite small. This kind of apparatus is used because it is very
easy to evacuate the heat generated during the process, but it limits the process to analytical scale. The
main advantages of the new apparatus that is being developed in our department are:
- The treatment is enhanced to a preparative scale.
- Separation takes place in a thin layer, so temperature can be easily controlled.
Since the operation requires the application of an electrical field, there is a heat generation according to
Joule Effect. Temperature heterogeneities must be avoided because they can contribute to undesirable
effects such band broadening. So, it is highly important to establish a temperature control.
Besides, it has been observed experimentally an unexpected phenomenon; the heat is not generated
homogeneously. There are regions where there is a heat generation bigger than expected. Looking for an
explanation of that phenomenon is also a target of the present work, as well as suggesting any
improvement that could avoid this undesirable effect.
Electrochromatography is a relatively new technique for separating and analyzing samples that it is
revealing as a wonderful method that combines the separation and selectivity potential of High
Performance Liquid Chromatography and the high efficiency of Capillary Electrophoresis. The new device
developed in our department will increase the usefulness of that operation, by extending the fields in
which it can be applied. Understanding the thermal behavior of the new apparatus is a very important step
required for optimizing the electrochromatographic device. The main target of this work is to contribute to
that objective.

i i

_______________________________________________________________________________________
2
2. Theory
The theoretical knowledge needed to understand the operation and the simulation program is stated in
this main section. After a short introduction to electrochromatography, the principles governing this
technique are discussed. Special attention is paid to the energy balance and the numerical method used for
solving it. A description of the device and its experimental thermal behavior is provided as well.

2.1. Introduction
Electrophoresis is an analytical method used to separate different substances contained in a mixture
depending on their size and electrical charge. It is based on the distinct mobility shown by the electrolytes
in the matrix of a conductive medium as a consequence of the application of an electrical field. On the
other hand, in chromatography two different phases are found; stationary and mobile phase. The unequal
adsorption between the stationary phase and separate substances contained in the mobile phase is the
driving force that promotes the separation of these ones. Electrochromatography, as can be drawn from
the own word, is a combination of electrophoresis and chromatography. A brief summary of the history of
these chemical techniques is exposed in the next subsections.
2.1.1 Electrophoresis
Arne W.K. Tiselius was a pioneer in the use of electrophoresis. In 1930 he obtained his doctorate in a study
of applications of this technique for proteins separation [TIS30]. For this, he made use of the results
achieved by earlier researches; the transference of the electrolytes of inorganic compounds with an
electrical current studied by Hittorf in 1853 as well as comprehensive works of the electrophoresis of
biomolecules carried out by Hardi and Michaelis are noteworthy. This method presented some technical
disadvantages that had to be overcome, what was effectuated in 1937 when Tiselius himself presented a
reconstruction of the electrophoresis device [TIS37]. The new distribution was so significant that it is
usually considered the first electrophoretic apparatus. In 1948, the Nobel Prize in Chemistry was awarded
to Tiselius for his research on electrophoresis and adsorption analysis, especially for his discoveries
concerning the complex nature of the serum proteins. [TIS48]
The importance of the technique increased in the 1950s, when the Zone Electrophoresis was developed. In
this case a solid or gel matrix is used to separate compounds into discrete bands, instead of just charged
molecules moving through a solution. After Oliver Smithies presented a paper describing a new type of
zone electrophoresis using starch gel as the supporting medium in 1955 (Figure 3.1), the method was
widely spread in biochemistry applications [SMI55].
In Capillary Electrophoresis (CE), which was introduced in the 1960s, the separation takes place in the
interior of a small capillary filled with the corresponding electrolyte. It must be considered that the tinier
the diameter of the capillary is the bigger ratio between surface and volume it shows. Thus, the cooling of
the system becomes easier and the employment of very high electrical fields is possible. This results in an
increase of flow rate and efficiency of the separation. The relationship between the heat generated in the
device and the voltage applied will be discussed in section 2.4.
Many electrophoresis procedures have been well established. Some of the most common types are Gel
Electrophoresis (usually the gel used is polyacrylamide or agarose), Capillary Electrophoresis, Two-
dimensional Electrophoresis, Isoelectric Focusing and Pulsed Field Electrophoresis. Vast applications of
those techniques are found in the field of biochemistry; although it is also used with inorganic compounds,
its suitable ability for separating organic macromolecules makes them a constant reference in this
discipline. DNA, proteins, antibiotics or vaccines analysis are usually practiced, as well as determination of
Theory i

_______________________________________________________________________________________
3
physicochemical properties such as molecular weight or isoelectric point. Some concrete examples can be
found in literature [DEL94], [BOT06], [CHE98], [WOO94].

Fig 2.1 General layout of Smithies apparatus. A, Ag/AgCl electrode; B, concentrated NaCl solution in electrode compartment; C,
filter-paper bridges soaked in bridge solution; D, compartment containing bridge solution; E, starch gel contained in plastic tray; F,
position of sample insertion; G, seal to prevent loss of water during electrophoresis. [SMI55]
2.1.2 Chromatography
The employment of adsorption principle for substances isolation has been used since the beginning of the
19th century, but it was in 1903 when the method was officially named as 'Chromatography', after Mikhail
S. Twsett used this word in his publication about separation of plant pigments [TWS05]. However this work
was not widely spread, mainly because it was not written in English, and it was not until the end of the
Second World War when a significant development took place as a consequence of the work of Richard
Sygne and Archer Martin, who were awarded with the Nobel Prize in 1952 for their invention of partition
chromatography" [MAR52].
Gas Chromatography (GC) was then established as a reliable method of analysis of different petroleum
fractions. In the 1950s Size Exclusion Chromatography was extended for its use in synthetic polymers
separation and in resolution of biopolymers. In this method, molecules are classified depending on their
size instead of their molecular weight.
But the most significant achievement in chromatography was the development of High-Performance Liquid
Chromatography (HPLC), where the stationary phase consists in a packed bed of small porous particles
placed in the inside of a narrow column. This entails that a big pressure must be introduced to the system,
in order to obtain a flow of the mobile phase through the bed. In the mid-1970s the use of HPLC exploded
due to the introduction of silica packings. HPLC displays a great selectivity and sensitivity, and it is
universally utilized [SMI05].
Many types of chromatography have been developed. First, a distinction between gas and liquid
chromatography must be considered. Generally gas and liquid chromatography are used for volatile and
involatile substances respectively, although there are some compounds that can be isolated by both
techniques. Apart from that, a classification can be made attending to how the adsorption is produced. A
few common types are Partition Chromatography, Adsorption Chromatography, Ion Exchange
Chromatography, Molecular Exclusion Chromatography and Affinity Chromatography. Those have multiple
applications in analysis of samples, but can also be used as a separation method, being referred as
Preparative Chromatography in last case. Some chromatographic applications are [FIN02], [JPC90], [GIO02]
and [ANY08].

Theory i

_______________________________________________________________________________________
4
2.1.3 Electrochromatography
Electrochromatography is a hybrid operation that appeared in the 1990s. It could be pictured as a
modification of HPLC, where electrical force is used instead of pressure as the driven force that induces the
mobile phase flow. The separation takes place by the combination of both effects electrophoresis and
chromatography; thus, this technique shows the separation and selectivity potential of HPLC and the high
efficiency of CE. A simple representation of capillary electrochromatography (CEC) is shown in figure 2.2.
There it can be observed that in CEC a separation column is employed, as well as in HPLC, and the structure
of CE is used for driving the mobile phase through the capillary separation column.

Fig 2.2 Visual scheme of the hybrid method CEC.


Theory i

_______________________________________________________________________________________
5
(2.1)
2.2 Basis of the Separation
The operation consists in the application of an electric field to a suspension of small silica particles in an
electrolyte. Three different effects must be considered in the analysis of electrochromatography:
electrophoresis, electroosmosis and chromatography.
2.2.1 Electrophoresis Principles
When a charged molecule is subjected to an electrical field, it experiences a force according to the next
relationship:
F

= E


Where
: Charge
E

: Electric field
F

: Force
Therefore, depending on the sign of the charge the force will be parallel or antiparallel to the field.
Equation 2.1 is derived from the definition of electrical field: Electrical field is the region of the space
where an electric force is acting. Its value is the limit to which the force on a test charge q tends when q
tends to zero, being this charge positive [LOP02]:
E

= lim
0
F


In the operation, a field is achieved by imposing an electrical potential difference (for convenience, the
electrical potential difference will be denoted as = ) also called voltage. The voltage between two
points is the work that has to be done against the field for translating a unit positive charge from one to the
other, which leads to the next expressions:
=
2

1
= ] E

Jl

2
1
(2.2)

E =

J

(2.3)
Where
Jl

: Differential displacement
J: Distance between the two points
It must be noticed that equation 2.3 is deduced from 2.2 applying the condition of a constant field
antiparallel to the displacement.
Summarizing, after applying a voltage between two points a force will act on all the charged molecules
placed between those two points. The force will be proportional to the value of the charge and will have
the direction of the line joining the points and the sense obtained from equation 2.1 [LOP02]. Thus, that
compounds will start moving with an initial acceleration (o) that depends on their charge and mass (m):
o =
E

m

Once the movement has started, a frictional force will appear due to the relative movement between the
molecule and the medium according to Stokes Law:
F

= 6npR:
cp
(2.4)
Theory i

_______________________________________________________________________________________
6

Where
p: Dynamic viscosity
R: Particle radius
F

: Frictional force
:
cp
: Relative velocity between the molecule and the medium
This force is always opposing to the movement and it is proportional to the velocity of the molecule, so a
steady state will be established when the two forces are numerically equal.
F

= F

- E

= 6npR:
cp


:
cp
=
E

6npR

(2.5)
Equation 2.5 describes the movement of charges in the solution. The relative migration speed between
molecules is a function of their nature, as long as the electric field and the viscosity remain constant for all
of them. If a voltage is applied, positive charges will move to the cathode (low potential terminal) and
negative to the anode (high potential terminal).
2.2.2 Electroosmotic Flow
Silica particles possess silanol groups on their surface, which will be partially ionized depending on pH
value; the higher the pH is the more groups are ionized. Thus, a resulting negative charge appears on the
surface of the particles. Positive charges will be then attracted by the surface as well as negative will be
repulsed, according to Coulombs Law, leading to the formation of an Electric Double Layer (EDL).
Stern double layer model proposes a charge distribution next to the surface according to the figure 2.3. An
immobile thin band consisting on positive charges, called rigid layer, is stuck on the surface. Next to this
covering it is found the diffuse layer, rich in positive charges and mobile. The thickness of the distribution is
determined by a balance between electrostatic attraction and thermal fluctuations, and a potential
difference will appear within the surface and the medium, the so called zeta potential. If an external
electric field is then applied, the diffuse layer will accelerate due to its nature and will approach to the
cathode. This movement will be transmitted to contiguous fluid layers through viscosity. This phenomenon
is called electroosmosis.

Fig 2.3 Representation of the electric double layer.
Theory i

_______________________________________________________________________________________
7
Electroosmotic flow (EOF) has a big influence in the operation. In first place it must be considered that the
electrical driving force acts in the diffuse layer, right in the interface solid-liquid. So, the momentum will be
transmitted to the bulk of the fluid until there is no difference in the speed of adjacent layers, resulting in a
constant flow all over the suspension. Therefore the resultant migration velocity of each one of the species
is [SAN04]:
:
t,
= :
cp,
+ :
co
(2.6)
Where
:
t,
: Resultant velocity of specie i
:
cp,
: Electrophoresis velocity of specie i
:
co
: Electroosmotic velocity
In electrochromatography operations, electroosmotic speed has a bigger value than electrophoresis speed,
which means that all the molecules flow to the cathode. The movement is faster than electroosmosis
velocity if the charge is positive, slower if it is negative and equal if it is neutral.
The value of this uniform velocity is a function of the nature of the fluid utilized and for an
electrochromatographic separation is given by the formula [JIS02]:

:
co
= -
e
]
E

p

(2.7)
Where
e
]
: Dielectric constant of the fluid
: Zeta potential
Velocity of electroosmotic flow is slightly different if capillary electrophoresis is considered instead of
electrochromatography. In this case ionizable groups are present in the surface of the fused-silica capillary,
so the electric double layer is only induced in this region and the resultant flow is smaller. The expression
for the velocity in this case is determined by the Helmholtz-Smoluchowski formula [SAN04]:
:
co
= -
e
]
E

4np

As it was exposed at the beginning of the section pH has an important influence on the zeta potential, and
so on electroosmotic flow. In figure 2.4 a typical dependence is schematically plotted.

Fig 2.4 Representative variation of EOF mobility with pH
EOF profile is flat as long as all parameters in equation 2.7 remain constant in the whole region. The study
of the distortions produced in the profile due to the presence of heterogeneities is out of the aims of the
Theory i

_______________________________________________________________________________________
8
present work, but it is clear that it will contribute to a band broadening. A deep review about EOF profile
and its effect on band broadening can be found in literature [SAN04].
2.2.3 Chromatography Principles
The unequal physical adsorption presented by distinct molecules on a surface is the basis of
chromatographic separations. This phenomenon consists on the formation of weak bonds based on Van der
Waals forces between the adsorbed specie and the surface.
During the process the sample (added to the mobile phase) is forced across the silica suspension. It is
supposed the sample contains two components to be isolated, A and B, and that A presents a lower affinity
to the adsorption in the stationary phase (silica particles) than B. While the mobile phase flows through the
dispositive, component B will be retained longer by the adsorbent than A, resulting in a slower migration
speed of B. Therefore, if the speed discrepancy and the length of the system are big enough, both species
can be recovered individually at the exit extreme.

Fig 2.5 Principle of adsorption chromatography. Triangles and circles represent B and A species respectively [SMI05]
Each substance is characterized by the relationship among the quantity adsorbed and its concentration in
the solution. The two variables are related directly; when one of them increases the other does it too, but
this growth is not always easy to represent, especially when several components are being absorbed. This
dependence is usually studied at constant temperature, so the relation it is called isotherm. An
introduction to a simple case for single and several components is explained next [SMI05].
Single-component Langmuir Isotherms
The most common isotherm type in chromatography can be represented by a Langmuir equation. This
model has been established theoretically by following the next axioms, which lead to equation 2.8:
Adsorption sites are energetically equivalents.
Each adsorption site can adsorb one single molecule.
A single layer of absorbed solute molecules is formed.
There are no interferences among adsorbed molecules.

q =
Ec
1 + bc

(2.8)

Where
q: Load (quotient of the amount of solute adsorbed and the amount of adsorbent)
E: Henry coefficient
c: Solute concentration
b: Quotient of the Henry coefficient and the maximum value of load
Theory i

_______________________________________________________________________________________
9







Fig 2.6 Langmuir isotherm [SMI05]
It can be observed that with very low concentrations the dependence is practically linear. This advantage is
exploited for the practice of quantitative analysis and the calculation of the Henry coefficient, which it is
just the slope. On the other hand, Langmuir factor b is exactly the inverse of the concentration that would
be needed to reach the saturation capacity if the behavior were linear, or, in other words, the inverse of
the concentration at which the initial slope and the saturation capacity lines cross.
Multi-component Isotherms
When a mixture is introduced into the system, apart from interactions between each substance and the
stationary phase there are interferences among the molecules of different species. Therefore, it is
necessary a model that considers those effects. Unfortunately there are no well-established
thermodynamic techniques achieving this target, but just approaches obtained from the single-component
isotherms of the compounds. The simplest case, multi-component Langmuir isotherm, is introduced here.
Further information can be found in literature [SMI05].

q

=
E

1 + b
,]
c
]
n
]=1

(2.9)
The subscripts i and ] denote the current component and the rest of them respectively. Hence, equation
2.9 is taking into account the displacement of the component i by anyone of the others ] by introducing the
interaction coefficients b
,]
in the denominator. The model is not considering the possibility of a difference
saturation capacity for each component, which would happen if some of the molecules cannot access to all
of the adsorption sites due to steric impediment.

In conclusion, the reason for which separation occurs in electrochromatography operations can be
summarized in the following way: The mixture that it is wanted to be separated is introduced to the
equipment. Due to the electroosmotic flow all substances in the mobile phase head to the cathode,
presenting small speed differences because of electrophoretic effects. The main reason for the distinct
migration speed of the components lies on their unequal adsorption affinity on the stationary phase.




Theory i

_______________________________________________________________________________________
10
2.3 Description of the System
Electrochromatography is usually carried out in a capillary, becoming refrigeration of the medium easily
controllable but limiting the amount of sample to be treated. A new device for this operation is being
developed in our department, in which separation takes place in a one millimeter thin layer.
Characteristics of the Device
The equipment has the following features:
The space between two vertical parallel glass plates is the region where separation occurs. The front and
back plates are 10mm and 4mm thick respectively, and the distance among them is 1mm. Their length is
200mm and their width 90mm. On the other face the front glass is in contact with air while the back
glass is with the cooling liquid.
The cooling region consists on eleven 5.4x1 mm channels placed between two distribution areas,
covering the whole separation area.
Two plastic strips assure the fluid cannot get out of this region through the laterals. Their width is
12.5mm, so the region for the separation measures 65x1x200 mm.
The voltage is applied between the top and bottom extremes, which are the anode and cathode
respectively. Thus, the mixture and the solution are added at the top and the products are recovered
and evaluated at the bottom.
An external structure is necessary for keeping the assemblage.




Fig 2.7 Frontal view of the equipment.
Theory i

_______________________________________________________________________________________
11
2.4 Energy Balance
If a control volume is considered, the first law of thermodynamics establishes the next relationship for
energy:
Accumulotion = Ironscrcncc ocross tc surocc +0cncrotion
As far as energy associated with mass is concerned, three possibilities are found: internal energy, kinetic
energy and potential energy. In our study there are no significant variations in kinetic or potential energy,
so only internal energy will be considered. Apart from that, no thermodynamic work is produced by the
system or against it and chemical reactions are not occurring.
Once these preliminary considerations have been established, the mathematical expressions for the terms
are discussed:
Accumulation
Energy can be stored inside the control volume as internal energy of the mass contained in it. The amount
accumulated per unit of time is:
(CpII)
t

(2.10)

Where
C: Specific heat
p: Density
I: Volume
I: Temperature
t: Time
If the specific heat and the density can be considered constant in a time interval, accumulation of energy in
the system will suppose a temperature variation proportional to that accumulation.
Generation
As it will be described in section 3.1, heat generation is spatially heterogeneous. The reason for that
phenomenon is not clear. A technical solution based on experimental observations and the comparison
between simulated and experimental data is proposed in section 3.2.6. What it is certainly sure is that due
to the application of a voltage electrical energy will be degraded into heat as a consequence of Joule Effect.
The heat appeared per unit of time is:

]
= I (2.11)

]
= oIE
2
e
(2.12)
Where
I: Current intensity
o: Electrical conductivity
e: Porosity
Equation 2.12 can be obtained from 2.11 assuming the electrical resistance obeys the general formula for
cuboid materials:
R
c
=
J
oA

Theory i

_______________________________________________________________________________________
12
Where
R
c
: Electrical resistance
A: Cross-sectional area
It must be noticed that in equation 2.11 the voltage is referred to the potential difference between two
extremes of the control volume. On the other hand, generation term will be represented with 0 in the
energy balance equation at the end of the section, since its nature is not clear yet.
Transference across the surface
Heat can be transmitted by three mechanisms:
Conduction: Through direct contact of two pieces of matter. It is related with atomic vibrations and can
be described by the following expression:
q = -kA7I (2.13)
Where
q : Heat transported per unit of time
k: Thermal conductivity
7I: Temperature gradient
Convection: Mass transference implies its energy associated is transferring too. It is a macroscopic
effect, and the mass movement can be natural or forced. Two cases can be distinguished; when there is
a mass flow through the control volume and when the control volume is in contact with a fluid. The
expressions for the first and second cases are:
q = m CI (2.14)
q = -AI (2.15)
Where
m : Mass flow
I: Temperature difference between the control volume surface and the bulk of the fluid
: Convection coefficient
Equation 2.15 must be used because, when there is a heat flow through a fluid-solid interface, the
freedom for moving that molecules of the fluid have can suppose a significant effect on the heat
transference, since energy can be quickly transported from the interface to the bulk of the fluid after its
absorption by a molecule and the translation of that one.
The appearance of equations 2.13, 2.14 and 2.15 in the energy balance is determined by the significance
of their contribution. So, in the general equation at the end of the section, transference term will be
represented as Ir.
Radiation: An object emits and absorbs electromagnetic radiations. The balance between emanation
and absorption determines if gives or receives energy. This kind of transference is not considered in our
study.
So, inside the system the main principle for heat transportation is conduction, while the heat exchange
among the system and both the refrigeration liquid and the external air are governed by convection.
Convection has been also studied as a possibility in the separation region, due to the flow of the mobile
phase and to the existence of a solid-liquid interface, but its contribution has revealed negligible, as it is
exposed in section 3.2.8.

Theory i

_______________________________________________________________________________________
13
In conclusion, energy balance could be represented like this:
oI
ot
=
0 + Ir
CpI


(2.16)
Equation 2.16 does not appear to be complex, but this is so because the difficulties are hided. First, it must
be clear that it is valid just for an infinitesimal control volume; a macroscopic direct use of that formula can
only be made in very simple situations, when the object can be treated with a single control volume. Most
of times this is not possible, resulting in a different expression for the energy balance at every point. In this
case, variables such as properties of the material, as well as generation and transference terms are spatially
dependent. Also it has to be taken into account that 2.16 is a partial differential equation (PDE), where
temperature is a function of time and position and both partial derivatives are contained in the formula.
Therefore, the result of the energy balance is actually a complicated PDE, where parameters and terms are
determined by the position in which it is evaluated. The numerical method utilized for solving it is
presented in next section.



Theory i

_______________________________________________________________________________________
14
2.5 Mathematics: Method of Lines
The energy balance equation of the electrochromatographic device researched in our department contains
spatial as well as temporal partial derivatives. Due to the presence of several materials with distinct
thermal properties it is not possible to find a solution analytically, so numerical methods must be
employed. In the present section the basis of those are presented.
At the end of last section, the resulting equation is described as a partial differential equation, where
parameters and terms are determined by the position in which it is evaluated. Thus, energy balance
expression may show different structure at two distinct points.
In Method of Lines (MOL) a PDE is transformed in first place into a system of ordinary differential equations
(ODE) with time as independent variable by splitting the system in many regions, so in anyone of those
applies a single ODE. After that the ODE system can be solved by using any of the numerical methods well-
established [PUI06].
For the first step, the mathematical tool for converting a PDE in a system of ODE is spatial discretization.
2.5.1 Spatial discretization
Discretization consists in transformation of a continuous variable into discrete. Thus, a mathematical
expression containing that variable can be evaluated in each one of those discrete values instead of in all
possible points. An illustrative case for two-dimensional function discretizations is explained bellow.
Example: Graphical representation of various discretizations of the function:
(x, y) = 1 -(x
2
+y
2
) -1 x 1; -1 y 1
In figures 2.8-a, 2.8-b and 2.8-c the function is represented in a chart if both dimensions are discretized into
a vector of 6, 21 and 100 points respectively. In the first case, when the discretization vector has only 6
values, it can be observed that just an approximation to the function is obtained. It gives an idea of how the
function behaves qualitatively, but quantitatively is not accurate enough. Figure 2.8-b shows appropriate
results for its implementation, since in the surface all different pieces are adjusted smoothly. In the third
case, figure 2.8-c, the figure could be considered equal to the function without being discretized but,
nevertheless, has an important inconvenient: it is needed a large amount of operations for its calculation.

Fig 2.8-a Discretization in 6 points

Fig 2.8-b Discretization in 21 points

i i

_______________________________________________________________________________________
15
* y and z are used because in the separator temperature is a function of these coordinates

Fig 2.8-c Discretization in 100 points
From that example it must be obtained an important conclusion: The more points are utilized for
discretization the more accurate the model is, but the more operations for its calculation are needed.
In discretized systems spatially partial derivatives at a concrete point (y
h
, z

) with respect to y and z* can


be approximated in a very simple way. For our energy balance equation the transformation is:
Left derivative respect to y: oI
oy
-
=
I(y
h
, z

) I(y
h-1
, z

)
y
h
y
h-1

(2.17)

Right derivative respect to y: oI
oy
+
=
I(y
h+1
, z

) I(y
h
, z

)
y
h+1
y
h

(2.18)

Left derivative respect to z:


oI
oz
-
=
I(y
h
, z

) I(y
h
, z
-1
)
z

z
-1


(2.19)

Right derivative respect to z: oI
oz
+
=
I(y
h
, z
+1
) I(y
h
, z

)
z
+1
z


(2.20)

After establishing the discretization vectors for both coordinates y and z equations 2.17-2.20 are used for
converting the PDE energy balance equation into a system of ODE. If vectors have n

and n
z
points, the
system will be composed of n

n
z
equations.
It is noteworthy that right and left derivatives have different values, unless second order derivative is zero.
For understanding why this happens, in first place it must be noticed that right derivative in one point and
left derivative in next point are equals. If right and left derivatives at a single point were identical, there
would be no variation of the derivative in the whole region, and this just can be possible if the second order
derivative is zero (the reciprocal is not always true).
In figures 2.8 a graphical observation about spatially partial derivative can be made. At every vertex four
lines are crossing, where each one of them represents one of the four derivatives (right and left respect to x
Theory i

_______________________________________________________________________________________
16
and y). In figure 2.8-a lines change sharply direction, but in 2.8-b and 2.8-c they do it smoothly. The target
of discretization in the MOL is to convert spatial partial derivatives into algebraic expressions by equations
2.17-2.20, therefore in that case discretization in 6 points is not recommendable, but it is in 21 or 100
points.
Second or higher order derivatives are not present in the system studied in this work, but for didactical
reasons the expression for coordinate y is exposed:
o
2
I
oy
2
=
I(y
h+1
, z

) 2I(y
h
, z

) + I(y
h-1
, z

)
(y
h
y
h-1
)(y
h+1
y
h
)

Last relationship can be obtained applying right derivative to equation 2.17 or left derivative to equation
2.18
2.5.2 Cash-Karp Method
Once the PDE has been transformed into a system of ODE with known initial values the problem can be
resolved by any of the well-established ODE solvers. In this study a member of the explicit Runge-Kutta
family is used: Cash-Karp method [CAS90].
In general, an explicit Runge-Kutta procedure follows next iteration:
ODE:
Equation to solve: JI(t)
Jt
= (I, t)
(2.21)

Initial value:
t = u I = I
0

(2.22)

Where I is a two-dimensional matrix in which the value at each point is the temperature of the associated
point of the system. Initial temperature I
0
is known.
Iteration:
I(t + ) I(t) + b
n
k
n
s
n=1

Where
k
n
= _I(t) + o
n,m
k
m
n-1
m=1
, t + c
n
_ n = 1,2, . , s
Coefficients o
n,m
, c
n
and b
n
as well as the number of stages s are specified by the particular method
utilized. The order of the method is r and it is determined by the number of stages and the coefficients. The
error of the estimation per step is on the order of
+1
.
I(t +) can be easily evaluated if the value I(t) is known by using 2.23 and 2.24, therefore starting from
the initial value I(u) = I
0
any I(t) can be estimated.
The step size is a very important parameter, since it is straight related with the error per step. The smaller
the step size is, the more accurate the prediction is. If just this relationship is considered it might be
considered to use a really tiny value for . However it is not so simple, because the number of calculations
needed for resolving the ODE is inversely proportional to the width of the step. If just an ODE must be
(2.24)
(2.23)
Theory i

_______________________________________________________________________________________
17
solved it might be assumed a very small step size, but when a system of hundreds or thousands of ODEs is
studied the value of must be optimized, by making it adaptable. Implementation of an adaptive step size
requires estimating the step error.
Cash-Karp method:
This is an embedded Runge-Kutta method. That means that at least two estimations of different order can
be made by using different values for coefficients b
n
. Actually, Cash-Karp method requires six evaluations
(s = 6) of the function and a complete family of embedded formulas from first to fifth order is obtained.
The coefficients calculated by Cash and Karp are [CAS90]:
u u
1
S

1
S
u
S
1u

S
4u

9
4u
u
S
S

S
1u

9
1u

6
S
u
1
11
S4

S
2

7u
27

SS
27

u
7
8

16S1
SS296

17S
S12

S7S
1S824

4427S
11uS92

2SS
4u96
u

S7
S78
u
2Su
621

12S
S94
u
S12
1771
0iuei S

282S
27648
u
18S7S
48S84

1SS2S
SS296

277
14SS6

1
4
0iuei 4

19
S4
u
1u
27

SS
S4
u u 0iuei S

S
2

S
2

u u u u 0iuei 2
1 u u u u u 0iuei 1

Where
u u

c
2
o
2,1
u

c
3
o
3,1
o
3,2
u

c
4
o
4,1
o
4,2
o
4,3
u

c
5
o
5,1
o
5,2
o
5,3
o
5,4
u

c
6
o
6,1
o
6,2
o
6,3
o
6,4
o
6,5
u

b
,1
b
,2
b
,3
b
,4
b
,5
b
r,6
0iuei i

Theory i

_______________________________________________________________________________________
18
By comparing fifth and fourth order formulas, the truncation error of the fourth order calculation can be
estimated:

(
6
n=1
b
6,n
b
5,n
)k
n
Now the error has been approximated, step size can be changed in order to keep error close to a specified
value
0
. Since the error in a fourth order estimation is on the order of
5
, if the step
1
involves an error

1
, the step
0
that would produce the specified value would be:

0

1
_

1
_
0.2

(2.26)
Equation 2.26 can be implemented for optimizing step width. If the error produced in the step is smaller
than the desired, next interval will be calculated with a wider step size and vice versa. This correction is
applied using the fourth order approximation error, so theoretically this is the value that should be
accepted. Local extrapolation is made if the fifth order value is accepted instead of the fourth. In the
current program the fourth order value is taken.
2.5.3 Used Tools
Two main software appliances have been utilized in present work. MATLAB has been employed for writing
the program, while data analysis has been carried out using Visual-Xsel.
MATLAB
According to Mathworks company, MATLAB is a high-level technical computing language and interactive
environment for algorithm development, data visualization, data analysis, and numeric computation. Using
the MATLAB product, technical computing problems can be solved faster than with traditional
programming languages, such as C, C++, and Fortran.
Since MATLAB is a computing language specially designed for numeric computation, it is the perfect
software for simulating the thermal behavior of the electrochromatographycal device. Besides it shows an
excellent ability for matrix operations, feature that is taken into advantage by the present program.
Visual-Xsel
Visual-Xsel is a complete tool for statistical treatment of data. In the present work, several times it has been
necessary to establish the relationship between a concrete variable and different factors. That means to
study if there is dependence between the variable and each one of the factors and its interactions,
obtaining a mathematical model of the relationship, as well as to evaluate the accuracy and stability of that
model. With this software the statistical coefficients are easily calculated, so the interpretation of those can
be realized.





(2.25)
i i

_______________________________________________________________________________________
19
* y and z are used because in the separator temperature is a function of these coordinates
3 Development of the Program
The structure of the simulation program is explained in the present section. No special attention is paid
now to the values of the parameters or the results of concrete simulations, but to the Cash-Karp method
implementation and its application to the energy balance of the system.
The unequal heating observed is presented as an introduction and a technical solution is proposed after
discussing the implementation of the numerical method. The simulation program is pretended to be as
close to reality as possible, but some factors are not considered for feasibility reasons, which are stated in
section 3.2.8. The visual appearance developed for the simulating program is introduced too.
The order in which the subsections appear is partially related with the chronological development of the
present work for a better understanding of the steps followed.

3.1 Thermal Behavior Observed
Since a voltage is applied and a current is established in the system, there will be a degradation of electrical
energy into heat, so the temperature in steady state at the medium depends mainly on this effect and on
the heat exchange with the cooling liquid. On the other hand, it has also been observed that, depending on
the conditions of the experiment, there is a region at the bottom suffering an extra heat generation. Now
some infrared pictures are presented in figure 3.1 for introducing the experimentally observed thermal
behavior. A discussion about the nature of the unequal heating of the bed is exposed in section 3.2.6.
ddf


Fig 3.1 Some infrared pictures of the system while operating.
Development of the program i
_______________________________________________________________________________________
20
3.2 Resolution of the Energy Balance
This is the most important section as far as the design of the program is concerned. Here the PDE 2.16 is
applied to our device and solved. The different problems that had to be dealt for building an adequate
solver will be presented, as well as some code strategies for improving the velocity of the calculation.
3.2.1 Steady State with Uniform Heating
The first fixed target was to simulate the system supposing one-dimensional heat transference and equal
heat generation in the whole separation region due to Joule Effect. With this simplification, the energy
balance in the bulk of the fluid in steady state can be easily represented, according to equation 2.16:
JI
Jt
=

]
+ A|u
cooI
(I
cooI
- I) + u
u
(I
u
-I)]
C

I

= u

Where the sub index i denotes each substance in the region and
A: Transference area
u
cooI
: Heat transfer coefficient in the back region
u
u
: Heat transfer coefficient in the front region
I
cooI
: Temperature of the cooling liquid
I
u
: Air temperature
I: Temperature in the separation region
Heat transfer coefficient is just a mathematical simplification for avoiding the use of some terms in the
transference calculation and the temperature evaluation at intermediate points. As it was exposed in
section 2.4 conduction and convection are common mechanisms in heat exchange. In both cases
transference per unit of area can be expressed as the quotient of the driving force and the resistance to the
change, and if the exchange occurs between parallel layers and the temperature variation is constant:
q
A

= -
7I
1
k
,
= -
I
c
k
,

(2.13)
q
A

= -
I
1
b
,

(2.15)
Where
I: Temperature increase among the two surfaces studied
c: Width of the layer in which conduction takes place
If heat transference takes place in the structure represented in figure 3.2, where temperature is vertically
homogeneous:












Fig 3.2 Structure used for illustrating the calculation of the global heat transfer coefficient
(3.1)
Development of the program i
i
_______________________________________________________________________________________
21
In steady state heat transference per unit of area is the same in each region, resulting:
q
A
=
I
2
- I
1
c
12
k
12
,
;
q
A
=
I
3
I
2
c
23
k
23
,
;
q
A
=
I
4
I
3
1

34
,
;
I
2
= I
1
+
qc
12

Ak
12
; I
3
= I
1
+
q
A
_
c
12
k
12
+
c
23
k
23
] ; I
4
= I
1
+
q
A
_
c
12
k
12
+
c
23
k
23
+
1

34
] ;
q
A
=
I
4
I
1
[
c
12
k
12
+
c
23
k
23
+
1

34

=
I
4
I
1
1
u
14
,

Therefore, heat transfer coefficient is the inverse of the global resistance for the heat transference
between two points and can be calculated as the sum of all resistances:

1
u
= R

=
c

+
1

]
]

(3.2)
After that explanation about the concept of heat transfer coefficient, the attention is paid back to equation
3.1. If the heating were uniform this simple formula could be used for predicting the temperature and there
would be no need for building the present simulation, being the appropriate estimation of the parameters
the only problem. Equation 3.1 could be expressed with a sentence: The temperature in the bulk of the
fluid is such that the heat transferred from this region to the exterior is equal to the one produced by the
degradation of electrical energy.
It is noteworthy that during deduction of equation 3.2 the condition of constant heat transference per unit
of area across all different sections is needed, so the heat transfer coefficient cannot be used if this is not
the case. That means that evolution from an initial condition to steady state is not able to be studied by the
ODE:
JI
Jt
=

]
+A|u
cooI
(I
cooI
I) +u
u
(I
u
I)]
C

I


Since heat transference varies continuously with both time and position. The study of temperature
evolution over time is quite more complex than just a single ODE. In fact, it is needed to solve the PDE 2.16
in the whole region studied by applying the Method of Lines. In next sections this problem is treated.
3.2.2 Two-Dimensional Temperature Distribution. System of Blocks
For starting, a mental reasoning is proposed.
Consider the separation device developed in our department, described in section 2.3, with the same initial
temperature (for example, ambient temperature) in all points. At a concrete moment, it starts to generate
heat in the separation region and the cooling liquid starts to flow. It is obvious that this will produce
immediately thermal effects in those local regions; the mobile and stationary phase will experience a
temperature increase while the part of the glass closest to the cooling zone will get colder. In the precise
instant in which temperature heterogeneities are patent in the dispositive an energy flow will be
established from hot to cold points spontaneously according to the second law of thermodynamics. This
flow will obey the expressions postulated in section 2.4, equations 2.13 and 2.15, depending on the nature
of the materials involved, so the warming and cooling of the primarily affected regions will be damped
progressively, absorbing their neighbor layers the remaining impact. Those neighbor layers will experience
the same effect, so it is just a matter of time the whole dispositive suffer temperature variations. The sense
Development of the program i
i
_______________________________________________________________________________________
22
of the energy flow at every point of the device will be antiparallel to the temperature gradient in the
region.
The situation tends to an equilibrium, which will be established when in every control volume that can be
considered the heat being generated is equal in value to the one that is crossing the borders of that
volume. If no heat is produced in the region it does not mean that there is not any heat flow through it, but
the incoming is equal to the outgoing.
This qualitative mental simulation is the same that must be done for solving the energy balance, but
quantitatively. Temperature variations in two dimensions will be considered for the model, since this is
what has been observed experimentally. The reference axes are considered in next way: If the instrument is
observed frontally, x axis goes from the left to the right, z axis from down to up and y axis is perpendicular
to the plane, from the front to the back region. The origin is placed in the position shown in figure 3.3.
Thus, temperature variations are considered in y and z axes.

















Fig 3.3 Representation of the coordinate system adopted.
It must be noticed that the origin of coordinates is not placed at a vertex of the glass, but at the point at
which the vertex of the separation region is seen through the glass. This has been so established because
the dark regions in figure 3.3 are not going to be considered in the simulation. For making that decision is
was considered that the cooling region is actually as wide as the separation zone (clear region), and since
most of transference is due to the temperature difference among those two regions, the energy spread
through the extra glass can be neglected. More information about this point is found in section 3.2.8.
Development of the program i
i
_______________________________________________________________________________________
23
As it was stated in section 2.5, the first step that needs to be done in order to solve the energy equation is a
spatial discretization of the region, and that is the target of the present subsection. No temperature
differences are going to be considered over coordinate x, so the discretization must be done along y and z
axes. Before that, a complete description of the simulated system must be done: The separation region
consisting on a suspension of silica particles in an electrolyte measures 65x1x200 mm and it is in contact
with two glasses. The frontal glass simulated measures 65x10x200 mm and is in contact with air on the
other surface, while the back one measures 65x4x200 mm and separates the suspension from the cooling
liquid.
Temperature differences will be found in both directions. On one hand, the combination of the heat
generated between the two glasses and both interfaces, the back glass-cooling liquid and the front glass-
air, will induce a heat flow parallel to y-axis. On the other hand, the unequal heat generation along z-axis
will produce a heat exchange in that direction. Due to the distribution and dimensions of the regions (the
size of the simulated device is one order of magnitude longer along z-axis than y-axis), it can be easily
deduced that coordinate y is more determinant as far as energy distribution is concerned.
Discretization will produce the splitting of the system in a series of cuboid blocks, which will be considered
homogeneous individually. The resulting structure will be named System of Blocks. Two different patterns
for the system of blocks have been studied: fixed size stencil and variable size stencil.
Before going into detail about the specifications in the two kinds of system of blocks, the concept of block
has to be analyzed:
The simulated system is three-dimensional, and so the blocks are. Their shape is cuboid, and their
dimensions are determined by the discretization mesh.
Their length along x-axis is always the same, 65 mm, and it is one order of magnitude bigger than length
along z-axis and two orders of magnitude bigger than length along y-axis
Since temperature variations along x-axis are not considered, the treatment of the system of blocks can
be simplified to a two-dimensional approach. That means that the mathematical treatment will be
carried out in the plane yz. Therefore, the block will be treated with two-dimensional geometry when
operating although its properties will remain being three-dimensional, as, for example, the volume.
3.2.3 Fixed Size Stencil
It is the most intuitive partition, in which all the blocks are equal in size. The only decision that has to be
taken is how many points are going to be involved in each dimension discretization.
Obviously, the stencil has to be built so it is coherent with the physical borders of the system. That means
that discretization in y-axis must contain obligatory the positions y = u and y = 1S, as well as the points
where the interfaces glass-suspension are: y = 1u and y = 11. That establishes the minimal possible
amount of points for y discretization as 16 (at positions 0, 1, 2, , 10, 11, ,15), resulting in 15 blocks along
that direction. All possible options are derived from that primitive case, so the amount of blocks along the
mentioned line, which will be referred as n

, will always be a multiple of 15.


For z discretization there is not any physical border imposing any condition, but it would be desirable to
reach certain accuracy for the estimation of the hotter region height. A value of 5 mm (that would imply
the division in 40 blocks along z-axis) is acceptable. Several values for the number of blocks in that
direction, n
z
, can be tested but an amount smaller than 20 is not recommended.
The total number of blocks in which the system is split is n

n
z
. That value represents also the number of
ODEs in which the initial PDE has been converted. Although hundreds or thousands of ODEs represent the
energy balance, a pattern allows their classification into 27 regions. Those are exposed in table 3.1.
Development of the program i
i
_______________________________________________________________________________________
24
Table 3.1-a Energy Balance ODEs with Fixed Size Stencil and k = 1
F
r
o
n
t

G
l
a
s
s

]
=
1

JI
Jt
=
A

_
u
(I
u
I
],
+k

(I
]+1,
I
],
)
y
+ A
z
k

(I
],+1
I
],
)
z
C



]
>
1

]
<
2
n


JI
Jt
=
A

_
(I
]+1,
+ I
]-1,
2I
],
)
y
+ A
z
k

(I
],+1
I
],
)
z
C


]
=
2
n


JI
Jt
=
A

(I
]+1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k

(I
]-1,
I
],
)
y
+ A
z
k

(I
],+1
I
],
)
z
C


S
u
s
p
e
n
s
i
o
n

]
=
2
n

+
1

JI
Jt
=
(], k) + A

(I
]-1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k
m
(I
]+1,
I
],
)
y
+ A
z
k
m
(I
],+1
I
],
)
z
C
m
p
m
I


]
>
2
n

+
1

]
<
1
1
n

1
S


JI
Jt
=
(], k) + A

k
m
_
(I
]+1,
+ I
]-1,
2I
],
)
y
+ A
z
k
m
(I
],+1
I
],
)
z
C
m
p
m
I


]
=
1
1
n

1
S


JI
Jt
=
(], k) + A

(I
]+1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k
m
(I
]-1,
I
],
)
y
+ A
z
k
m
(I
],+1
I
],
)
z
C
m
p
m
I


B
a
c
k

G
l
a
s
s

]
=
1
1
n

1
S

+
1

JI
Jt
=
A

(I
]-1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k

(I
]+1,
I
],
)
y
+ A
z
k

(I
],+1
I
],
)
z
C


]
>
1
1
n

1
S

+
1

]
<
n


JI
Jt
=
A

_
(I
]+1,
+ I
]-1,
2I
],
)
y
+ A
z
k

(I
],+1
I
],
)
z
C


]
=
n


JI
Jt
=
A

_
cooI
(I
cooI
I
],
+ k

(I
]-1,
I
],
)
y
+ A
z
k

(I
],+1
I
],
)
z
C


Development of the program i
i
_______________________________________________________________________________________
25
Table 3.1-b Energy Balance ODEs with Fixed Size Stencil and 1 < k < n
z

F
r
o
n
t

G
l
a
s
s

]
=
1

JI
Jt
=
A

_
u
(I
u
I
],
+ k

(I
]+1,
I
],
)
y
+ A
z
k

(I
],+1
+ I
],-1
2I
],
)
z
C



]
>
1

]
<
2
n


JI
Jt
=
A

_
(I
]+1,
+I
]-1,
2I
],
)
y
+ A
z
k

(I
],+1
+I
],-1
2I
],
)
z
C


]
=
2
n


JI
Jt
=
A


(I
]+1,
I
],
)
y _
1
2k

+
1
2k
m
]
+k

(I
]-1,
I
],
)
y
+ A
z
k

(I
],+1
+ I
],-1
2I
],
)
z
C


S
u
s
p
e
n
s
i
o
n

]
=
2
n

+
1

JI
Jt
=
(], k) + A


(I
]-1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k
m
(I
]+1,
I
],
)
y
+ A
z
k
m
(I
],+1
+ I
],-1
2I
],
)
z
C
m
p
m
I


]
>
2
n

+
1

]
<
1
1
n

1
S


JI
Jt
=
(], k) + A

k
m
_
(I
]+1,
+I
]-1,
2I
],
)
y
+ A
z
k
m
(I
],+1
+I
],-1
2I
],
)
z
C
m
p
m
I


]
=
1
1
n

1
S


JI
Jt
=
(], k) + A


(I
]+1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k
m
(I
]-1,
I
],
)
y
+ A
z
k
m
(I
],+1
+ I
],-1
2I
],
)
z
C
m
p
m
I


B
a
c
k

G
l
a
s
s

]
=
1
1
n

1
S

+
1

JI
Jt
=
A


(I
]-1,
I
],
)
y _
1
2k

+
1
2k
m
]
+k

(I
]+1,
I
],
)
y
+ A
z
k

(I
],+1
+ I
],-1
2I
],
)
z
C


]
>
1
1
n

1
S

+
1

]
<
n


JI
Jt
=
A

_
(I
]+1,
+I
]-1,
2I
],
)
y
+ A
z
k

(I
],+1
+I
],-1
2I
],
)
z
C


]
=
n


JI
Jt
=
A

_
cooI
(I
cooI
I
],
+ k

(I
]-1,
I
],
)
y
+ A
z
k

(I
],+1
+ I
],-1
2I
],
)
z
C


Development of the program i
i
_______________________________________________________________________________________
26
Table 3.1-c Energy Balance ODEs with Fixed Size Stencil and k = n
z

F
r
o
n
t

G
l
a
s
s

]
=
1

JI
Jt
=
A

_
u
(I
u
I
],
+k

(I
]+1,
I
],
)
y
+ A
z
k

(I
],-1
I
],
)
z
C



]
>
1

]
<
2
n


JI
Jt
=
A

_
(I
]+1,
+ I
]-1,
2I
],
)
y
+ A
z
k

(I
],-1
I
],
)
z
C


]
=
2
n


JI
Jt
=
A

(I
]+1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k

(I
]-1,
I
],
)
y
+ A
z
k

(I
],-1
I
],
)
z
C


S
u
s
p
e
n
s
i
o
n

]
=
2
n

+
1

JI
Jt
=
(], k) + A

(I
]-1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k
m
(I
]+1,
I
],
)
y
+ A
z
k
m
(I
],-1
I
],
)
z
C
m
p
m
I


]
>
2
n

+
1

]
<
1
1
n

1
S


JI
Jt
=
(], k) + A

k
m
_
(I
]+1,
+ I
]-1,
2I
],
)
y
+ A
z
k
m
(I
],-1
I
],
)
z
C
m
p
m
I


]
=
1
1
n

1
S


JI
Jt
=
(], k) + A

(I
]+1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k
m
(I
]-1,
I
],
)
y
+ A
z
k
m
(I
],-1
I
],
)
z
C
m
p
m
I


B
a
c
k

G
l
a
s
s

]
=
1
1
n

1
S

+
1

JI
Jt
=
A

(I
]-1,
I
],
)
y _
1
2k

+
1
2k
m
]
+ k

(I
]+1,
I
],
)
y
+ A
z
k

(I
],-1
I
],
)
z
C


]
>
1
1
n

1
S

+
1

]
<
n


JI
Jt
=
A

_
(I
]+1,
+ I
]-1,
2I
],
)
y
+ A
z
k

(I
],-1
I
],
)
z
C


]
=
n


JI
Jt
=
A

_
cooI
(I
cooI
I
],
+ k

(I
]-1,
I
],
)
y
+ A
z
k

(I
],-1
I
],
)
z
C


Where
Development of the program i
i
_______________________________________________________________________________________
27
A

: Exchange area through direction y


A
z
: Exchange area through direction z
I
],
: Temperature in the block (], k)
(], k): Heat generated in the block
y: Length of the block in direction y
z: Length of the block in direction z
b
u
: Air convection coefficient
I
u
: Air temperature
b
cooI
: Cooling liquid convection coefficient
I
cooI
: Cooling liquid temperature
k

: Glass thermal conductivity


C

: Glass specific heat


p

: Glass density
I

: Block volume
k
m
: Silica suspension equivalent thermal conductivity
C
m
: Silica suspension equivalent specific heat
p
m
: Silica suspension equivalent density
Before going into further details about the ODEs, a notation clarification is considered necessary. The
energy balance equation must be evaluated at a concrete volume, not at a point. Thus, if the discretization
establishes the division:
y = (y
0
, y
1
, y
2
, , y
n
); z = (z
0
, z
1
, z
2
, , z
n
)
The function is not evaluated at every possible point (y

, z
]
, but in the block determined by the four
neighbor points, (y

, y
+1
, z
]
, z
]+1
. However, according to equations 2.20-2.23, calculation of spatial
derivatives has to be done considering points instead of volumes. So, the central point of each block will be
used for derivatives evaluation. That procedure is elucidated in figure 3.4.

Fig 3.4 Scheme of the discretization of the system with n

= Su and n
z
= 2u. The black stencil indicates the discretization points
as well as delimits the blocks position, while the red mesh indicates the used points for spatial derivatives calculation, which are in
the center of the blocks.
Obviously, in each coordinate discretization produces a number of points that will always be one unity
bigger than the number of blocks. Points y
1
, y
2
, z
1
and z
2
determine the block in position (1,1), y
2
, y
3
, z
1

and z
2
determine the (2,1) block and so on. Thus, the block in position (], k) is the one determined by the
vertexes y
]
, y
]+1
, z

and z
+1
.
Development of the program i
i
_______________________________________________________________________________________
28
Table 3.1 contains the ODE that must be applied in each block, ordered depending on its position (], k).
Apart from the physical properties of materials, variations in ODEs expressions are due to the heat
generation as well as to the different mechanisms of energy transference. When the exchange is produced
among one of the glasses and the ambient air or the cooling liquid, convection is the governing principle
while when it is produced between adjacent blocks, the mechanism is conduction. Convection has been
studied as a possibility for the glass-silica suspension exchange but it has been revealed negligible, as it is
shown in section 3.2.8.
Now, a comparison of the results obtained if employing three different stencils is done. The simulations
have been carried out using the standard parameter values described at section 4, a voltage of 3 kV and an
air temperature of 20 C. The temperature in steady state (after 650 seconds) is graphically represented in
figures 3.5-a, b and c.
The graphics in those figures are part of the results that the simulation program gives. Each figure shows
two pictures of a three-dimensional surface, where the vertical component indicates the temperature value
at each point in plane yz. The units of the variables agree with the International System of Units. Since the
length of the system is one order of magnitude bigger along z-axis than y-axis, for a better interpretation of
the results the surface is represented using different scales for both axes. A uniformly scaled version can be
observed in figure 3.6. In that case the plane yz is represented in a two-dimensional surface, so the color at
each point is indicating its temperature.

Fig 3.5-a Simulated using n

= Su ; n
z
= 2u; 6uu blocks. Simulation time of 4 seconds approximately.

Fig 3.5-b Simulated using n

= 6u ; n
z
= Su; Suuu blocks. Simulation time of SS seconds approximately.
Development of the program i
_______________________________________________________________________________________
29

Fig 3.5-c Simulated using n

= 12u ; n
z
= 1uu; 12uuu blocks. Simulation time of Suu seconds approximately.

Fig 3.6 Temperature in plane yz with discretization n

= 6u ; n
z
= Su, Suuu blocks. The black lines are denoting the physical
borders of the system.
It can be observed that in present case the three simulations predict similar structures and values. Logically,
the more blocks are employed in discretization the more reliable the simulation is. On the other hand, the
time needed for calculations increases drastically from simulations a to c. Those results have only one
possible interpretation: The number of blocks must be carefully chosen. If just a simple prediction is
needed, n

= Su and n
z
= 2u are the recommended values for discretization and the silica suspension
temperature is quickly estimated with enough accuracy.
When a deeper result is wanted the number of blocks has to be increased. That would be the case if, for
example, how temperature changes between the hotter and colder regions wants to be studied or an
accurate graphical representation has to be done. That quality improvement of the results is achieved by a
severe expansion of the calculation time, which mainly is caused by two effects:
The increase in the number of ODEs that are being simultaneously solved.
A decrease in the step size when applying the Cash-Karp method.
If a single case is wanted to be simulated, to spend 500 seconds for a high quality response might be
afforded, but if a parameters study of 1000 cases is necessary (see section 3.3.2 for information about
parameters studies) the needed time for finishing it is around 45 minutes, 8.5 hours or 140 hours for the
aforementioned a, b and c discretizations respectively.
Development of the program i
i
_______________________________________________________________________________________
30
3.2.4 Variable Size Stencil
Some information can be obtained from the stencils comparison realized in last section, apart from the
comparison itself. That is the distinction between the critic zones of the device, where small blocks are
needed for achieving a high quality simulation, and the calmed zones, where a reasonably change in the
blocks size does not seem to produce significant effects.
Following this line of though, it might be desirable to have a mesh where the block size is variable. Thus a
high accuracy could be reached without wasting too much time calculating small blocks placed at non
influential positions. The regions that can be classified as critic zones are:
The separation region, where the heat is being generated and two interfaces liquid-glass are found in a 1
mm thick layer.
The layers of the glasses nearby to any interface.
The transition from the hotter region to the colder.
The whole hotter region, with temperature differences along z-axis.
The rest of regions are considered calmed zones and can be described as homogeneous regions where
there are no changes among the ODEs of consecutive blocks or no uniform thermal gradients.
The proposed discretization mesh on this work is collected in next table:
Discretization along -axis
n

= S2
y(1) = u; y(2) = u.12S; y(S) = u.2S; y(4) = u.S; y(S) = u.7S; y(6) = 1;
y(7) = 1.S; y(8) = 2; y(9) = 2.7S; y(1u) = S.S; y(11) = 4.2S; y(12) = S;
y(1S) = S.7S; y(14) = 6.S; y(1S) = 7.2S; y(16) = 8; y(17) = 8.S; y(18) = 9;
y(19) = 9.2S; y(2u) = 9.S; y(21) = 9.7S; y(22) = 9.87S; y(2S) = 1u;
y(24) = 1u.u62S; y(2S) = 1u.12S; y(26) = 1u.187S; y(27) = 1u.2S;
y(28) = 1u.S12S; y(29) = 1u.S7S; y(Su) = 1u.4S7S; y(S1) = 1u.S;
y(S2) = 1u.S62S; y(SS) = 1u.62S; y(S4) = 1u.687S; y(SS) = 1u.7S;
y(S6) = 1u.812S; y(S7) = 1u.87S; y(S8) = 1u.9S7S; y(S9) = 11;
y(4u) = 11.12S; y(41) = 11.2S; y(42) = 11.S; y(4S) = 11.7S; y(44) = 12;
y(4S) = 12.S; y(46) = 1S; y(47) = 1S.S; y(48) = 14; y(49) = 14.2S;
y(Su) = 14.S; y(S1) = 14.7S; y(S2) = 14.87S; y(SS) = 1S.
Discretization along -axis
n
z
= 44
z(1) = u; z(2) = u.4; z(S) = u.8; z(4) = 1.6; z(S) = 2.4; z(6) = S.2; z(7) = 4;
z(8) = 6; z(9) = 8; z(1u) = 1u; z(11) = 12; z(12) = 14; z(1S) = 16;
z(14) = 18; z(1S) = 2u; z(16) = 22; z(17) = 24; z(18) = 26; z(19) = 28;
z(2u) = Su; z(21) = S2; z(22) = S4; z(2S) = S6; z(24) = S8; z(2S) = 4u;
z(26) = 44; z(27) = 48; z(28) = S2; z(29) = S6; z(Su) = 6u; z(S1) = 64;
z(S2) = 68; z(SS) = 72; z(S4) = 76; z(SS) = 8u; z(S6) = 92; z(S7) = 1u4;
z(S8) = 116; z(S9) = 128; z(4u) = 14u; z(41) = 1S2; z(42) = 164;
z(4S) = 176; z(44) = 188; z(4S) = 2uu.
Table 3.2 Discretization proposed for the Variable Size Stencil. Values are expressed in millimeters.
It can be observed a symmetrical discretization along y-axis inside each glass, while the size is constant in
the separation region. On the other hand, along z-axis a symmetric structure is not convenient, and the
proposed values are coherent with the temperature variations over that direction.
With that discretization 2288 ODEs are necessary for the description of the device. Obviously, they can be
classified in the same 27 types, although their form will be distinct. In table 3.3 ODEs for any variable size
stencil are exposed. It can be checked that the fixed size stencil equations are actually a special case of
those in variable size stencil.

Development of the program i
i
_______________________________________________________________________________________
31
Table 3.3-a Energy Balance ODEs with Variable Size Stencil and k = 1
F
r
o
n
t

G
l
a
s
s

y
(
]
)
=
u

JI
Jt
=
A

(], k)
u
(I
u
I
],
+k

2(I
]+1,
I
],
)
(y
]
+y
(]+1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+z
(+1)

I
],


y
(
]
)
>
u

y
(
]
+
1
)
<
1
u

JI
Jt
=
A

(], k)k


2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+ z
(+1)

I
],

y
(
]
+
1
)
=
1
u

JI
Jt
=
A

(], k)

(I
]+1,
I
],
)
_
y
]
2k

+
y
(]+1)
2k
m
]
+ k

2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+z
(+1)

I
],

S
u
s
p
e
n
s
i
o
n

y
(
]
)
=
1
u

JI
Jt
=
(], k) + A

(], k)

(I
]-1,
I
],
)
_
y
(]-1)
2k

+
y
]
2k
m
]
+k
m
2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+ A
z
(], k)k
m
2(I
],+1
I
],
)
(z

+ z
(+1)

C
m
p
m
I
],

y
(
]
)
>
1
u

y
(
]
+
1
)
<
1
1

JI
Jt
=
(], k) +A

(], k)k
m

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+A
z
(], k)k
m
2(I
],+1
I
],
)
(z

+z
(+1)

C
m
p
m
I
],

y
(
]
+
1
)
=
1
1

JI
Jt
=
(], k) + A

(], k)

(I
]+1,
I
],
)
_
y
(]+1)
2k

+
y
]
2k
m
]
+k
m
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k
m
2(I
],+1
I
],
)
(z

+ z
(+1)

C
m
p
m
I
],

B
a
c
k

G
l
a
s
s

y
(
]
)
=
1
1

JI
Jt
=
A

(], k)

(I
]-1,
I
],
)
_
y
]
2k

+
y
(]-1)
2k
m
]
+ k

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+z
(+1)

I
],

y
(
]
)
>
1
1

y
(
]
+
1
)
<
1
S

JI
Jt
=
A

(], k)k


2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+ z
(+1)

I
],

y
(
]
+
1
)
=
1
S

JI
Jt
=
A

(], k)
cooI
(I
cooI
I
],
+ k

2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+ z
(+1)

I
],


Development of the program i
i
_______________________________________________________________________________________
32
Table 3.3-b Energy Balance ODEs with Variable Size Stencil and 1 < k < n
z

F
r
o
n
t

G
l
a
s
s

y
(
]
)
=
u

JI
Jt
=
A

(], k)
u
(I
u
I
],
+ k

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+A
z
(], k)k


2(I
],+1
I
],
)
(z

+ z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

I
],


y
(
]
)
>
u

y
(
]
+
1
)
<
1
u

JI
Jt
=
A

(], k)k

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k


2(I
],+1
I
],
)
(z

+z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

I
],

y
(
]
+
1
)
=
1
u

JI
Jt
=
A

(], k)

(I
]+1,
I
],
)
_
y
]
2k

+
y
(]+1)
2k
m
]
+ k

2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+ z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

I
],

S
u
s
p
e
n
s
i
o
n

y
(
]
)
=
1
u

JI
Jt
=
(], k) + A

(], k)

(I
]-1,
I
],
)
_
y
(]-1)
2k

+
y
]
2k
m
]
+k
m
2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+ A
z
(], k)k
m

2(I
],+1
I
],
)
(z

+z
(+1)

+
2(I
],-1
I
],
)
(z

+z
(-1)

C
m
p
m
I
],

y
(
]
)
>
1
u

y
(
]
+
1
)
<
1
1

JI
Jt
=
(], k) + A

(], k)k
m

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k
m

2(I
],+1
I
],
)
(z

+ z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

C
m
p
m
I
],

y
(
]
+
1
)
=
1
1

JI
Jt
=
(], k) + A

(], k)

(I
]+1,
I
],
)
_
y
(]+1)
2k

+
y
]
2k
m
]
+k
m
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k
m

2(I
],+1
I
],
)
(z

+z
(+1)

+
2(I
],-1
I
],
)
(z

+z
(-1)

C
m
p
m
I
],

B
a
c
k

G
l
a
s
s

y
(
]
)
=
1
1

JI
Jt
=
A

(], k)

(I
]-1,
I
],
)
_
y
]
2k

+
y
(]-1)
2k
m
]
+ k

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+ A
z
(], k)k

2(I
],+1
I
],
)
(z

+ z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

I
],

y
(
]
)
>
1
1

y
(
]
+
1
)
<
1
S

JI
Jt
=
A

(], k)k

(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k


2(I
],+1
I
],
)
(z

+z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

I
],

y
(
]
+
1
)
=
1
S

JI
Jt
=
A

(], k)
cooI
(I
cooI
I
],
+ k

2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k


2(I
],+1
I
],
)
(z

+z
(+1)

+
2(I
],-1
I
],
)
(z

+ z
(-1)

I
],


Development of the program i
i
_______________________________________________________________________________________
33
Table 3.3-c Energy Balance ODEs with Variable Size Stencil and k = n
z

F
r
o
n
t

G
l
a
s
s

y
(
]
)
=
u

JI
Jt
=
A

(], k)
u
(I
u
I
],
+k

2(I
]+1,
I
],
)
(y
]
+y
(]+1)

+ A
z
(], k)k

2(I
],-1
I
],
)
(z

+z
(-1)

I
],


y
(
]
)
>
u

y
(
]
+
1
)
<
1
u

JI
Jt
=
A

(], k)k


2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],-1
I
],
)
(z

+ z
(-1)

I
],

y
(
]
+
1
)
=
1
u

JI
Jt
=
A

(], k)

(I
]+1,
I
],
)
_
y
]
2k

+
y
(]+1)
2k
m
]
+ k

2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],-1
I
],
)
(z

+z
(-1)

I
],

S
u
s
p
e
n
s
i
o
n

y
(
]
)
=
1
u

JI
Jt
=
(], k) + A

(], k)

(I
]-1,
I
],
)
_
y
(]-1)
2k

+
y
]
2k
m
]
+k
m
2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+ A
z
(], k)k
m
2(I
],-1
I
],
)
(z

+ z
(-1)

C
m
p
m
I
],

y
(
]
)
>
1
u

y
(
]
+
1
)
<
1
1

JI
Jt
=
(], k) +A

(], k)k
m

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+A
z
(], k)k
m
2(I
],-1
I
],
)
(z

+z
(-1)

C
m
p
m
I
],

y
(
]
+
1
)
=
1
1

JI
Jt
=
(], k) + A

(], k)

(I
]+1,
I
],
)
_
y
(]+1)
2k

+
y
]
2k
m
]
+k
m
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k
m
2(I
],-1
I
],
)
(z

+ z
(-1)

C
m
p
m
I
],

B
a
c
k

G
l
a
s
s

y
(
]
)
=
1
1

JI
Jt
=
A

(], k)

(I
]-1,
I
],
)
_
y
]
2k

+
y
(]-1)
2k
m
]
+ k

2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+ A
z
(], k)k

2(I
],-1
I
],
)
(z

+z
(-1)

I
],

y
(
]
)
>
1
1

y
(
]
+
1
)
<
1
S

JI
Jt
=
A

(], k)k


2(I
]+1,
I
],
)
(y
]
+ y
(]+1)

+
2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],-1
I
],
)
(z

+ z
(-1)

I
],

y
(
]
+
1
)
=
1
S

JI
Jt
=
A

(], k)
cooI
(I
cooI
I
],
+ k

2(I
]-1,
I
],
)
(y
]
+ y
(]-1)

+ A
z
(], k)k

2(I
],-1
I
],
)
(z

+ z
(-1)

I
],


Development of the program i
i
_______________________________________________________________________________________
34
The nomenclature utilized in table 3.3 is the same than in 3.1, with the addition of a spatial dependence in
the variables related with the block size. The response surface when the simulation is carried out using the
same conditions than in the previous section is:


Fig 3.7 Simulated using the proposed Variable Size Stencil. Simulation time of S6u seconds approximately.
Figure 3.7 shows an excellent quality response. For a more appropriate comparison of all the discretization
models presented up to now, in figures 3.8 and 3.9 temperature is plotted along directions y (with k = 1)
and z (in the separation region) respectively. Not the whole range of values is always graphed, but the most
critic regions, where big changes on temperature gradient occur. In that comparison each stencil will be
referred as:
Mesh 1: Variable Size Stencil
Mesh 2: Fixed Size Stencil with n

= 12u , n
z
= 1uu
Mesh 3: Fixed Size Stencil with n

= 6u , n
z
= Su
Mesh 4: Fixed Size Stencil with n

= Su , n
z
= 2u
Discretization along y-axis (the main direction for heat transmission) is more accurate in Mesh 1 than in
Mesh 2, as can be checked in figure 3.8-a. In the first case the line curves so smoothly that discretization of
the variable y is not appreciated. That is so because the blocks length in critic regions is smaller. Figure
3.8-b exhibits the quality decrease when using bigger blocks.

Fig 3.8-a Representation of temperature values along y-axis with k = 1. Mesh 1 is illustrated at the left while Mesh 2 is at the right.
Development of the program i
_______________________________________________________________________________________
35

Fig 3.8-b Representation of temperature values along y-axis with k = 1. Mesh 3 is illustrated at the left while Mesh 4 is at the right.

Fig 3.9-a Representation of temperature values along z-axis with y(]) = 1u (separation region). Mesh 1 is illustrated at the left
while Mesh 2 is at the right.


Fig 3.9-b Representation of temperature values along z-axis with y(]) = 1u (separation region). Mesh 3 is illustrated at the left
while Mesh 4 is at the right.
Development of the program i
i
_______________________________________________________________________________________
36
As far as z-axis discretization is concerned, in figures 3.9 can be observed that both Mesh 1 and Mesh 2
representations display excellent behavior, Mesh 3 is good enough and Mesh 4 gives just an approximation.
In conclusion, the proposed variable size stencil is a very accurate discretization. The achieved results
exceed in quality the best of the fixed size stencils proposed in previous section and needs less time for
completing the calculations.
3.2.5 Cash-Karp Method Implementation
It has already been illustrated how to transform the original balance energy PDE into a system of n

n
z

ODEs. In this section it is shown how that ODEs can be simultaneously solved applying a numerical method
in MATLAB.
In first place, it is necessary to define the problem that has to be solved. As it was exposed in section 2.5.2,
its expression must be coherent with:
Equation to solve: JI(t)
Jt
= (I, t)
(2.21)

Initial value:
t = u I = I
0

(2.22)

Since I is a two-dimensional matrix, equation 2.21 is actually representing an ODEs system. In present case,
that system is collected in table 3.1 or 3.3, depending on the stencil used. It can be noticed that in our case
there is no dependence between the derivative of temperature with respect to time and the time itself, so
2.21 it can be expressed as
JI(t)
Jt
= (I)
During the design of the program in MATLAB, the function (I) has been defined in a separate file, so it
can be called from the main file of the program when it is needed. The function file has been named
Jcri:oti:c.
The set of equations used for step calculation in Cash-Karp method are:
k
1
=
n
(I
n
) (3.3)
k
2
=
n
_I
n
+
1
S
k
1
]
k
3
=
n
_I
n
+
S
4u
k
1
+
9
4u
k
2
]
k
4
=
n
_I
n
+
S
1u
k
1

9
1u
k
2
+
6
S
k
3
]
k
5
=
n
_I
n

11
S4
k
1
+
S
2
k
2

7u
27
k
3
+
SS
27
k
4
]
k
6
=
n
_I
n

16S1
SS296
k
1
+
17S
S12
k
2
+
S7S
1S824
k
3
+
4427S
11uS92
k
4
+
2SS
4u96
k
5
]
t
n+1
= t
n
+
n

I
n+1
= I
n
+
1282S
27648
k
1
+
18S7S
48S84
k
3
+
1SS2S
SS296
k
4
+
277
14SS6
k
5
+
1
4
k
6
4
th
orJcr rcJiction
Development of the program i
i
_______________________________________________________________________________________
37
I
n+1

= I
n
+
S7
S78
k
1
+
2Su
621
k
3
+
12S
S94
k
4
+
S12
1771
k
6
S
th
orJcr rcJiction

n
= I
n+1
I
n+1

n+1
= F
n
_

0
mox (
n
)
_
0.2

Where
n: Step number

0
: Step error toleration.
F: Security factor, usually F = u.9, but in this work it has been taken F = 1.
Therefore, as it can be observed, the error is estimated for each block and the size of the next step is
calculated using the biggest of all of them. With Runge-Kutta methods, if mox (
n
)>
0
the calculated value
for t
n+1
and I
n+1
is not accepted and the step is resized and recalculated.
Only the fourth and fifth order predictions are stated above because those are the employed in present
work. In the original publication by Cash and Karp, [CAS90], apart from the method itself a strategy for
dealing with non-smooth behavior is proposed. There, all predictions, from first to fifth order, are utilized
for increasing velocity calculation in the following way: Low order estimations are able to be accepted if
high order evaluations are refused in a specified step. Thus, the step does not have to be recalculated if
mox (
n
)>
0
, which would imply a calculation time increase. Also it uses a strategy for predict if a step will
be rejected and quit before all the function evaluations required to complete the step have been
computed.
However, in the present work a variation with respect to that strategy, [CAS90], has been introduced; the
step error toleration has been fixed so even if the fourth order prediction induces a bigger error than the
tolerated, it can be accepted. This technique is useful because in the present system of ODEs if
0
is
reduced the step size does not change too much (and so the calculation time). Thus
0
can be fixed to a
value small enough that when mox (
n
)>
0
the step can be accepted. Since the security factor is used for
reducing the amount of rejected steps, this also allows its elimination from the step size calculation
formula.
In general, a good value for
0
is the one that, if it is decreased in one or two orders of magnitude there will
not be a significant improvement in the prediction, but if it is increased in one order of magnitude the
prediction will notably lose quality. For the present program experience has revealed that those requisites
are accomplished with the value
0
= 1u
-4
. Nevertheless, it is possible that temperature differences are in
the order of 1u
-4
or less (when there is a very soft heating), so calculations may become unstable if the
toleration is in the same order as variations. Therefore, it was decided to establish an error toleration
adaptable, of six orders of magnitude smaller than the maximum difference of temperature in the device.
Thus, in usual simulations error toleration is around 1u
-5
.
The validity of that technique is demonstrated now. Four random experiments have been carried out using
in each one of them the values
0
= 1u
-2
,
0
= 1u
-3

0
= 1u
-4
,
0
= 1u
-5
,
0
= 1u
-6
and
0
= 1u
-
. The
results are collected in tables 3.4, 3.5, 3.6 and 3.7. The standard value of parameters described in section
4.1 has been used, while the rest of conditions are:
Random experiment 1:
Voltage applied u = 4uuu V.
Air temperature I
u
= 24 C.
Fixed Size Stencil with n

= 6u and n
z
= Su.
Steady state.
Development of the program i
i
_______________________________________________________________________________________
38
Random experiment 2:
Voltage applied u = Suuu V.
Air temperature I
u
= 19 C.
Fixed Size Stencil with n

= Su and n
z
= 2u.
From t = u to t = 1uu seconds (unsteady state).
Random experiment 3:
Voltage applied u = Suuu V.
Air temperature I
u
= 22 C.
Variable Size Stencil.
From t = u to t = Su seconds (unsteady state).
Random experiment 4:
Voltage applied u = 2uuu V.
Air temperature I
u
= 24 C.
Fixed Size Stencil with n

= 12u and n
z
= 1uu.
From t = u to t = 8u seconds (unsteady state).
Table 3.4 Random experiment 1

0

Calculation
time (s)
Number of
steps
Average step
size (s)
Temperature at the
bottom of the
liquid, I
41,1
(C)
Temperature at the
top of the liquid,
I
41,50
(C)
1u
-2
2u.2 4871 u.14S7 24.69u8 1S.1887
1u
-3
2u.4 487S u.14S6 24.7417 1S.181S
1u
-4
21 487S u.14S6 24.749u 1S.18uS
1u
-5
2u.S 489S u.14S1 24.7S1u 1S.18uS
1u
-6
21.2 49SS u.1418 24.748S 1S.18u8
1u
-
21.7 S191 u.1S48 24.7477 1S.18u8

Table 3.5 Random experiment 2

0

Calculation
time (s)
Number of
steps
Average step
size (s)
Temperature at the
bottom of the
liquid, I
21,1
(C)
Temperature at the
top of the liquid,
I
21,20
(C)
1u
-2
1.14 17S u.S714 17.1u7S 11.7S88
1u
-3
1.21 177 u.S6Su 17.41SS 11.7u62
1u
-4
1.19 18S u.S464 17.4S91 11.7u28
1u
-5
1.22 221 u.4S2S 17.4999 11.6969
1u
-6
1.29 281 u.SSS9 17.Su26 11.6964
1u
-
1.S8 S41 u.29SS 17.4966 11.69S8

Development of the program i
i
_______________________________________________________________________________________
39
Table 3.6 Random experiment 3

0

Calculation
time (s)
Number of
steps
Average step
size (s)
Temperature at the
bottom of the
liquid, I
23,1
(C)
Temperature at the
top of the liquid,
I
23,42
(C)
1u
-2
2S.9 4821 u.u1u4 1S.S6S1 12.28S9
1u
-3
24.1 4819 u.u1u4 16.47S8 12.17S8
1u
-4
2S.9 4821 u.u1u4 16.66S2 12.1S7S
1u
-5
2S.9 4821 u.u1u4 16.48u1 12.17S6
1u
-6
2S.9 482S u.u1u4 16.481u 12.17SS
1u
-
24 4827 u.u1u4 16.4791 12.17S7

Table 3.7 Random experiment 4

0

Calculation
time (s)
Number of
steps
Average step
size (s)
Temperature at the
bottom of the
liquid, I
1,1
(C)
Temperature at the
top of the liquid,
I
1,100
(C)
1u
-2
S2.6 2229 u.uSS9 1S.4S28 11.8779
1u
-3
SS.S 2229 u.uSS9 1S.4274 11.878S
1u
-4
S2.8 22S1 u.uSS9 1S.428u 11.8784
1u
-5
S4.8 22SS u.uSS8 1S.41S7 11.8799
1u
-6
SS.2 224S u.uSS7 1S.416u 11.8797
1u
-
S6.1 2279 u.uSS1 1S.41S9 11.8798

From the previous tables it can be extracted next conclusions:
There is not a significant increase in the required number of steps, and so in the calculation time, if the
error tolerated is deeply decreased. Note: Calculation time depends on the computer performance, so
in some cases increases in the spite of number of steps decreases slightly.
The prediction for steady state is barely affected by error toleration. Only if the value is excessively big
(
0
= 1u
-2
) there is a small influence.
Temperature prediction in non-steady state does not vary significantly when
0
1u
-5
, so this value is
confirmed as the proper one if wrong steps are not wanted to be recalculated.
The only important increase in the number of steps needed has been observed in the simplest stencil
used, although happily that mesh gives such a fast prediction that this effect is meaningless in
calculation time.
Therefore, it has been proved that the variation here introduced improves the proposed strategy by
[CAS90] for its application in present case. It would be difficult to quantify how big that time reduction is
because not both methods are implemented in the program. However it is possible to know how many
steps would be rejected if applying a usual step recalculation criterion: if a step is ruled out because
Development of the program i
i
_______________________________________________________________________________________
40
mox (
n
)>
0
, the step size is halved. A security factor of F = u.9 is taken, reducing the amount of steps
that would be rejected.
Those data appear in table 3.8 for the aforementioned four experiments, using two values for the error
toleration, 1u
-4
and 1u
-5
.
Table 3.8 Quantification of the improvement with respect to usual step recalculation technique

0
Numbei of steps Potentially iejecteu steps Peicentage
Expeiiment 1
1u
-4
48SS 1u6u 21.8%
10
Vm
4955 1056 21.3%
Experiment 2
10
Vl
207 37 17.9%
10
Vm
253 42 16.6%
Experiment 3
10
Vl
4887 1373 28.1%
10
Vm
4889 1373 28.1%
Experiment 4
10
Vl
2211 485 21.9%
10
Vm
2249 472 21.0%

The percentage shown in the above table is almost equal to the extra amount of time that would be
needed if the usual step recalculation were used. The strategy proposed by Cash and Karp would have an
intermediate requirement; it is able to reduce calculations compared with usual step rejection, but it would
always need to realize more operations than if all steps are accepted.
On the other hand, it is worth pointing out that if it is used a too big error toleration, despite the prediction
failure that it implies, the system of ODEs becomes highly unstable. As it can be observed in figure 3.10,
discontinuities and an effect similar to waves resonance appear. That last one is able to convert the ODEs
system in divergent.


Figure 3.10 Random Experiment 4. At the left

10
VI
and at the right

10
V1
.

Development of the program i
i
_______________________________________________________________________________________
41
3.2.6 A technical solution for the unequal heat generation
At the moment in which the program was being built up, there was not a good experimental background
about the thermal behavior of the system.
In first place, it had been observed that a hot region appeared at the bottom of the device, as it has been
described in the beginning of current main section, and that there was a decrease in the electrical current
going through the solution, so a data collection was started: Infrared pictures were taken during the
experiences, as well as the value of the current, the voltage applied, the mass flow and the ambient
temperature were annotated. Thus, those pictures could be used for studying the thermal performance of
the system and its relationship with the experimental conditions.
Also, it was observed later that the characteristics of that hot region changed if a distinct type of silica
particles were used; the more silanol groups the particle presents in its surface, the less unequal heating is
observed. In fact, when using Hyper Sil 30 m no hot region appeared. In present project only one kind of
particles has been studied, 20-40 m normal silica particles.
Nevertheless, most of those pictures were taken before the present work started and so they do not meet
all the requirements that would be desired by the current investigation. Perhaps the most valuable
information to have would be continuous infrared pictures from the starting until steady state.
Anyway, the electrochromatographic device will continue being studied after the publication of the present
work, therefore the program has been designed so when a deeper experimental thermal knowledge is
collected, it will be possible to implement it in the simulation, even if the data have been obtained using a
different kind of silica particles.
Thermoelectric effect
One of the goals of this project is to study the nature of the unequal heat generation. The possibility of the
presence of any thermoelectric effect has been analyzed following the next scheme: On one hand, heat is
homogeneously generated in the whole separation region due to Joule Effect (equation 2.12). On the other,
due to Peltier Effect, heat is generated and absorbed at the interfaces between the electrolyte and the
cathode and anode terminals respectively.
Peltier effect occurs when an electrical current is established through two different electrical conductors A
and B, which are in contact forming two junctions:





Figure 3.11 Simple electrical circuit with two kinds of conductors.
Electrical current is a measurement of how much charge goes through a section in a time interval. Due to
the different concentration of charges in A and B it will be necessary a distinct speed of the charges in each
material for reaching the same value of current intensity. Thus, at the junction there will be a speed
discontinuity.
As it is well-known, temperature is a macroscopic measurement of the average speed at which microscopic
particles move randomly. Therefore, if there is a speed change at the junction, this will involve a heat
generation or absorption, named Peltier heat, depending on the sense of the current. The formula
governing that principle is, when the charges flow from A to B:
Development of the program i
_______________________________________________________________________________________
42
q = (n
A
-n
B
)I (3.4)
Where
n

: Peltier coefficient of the material i.


An initial version of the program was built according to that scheme and it was comprehended that Peltier
effect was not able to explain the observations. If the heat were produced just at the junction it would be
impossible that the width of the hot region were so big. Figure 3.12 shows a comparison between an
infrared picture (5kV, 1.6 mA) and the predicted frontal view of the device.









Figure 3.12 Real and simulated frontal views of the system if heat is generated just at the bottom.
After this example it becomes evident that Peltier effect cannot explain the unequal heat generation if only
this effect is considered. In addition, there also would be absorption of energy at the top junction (that has
not been used for the previous simulation), which has not been observed experimentally, so Peltier heating
was discarded.
Otherwise, it was also consider Thomson effect as a possibility. According to that principle, if an electrical
current flows through a material and there is a temperature gradient in it, there will be a heat absorption
or generation, depending on the nature of the conductor, following the expression:

1
= p
1
[
JI
Jx

(3.5)
Where
p
1
: Thomson coefficient of the material
x: Current direction
[: Current density
Therefore, if Peltier effect produced an initial temperature gradient, maybe Thomson effect could produce
the widening of the hot region. But this possibility was also refused because in experimental infrared
pictures it has been observed two well-defined hot regions, almost homogenous in temperature, and the
transition from one region to the other is the only part where a temperature gradient is present.
Once all thermoelectric effects were discarded, it was decided to adopt a technical solution for carrying out
the simulations.



Development of the Program_ i

_______________________________________________________________________________________
43
Technical solution
It is based on the following steps: First the system is divided in two main regions; the hot and the cold one.
After that, it is induced an artificially and periodically distribution of the heat produced in each region
trying to reach the previously estimated temperature difference among the two zones.
In first place, it was necessary to find an equation able to predict the length of the hot zone and the
temperature variation among the two regions in steady state (referred as I
1
and cltoI respectively). The
infrared pictures that were considered appropriate for that proposal were analyzed, measuring the two
variables that wanted to be adequately predicted.
For quantifying the length of the hot region it was used the computer program ImageJ. Using that software
known-size lines can be drawn over the picture. Thus, if a line is placed over an object with known real
dimensions and another line over the hot region, its length can be obtained by simple proportionality. On
the other hand, the temperature difference among the two regions can be obtained directly from the
infrared image, using the software FLIR QuickReport 1.2 SP1, a complement of the infrared camera
employed. It must be had in account that these variables are not easily measurable, because actually there
are not two exactly delimited regions and the observed temperature is not totally homogeneous in both
regions, so an experimental error is implied. In the data collection it was tried to apply the same
measurement criteria for all of the images.
Once those data had been collected, the computer program Visual Xsel was employed to analyze them
using fourth order multiple regression. The results achieved by this procedure appear bellow. The units of
the variables are centimeters, Celsius, milliamperes and kilovolts for I
1
, cltoI, I and I.
I
1
= -u,2179 +u,8S66S6I +2,4uS89SI 2,1S892I
2
+u,416u72I
3

cltoI = S,S677uS S,S4284I S,S6Su1I +1,96u67II +u,418898I
3
u,u71S7I
4

Table 3.9 Experimental and predicted values of length of the hot region and DeltaT, with the specified conditions of voltage applied
and electrical current. Values have been rounded.
Voltage
(kV)
Current
(mA)
Length
(cm)
DeltaT
(C)
Estimated
Length (cm)
Estimated
DeltaT (C)
Relative Error
Length
Relative Error
DeltaT
1 0.26 0.9 1.0 1.1 2.0 25.0 95.6
2 0.77 1.8 1.5 2.3 1.0 25.3 35.7
3 0.28 3.0 0.8 2.9 1.1 5.2 37.7
4 0.42 4.1 1.5 3.9 1.7 5.9 12.1
3 1.70 2.8 3.2 2.2 4.4 18.6 37.3
5 1.60 4.5 4.5 4.1 5.5 8.4 21.5
5 2.16 3.3 8.0 3.4 9.0 3.5 12.0
5 2.72 2.9 13.0 3.0 12.5 5.1 4.2
5 2.46 2.7 12.0 3.1 10.8 15.1 9.7
2 1.20 2.5 2.1 2.0 1.1 18.8 46.8
3 1.57 2.7 3.0 2.4 4.1 10.3 36.4
3 2.00 2.1 2.9 1.9 5.1 11.1 75.5
3 1.80 2.5 3.3 2.1 4.6 15.6 40.2
3 2.15 1.2 6.0 1.7 5.4 37.1 9.4
3 2.30 1.4 5.5 1.5 5.8 5.4 5.2
3 2.00 1.5 5.5 1.9 5.1 23.5 7.4
3 1.70 2.3 5.8 2.2 4.4 2.5 24.2

(3.6)
(3.7)
Development of the Program_ i

_______________________________________________________________________________________
44
Table 3.9 (cont.)
Voltage
(kV)
Current
(mA)
Length
(cm)
DeltaT
(C)
Estimated
Length
Estimated
DeltaT
Relative Error
Length
Relative Error
DeltaT
3 1.30 2.6 5.0 2.7 3.5 7.3 30.7
3 4.00 4.0 10.0 4.1 9.7 2.4 2.7
4 3.20 2.7 12.0 2.4 13.6 10.6 13.2
1 0.80 1.1 1.6 1.4 1.1 22.0 31.9
1 0.60 1.5 1.4 1.4 1.4 7.1 0.8
4 1.80 2.5 7.4 3.0 7.6 18.7 2.5
4 2.00 2.9 9.0 2.7 8.4 6.2 6.2
4 1.90 2.5 9.0 2.8 8.0 13.4 10.9
4 1.80 2.7 8.7 3.0 7.6 9.9 12.8
3 2.60 1.7 6.8 1.3 6.5 20.8 4.7
4 2.75 2.4 12.0 2.1 11.7 9.2 2.9
Average 13.0 Average 22.5


Table 3.10 Multiple regression results. Response variable: Length

Coefficient Std Deviation p-value Min Max
I 0.856636 0.0736 0 1 5
I 2.403893 0.68 0.00179 0.26 4
I
2
-2.1S892 0.40 0

I
3
0.416072 0.065 0

Constant u.2179

R=0.874 DF=23 RMS=0.335 Q=0.717


Table 3.11 Multiple regression results. Response variable: DeltaT

Coefficient Std Deviation p-value Min Max
v S,S4284 1.47 0.0251 1 5
I S,S6Su1 1.53 0.0292 0.26 4
v I 1,96u67 0.44 0
v
3
u,418898 0.18 0.0266

v
4
u,u71S7 0.025 0.0101

Constant S,S677uS

R=0.935 DF=23 RMS=1.076 Q=0.899


As far as the performance of the model is concerned the following observations can be done. When
predicting the length of the hot region, the model explains the 87% of the variations in the variable
(R` = u.874), which means that it is able to describe the tendency of the values, but there is a 13%
scattering unexplained. The value ` = u.717 indicates certain stability of the model, but the introduction
of new data can produce changes. Checking the p-values, definitely it can be said that there is dependence
between I
1
and the voltage and intensity, since the usual maximum value of
mu
= u.uS was fixed.
Development of the Program_ i

_______________________________________________________________________________________
45
In the case of the temperature difference among the two regions, with the present regression it is managed
to explain the 93.5% of the variations, so the result of that is adequate. Also it is suggested that the model
is stable and it is not expected to change strongly with the introduction of new data (` = u.899). The
response variable and the factors are clearly related, but not as evidently as they are in the previous case.
After presenting that numbers, it may seem incongruous that the average relative error of predictions is
almost double for DeltaT than for Length, but there is an explanation for that. As it can be observed in
figures 3.13 and 3.14, predictions are closer to observations in the case of DeltaT estimation (the width of
the scattering is bigger in the Length case), but there are a few points in the low region with really big
relative errors, producing the previous apparent paradox.

Figure 3.13 Prediction versus observation for length, in centimeters

Figure 3.14 Prediction versus observation for DeltaT, in Celsius degrees
Figures 3.15 and 3.16 are showing a three-dimensional representation of both of the regression models. In
the case of Length the shape of the surface corresponds to a directly proportional relationship with the
voltage and to a complex response to intensity. The representation of the prediction model for DeltaT
displays a smoother behavior. It must be pointed out that in there are zones in the represented region
were no data are available, so this model is not recommended for its used if that is the case.
Development of the Program_ i

_______________________________________________________________________________________
46

Figure 3.15 Length prediction

Figure 3.16 DeltaT prediction
After those correlations have been established, an algorithm can be implemented in the simulation
program where heat generation is unevenly distributed in the hot and cold region adequately in order to
reach the predicted temperature divergence within the two zones.
The algorithm has been design according to the following conditions:
First, the ratio among the temperature difference of both regions and the wanted value is calculated:
Rotio =
I
hot con
-I
coId con

cltoI

Depending on the separation of that value from the unity, the division between the discretized
derivatives of temperature with respect to time in both regions (at the beginning of the step) is
controlled, so the temperature evolution tends to the desired values. If Rotio 1, it is clear that the
heating in the hot region must be increased at the expense of the cold region, and vice versa. Thus, for
example, in the iteration if Rotio u.6 the heat is distributed trying to keep the division of the
temperature increase in each region equal to ten:
Development of the Program_ i

_______________________________________________________________________________________
47
JI
Jt
,
hot con
JI
Jt
,
coId con
=
k
1,hot con
k
1,coId con
= 1u
However, the iteration must be design very carefully, because derivative of temperature with respect to
time can be negative. That means that if, for example, temperature is decreasing in both regions and
Rotio < u.6, the desired value for k
1,hot
k
1,coId
would be now 0.1, because that means that
temperature is decreasing ten times faster in cold that in hot region. The iteration had to be
programmed considering that, so depending on the sign of the temperature increased at both regions,
other right desired value for k
1,hot
k
1,coId
has to be established.
Of course, the total heat produced in the system cannot change with this iteration, so a variation in the
heat produced in one of the regions implies the same variation in the other one, but with different
sense.
This iteration has been set for being realized every two seconds, not at every step. Thus, two different
stencils with distinct step size can be compared, as long as the length of the hot region is the same for
both of them (the length can be different because, due to discretization, the prediction is rounded to
the upper discretize point).
In conclusion, the technical solution utilized denatures the dynamic evolution in the program, but it is able
to fit reality in steady state.
3.2.7 Other Characteristics of the Simulation Program
Up to now, it has been detailed how the Method of Lines for solving the energy balance PDE has been
implemented in the program. Besides, there are other important features of the program: data input and
estimation, results presentation or simulation finishing. Data input and estimation is discussed at main
section 4, Simulation Setting.
The program has been designed so it can be chosen how the results are presented. As far as graphical
representation is concerned, it is possible to display a surface denoting the temperature profile over y and
z axes, to represent how an infrared picture of the front of the system would look, a two-dimensional
temperature profile or the temperature evolution along time for one or more blocks. In that sense, it is
worth pointing out that not all steps are saved for the dynamic region representation, because if the
discretization is very exhaustive the memory needed for saving all steps can exceed the computer
performance. In fact, when the solver was being built all steps data were saved, so the computer where the
program was being constructed was not able to finish the simulation because of a lack of RAM memory.
That used to happen after more than an hour of simulation (the early version of the solver was much
slower). This characteristic of the simulation was changed and, despites solving the memory program, it
was observed a 90% decrease in calculation time. That was an important result by that moment, because it
meant not only calculations had to be reduced for speed, but also data saving should be optimized. In the
final version of the program there is not a significance waste of time in this process.
Otherwise, two options can be chosen for determining the end of the simulation: after reaching a concrete
value of the variable time or, directly, when steady state has been established.
3.2.8 Factors not considered
As it has already been introduced, the geometry of the simulated system does not match exactly with the
real device developed in our department. There are two important reasons supporting the use of the
chosen model:
Development of the Program_ i

_______________________________________________________________________________________
48
a) Adding the possibility of material heterogeneities along x-axis would multiply the number of ODEs
obteined after the discretization of the model and so, the required calculation time.
b) The main heat flow occurs between the suspension and the cooling liquid. This region is perfectly
covered by current model.
Apart from that, other simplifications have also been introduced in the energy balance equation because
the contribution of the corresponding phenomenon are negligible. The not considered factors are stated
below:
As far as geometry is concerned, the size of the simulated region is 65x15x200 mm. Thus, there are
12.5 mm of glass to the right and to the left that are out of the simulation. Also the plastic strips used
for assuring there are no electrolyte leaks are not considered. Therefore, heat exchange between the
simulated and the no-simulated regions is not considered.
Heat flow associated with the mass flow is not considered. The heat exchanged by this mechanism
(equation 2.14) should appear in the ODE corresponding to every block in the separation region. This
term has been omitted for two reasons: the mass flow should also be estimated, which would imply
further efforts, and the amount of heat exchanged by that flow would represent only a 1% of the heat
generated by Joule effect for the highest cases, so it can be neglected.
Natural convection of the electrolyte in the separation region has not been taken into account. Due to
temperature differences, the establishment of internal flows would be possible, leading to a heat flow
as a consequence. The natural convection correlations stated in section 4.2 were used for a simple
quantification of the influence of this effect, and the heat exchanged estimated using those equations
was only a 20% of the heat exchanged by thermal conductivity. Since heat exchange including natural
convection cannot be smaller than excluding it, it was interpreted that natural convection was not
significant in the separation region.
Material properties are not considered temperature dependent. The temperature interval hardly ever is
more than 10 C wide, so properties can be considered to remain constant in the interval.

Development of the Program_ i

_______________________________________________________________________________________
49
3.3 User Interface
Interaction between the user and the program can be produced easily since a visual appearance for the
program has been developed. The user interface is based on a simple scheme: the user specifies the
conditions in which the simulation must be carried out and the computer displays the thermal state of the
required case.
The computer program developed in this work is able to simulate the thermal evolution of the
electrochromatographic device at the desired experimental conditions. Also it is possible to vary the value
of the physical properties of the materials involved. The influences of using a different glass with better
thermal conductivity or distinct electrolytes are just two of all the possibilities that can be studied. The user
can chose between two options to perform: a single simulation or a set of simulations varying one or more
parameters (Parameters Study).
3.3.1 Single Simulation
The needed data for the calculation can be organized in two categories: material properties and simulation
conditions. Materials properties do not have to be specified for each simulation, but can be if it is desired.
On the other hand, simulation conditions are required to be inputted for every simulation.
When the program is opened it appears the next window:

Figure 3.17 Single simulation, initial window
In figure 3.17 can be observed how easy is to execute a single simulation. After indicating the experimental
conditions and pushing the EXECUTE button the calculation will start, so the program will not respond to
any order until that process finishes properly. After calculation is completed, the estimated temperature
distribution as well as the predicted infrared front picture are presented (figure 3.18-a). Clicking the Other
Results button (figure 3.18-b) it is possible to analyze the temperature evolution over time of one or more
blocks, the two-dimensional temperature profile (along y or z axis) or the temperature value at each block.
Development of the Program_ i

_______________________________________________________________________________________
50

Figure 3.18-a Example of the main results of a single simulation

Figure 3.18-b Other results of the simulation
By clicking in the Options menu it is possible to use a different value for any of the physical properties of
the compounds, as well as specify the desired System of Blocks or choose between different methods for
estimating the thermal conductivity of the suspension and the air convection coefficient. Information about
those methods is found in section 4.
Development of the Program_ i

_______________________________________________________________________________________
51
3.3.2 Parameters Study
A Parameters Study consists in carrying out a series of simulations in order to find out the quantitative
influence of some parameters in the resulting temperature distribution of the system in steady state. The
user interface version of the program includes a section where it is possible to configure the Parameters
Study that it is wanted to be done, choosing the variables to be studied and the values that those must
take.
By going to File/New/Parameters Study the Parameters Study window appears (figure 3.19). In the first part
of that window, it is required to input the value of those properties that are going to be constant during the
study. The parameters that are wanted to take several values must not be specified yet. When all fixed
properties have been specified, click on the Apply button.

Figure 3.19 Parameters Study window
After that, in the second part of the window, the parameters to be studied are listed. It is possible to
specify the values of each parameter by selecting it in the list box and typing the desired value in the text
box. The entered values for all the parameters will appear in the table below.
Before the simulation starts, it is necessary to define the System of Blocks as well as to choose the
mathematical strategy for estimating the suspension thermal conductivity.
Obviously, completing a Parameters Study can take a huge amount of time. That will be imposed mainly by
the System of Blocks chosen, the number of cases to simulate, the simulation time imposed for simulations
and, of course, the computer where the study is carried out. A Parameters Study of 720 cases was
developed in the present work (results are analyzed in section 5.2), using the Variable Size Stencil
discretization and setting the simulation time in 700 seconds. It was needed around 80 hours for
completing calculations.
Two files are produced for each case of the Parameters Study: An Excel file, containing the temperature in
all blocks and the parameters value, and a MATLAB figure, representing the temperature profile.
_______________________ i
_______________________________________________________________________________________
52
4. Simulation Setting
In previous section the structure of the program is explained in detail, but nothing has been said about the
physical properties of the materials or the correlations employed for estimating some variables. This issue
is treated now.
Before reaching this section, several references to the standard values of the parameters used for
simulations have been made. Those values are exposed here. They have not been measured directly for the
materials used in the electrochromatographic device, but its suitability is checked in present section.
Two options are considered for the estimation of the thermal conductivity of the silica particles suspension
in the electrolyte: A simple average among the particles and the liquid or an estimation based on
volumetric integration.
4.1 Standard Values
By the time this program was being built, no information had been obtained from direct measurements of
the materials properties. Of course, those would be the best possible values for its use in the simulation
program, but its obtaining was out of the aims of the present project. The standard used values are
collected in table 4.1 and have been obtained from general properties tables. Its modification is possible
and recommended if a direct measurement is done.
Table 4.1 Standard values for parameters
Material Property and Units Value
Glass
Thermal conductivity, W/(Km) 0.96
Density, kg/m
3
2500
Specific heat, J/(kgK) 840
Air
Thermal conductivity, W/(Km) 25710
-4
Density, kg/m
3
1.205
Specific heat, J/(kgK) 1005
Viscosity, Pas 1.8210
-5
Convection coefficient, W/(Km
2
) 10
Silica Particles
Thermal conductivity, W/(Km) 1.38
Density, kg/m
3
2000
Specific heat, J/(kgK) 700
Electrolyte
Water Specific heat, J/(kgK) 4180
Methanol Specific heat, J/(kgK) 2480
Volume ratio methanol/water 6
Methanol weight fraction 0.8
Density, kg/m
3
850
Viscosity, Pas 1410
-4
Thermal conductivity, W/(Km) 0.27
Suspension
Porosity 0.35
Electrical conductivity, S/m 610
-3

Cooling Liquid Thermal conductivity, W/(Km) 0.58


Simulation Setting__________ i
_______________________________________________________________________________________
53
4.2 Convection Coefficient Estimation
Convection coefficient is theoretically calculated from fluid and flow properties using Nusselt number (Nu),
which is a non-dimensional quantity expressing the ratio among convective and conductive heat
transference. Several correlations are well-established for Nusselt number estimation depending on the
characteristics of the heat transference. In this work next correlations are employed for natural convection
on a vertical surface [LIE11] and forced laminar flow [LEV93] respectively:

Nu = u.68 +
u.67Ro
L
14
|1 +[
u.492
Pr

9
16
]
49

(4.1)
Nu = 4.S6 (4.2)

Where
Pr =
Cp
k

Ro
L
= Pr0r
0r =
g[II
3
p
2
p
2

Pr: Prandtl number
Ro
L
: Rayleigh number
0r: Grashof number
g: Gravity acceleration
[: Volumetric thermal expansion coefficient
I: Length
Once Nusselt number has been obtained, the estimation for convection coefficient is easily obtained:

=
Nu
k

(4.3)

Where is the characteristic length, being the diameter in a cylinder and the highness in a plate.
Natural convection on a vertical surface, governed by equation 4.1, has been considered for the heat
exchange between the air and the front glass. That correlation presents an inconvenient: it does not
consider air humidity or any air minimal flow so the value obtained, 3.22 W/(Km
2
), is smaller than general
recommended values, from 10 to 100 W/(Km
2
). In section 4.4 it is described an experiment in which the
value of 10 W/(Km
2
) is proven to be appropriate. Anyway, the user of the program can specify a concrete
value for that variable on each simulation or establish its calculation using the natural convection
correlations.
On the other hand, the cooling liquid moves through the system according to forced laminar flow, so the
Nusselt number is constant and equal to 4.36. The convection coefficient for the heat exchange among the
fluid and the back glass is obtained from equation 4.3.
As it was mentioned in section 3.2.8, natural convection was also considered when the program was being
built as a heat transference mechanism among the separation region and the glasses and it was revealed
non-significant.

Simulation Setting__________ i
_______________________________________________________________________________________
54
4.3 Suspension Thermal Conductivity
As it has already been explained, the separation region of the device consist on a suspension of silica
particles in an electrolyte. An exact estimation of the effective thermal conductivity of that kind of medium
would require the knowledge of how particles are distributed in the bulk of the fluid and this is just
impossible.
Multiple literature can be found about the topic, for example [JEI06], in which it is emphasized that the
particles induce an improvement in the conductive properties of the liquid, as long as the thermal
conductivity of the particles is bigger than of the fluid, which is habitual.
In the present work two possibilities are offered to the user of the program for the estimation of that
variable.
Simple average
If this option is chosen, the thermal conductivity of the suspension is estimated according to next
expression:
k
m
= ek
Iq
+ (1 e)k
sI
(4.4)
Where
k
sI
is the thermal conductivity of the silica particle
k
Iq
is the thermal conductivity of the electrolyte
k
m
is the effective thermal conductivity of the suspension
This is a valid solution, but the obtained value might be bigger than in reality. Equation 4.4 returns the
value that would be obtained if two parallel resistances, one consisting on a solid silica block and other on a
pure electrolyte region, were present. This description is quite far from reality and it would be normal to
expect a higher thermal conductivity coefficient than if all silica particles are surrounded by liquid, which
would add some extra resistance to transference. According to that line of though, it was proposed a
different method for estimating that parameter.
Volumetric integration average
In first place, it must be pointed out that this method is only valid if the porosity of the suspension is
around 0.35, which is the usual value.
Figure 4.1 shows a sphere of radius R contained in the inside of the minimal possible cylinder, with radius R
and height 2R.





Figure 4.1 Sphere with radius R contained in the minimal cylinder
For this distribution, the volume of the sphere represents a 66.7% of the volume of the cylinder:
Scrc :olumc
Iotol :olumc
=
4
S
, nR
3
2nR
3
=
2
S

R
Simulation Setting__________ i
_______________________________________________________________________________________
55
This geometry presents a volume distribution very similar to the particles suspension in the separation
region, so it will be used for estimating the thermal conductivity as follows. The solid represents a silica
particle and the rest of space is occupied by the electrolyte.
The top and bottom faces of the cylinder are considered to be isothermal but a different temperature, so a
heat flow appears among them. For calculating the effective thermal conductivity of that geometry it is
possible to use the integration of concentric annular cylinders. If the internal radius of an annular cylinder is
r and the external is r +Jr, the heat exchanged between the two faces of the cylinder can be expressed
as:
J = u JA I = u 2nr Jr I
The value of u for an annular cylinder can be calculated from the thermal conductivities of the particle and
the fluid and the geometrical parameters, according to equation 3.2:
1
u
= 2 _
R R
2
r
2
k
Iq
+
R
2
r
2
k
sI
_
Thus, the next three expressions can be connected:
=
J

nrI
R R
2
r
2
k
Iq
+
R
2
r
2
k
sI
Jr
R
0

=< u > nR
2
I
< u >=
k
m
2R

Leading to an expression for estimating the effective thermal conductivity of the suspension:
k
m
=
2
R
J

r
R R
2
r
2
k
Iq
+
R
2
r
2
k
sI
R
0
Jr
The estimated value for k
m
thus obtained does not depends on the value of R.

If the standard values for the conductivity of the electrolyte and the silica particles are used, by this method
it is obtained a value of k
m
= u.69
W
(Km)
while if the simple average is used, it is estimated a value of
k
m
= u.99
W
(Km)
. None of these methods match with the real distribution in the suspension, but the
volumetric integration average must be closer to reality because it takes into account that the suspension is
composed of individual silica particles separated by the electrolyte, instead of just two continuous
homogeneous regions.
Thermal conductivity in the separation region is a very important parameter and it is very recommendable
to obtain the value of the suspension experimentally.

(4.5)
Simulation Setting__________ i
_______________________________________________________________________________________
56
4.4 Heating Experiment with Ethanol
In this section it is checked the validity of the standard values for the material properties. For this,
observations extracted from a heating experience are used.
The experience consists on increase progressively the temperature of the cooling liquid (in this case, it
would be more appropriate the term heating liquid) while infrared pictures of the system are taken. The
separation region is filled with ethanol, instead of with the silica suspension. The used values for ethanol
properties are:
cnsity = 789
kg
m
3

Icrmol conJucti:ity = u.171
w
K m

The data obtained from the experiment as well as the predicted values are collected in table 4.2.
Table 4.2 Heating Experiment with Ethanol
Time
(min)
Temperature of the
heating liquid (C)
Temperature observed
in ethanol (C)
Temperature predicted
for ethanol (C)
0 11 13.8 -
4 18.2 15.1 -
6 23.4 18.1 -
9 29.7 22.7 -
10 33 26 25.9
11 35.6 28 28.1
13 40.9 32 32
14 43.3 34.7 34.4
15 44.5 36.5 36.4
16 45.3 38.3 38
18 48.6 40.5 41.1
19 50.3 41.6 42.7
21 53.8 43.6 45.4
23 55.2 46.2 48.2
25 56.4 48.1 50.1
27 56.7 48.7 51.6

For simulating that case, apart from using ethanol properties and setting the potential applied as null, it
was necessary to add the possibility that the temperature of the heating liquid vary. In the calculation, it
has been used the average value for the heating temperature.
Since temperature values for intermediate points are unknown, it was decided to set the fourth point, after
9 minutes of experience, as the first point for the simulation. Thus, initial temperature has to be set as
22.7 C.
In table 4.2 it can be observed that predictions are very accurate when temperature is lower than 40 C,
but if temperature is higher the predicted value exceeds observations. This is the result of considering the
material properties as non-temperature dependent. However, since the temperature range in the
electrochromatographic experiences never reach such a high values, this is not a problem. From that
experience can be concluded that the simulation program displays an adequate performance as far as the
energy transference is concerned.
Simulation Setting__________ i
_______________________________________________________________________________________
57
The temperature profile obtained from the simulation when time is equal to 18 minutes is shown in figure
4.2. In this representation it can be observed that the thermal conductivity in the separation region is
significantly lower than in the glass, what it is deduced from the increase in the temperature gradient.

Figure 4.2 Simulated temperature profile in the heating experiment when time is 18 minutes







_______________________ i
_______________________________________________________________________________________
58
5. Results and Discussion
A comparison between some experiments and the corresponding simulations is done in this chapter. Also,
the results of a study about the influence of some parameters in the thermal response of the system are
exposed.
On the other hand, a theoretical proposal that could explain the complex thermal behavior shown by the
electrochromatographic device is introduced.
Since the present project is a theoretical work, there is not a large amount of experimental results to
analyze. An examination of the performance of some components devised for the simulation program has
been exposed in Development of the Program main section, and a general evaluation of the Degree Thesis
is carried out in Conclusions.
5.1 Simulations versus Experiments
In first place it is necessary to point out that there is not an appropriate experimental data collection up to
now. That is easily understandable, having into account that the thermal measurements carried out until
now have been approached qualitatively more than quantitatively. This situation is expected to change
progressively.
Otherwise, the experimental values are difficult to be interpreted due to the presence of some
incongruence. For example, it is possible to find several values of temperature for distinct experiments
developed in the same conditions, or a lower temperature when the electrical conditions are stronger.
Thus, it does not worth doing an exhaustive comparison between the predicted and the experimental
values collected up to now, because that study would not be a reliable evaluation of the adequacy of the
simulation program. Despites, in section 4.4 can be found an analysis with this purpose.
Anyway, some cases are exposed in table 5.1 for its illustration.
Table 5.1 Predicted and experimental values for some cases
Voltage (kV) Current (mA) Air T (C) Bed T Observed (C) Bed T Predicted (C)
3 1.7 19.2 11.8 11.7
3 1.7 24.3 14.5 11.9
3 4 16.6 12.5 12.5
3 2 20 12.7 12.3
4 3.2 20.6 12 13.1
4 1.9 23 13 12.2

The first two cases were carried out in very similar conditions, but the temperature observed is not the
same. The reason for that difference could lay in a different value of the cooling temperature: although in
all experiments the cooling liquid is supposed to be at 10 C, the infrared picture of the second experiment
shows a value approximately 2.5 C bigger than in the first case. On the other hand, in the last two values
the predictions and the observations seem to be inverted. Here there is also a difference of around 2 C in
the cooling temperature displayed by the infrared picture.
Therefore, all cases collected in table 5.1 would show an excellent correspondence among observations
and predictions if the temperature of the cooling liquid were extracted from the IR pictures. However, in all
the experiments, the cooling temperature measured directly was of 10 C. Thus, it is highly recommended
to check the accuracy of both devices, the thermostat and the infrared camera.
Results and Discussion ______ i
_______________________________________________________________________________________
59

(S.1)
5.2 Parameters Study
A Parameters Study was developed in order to investigate the quantitative influence of the main
parameters in the resulting bulk temperature, as well as to provide an example of how to use this feature.
The variables considered for the study as well as their corresponding values are stated in table 5.2. Thus,
there are 720 different experiences that must be simulated in this Parameters Study. Once simulations
were completed, a table containing the value of the resulting bulk temperature as well as the
corresponding conditions of the simulation was built.
Table 5.2 Parameters Study variables and values for simulation
Air
Temperature
Electrical Conductivity
(microS/cm)
Thermal Cond.
Glass (W/(m*k))
Voltage (kV) Porosity
Cooling
Temperature (C)
18 20 0,7 1 0,32 -10
24 50 0,9 3 0,45 0

100 1,1 5

10

150

7

10

When results were then analyzed using Visual-Xsel, it was revealed that it was not possible to interpret all
cases together. According to the technical solution adopted for performing the unequal heat generation,
some of the cases should display that unequal heating and some of them should not, but the main
disadvantage shows up when the technical solution is used for simulating cases out of the range of
experimental data collected, since in that cases the regression model used for estimating the unequal heat
generation is expected to fail. Thus, it was decided to analyze the contribution of each parameter for the
cases where the conditions were not severe. That decision reduced the amount of cases to 288, and the
new values of the variables were truncated to those collected in table 5.3.
Table 5.3 Parameters Study variables and values analyzed
Air
Temperature
Electrical Conductivity
(microS/cm)
Thermal Cond.
Glass (W/(m*k))
Voltage (kV) Porosity
Cooling
Temperature (C)
18 20 0,7 1 0,32 -10
24 50 0,9 3 0,45 0

100 1,1

10

150

Regression to quadratic model provides the following equation:
I = 4.72 1SuS y 4.1 1u
-4
u +u.9S I
cooI
+u.196 y u +67S7u y
2

Table 5.4 Multiple regression of the Parameters Study results

Coefficient Std Deviation p-value Min Max
u 4.1 1u
-4
0.000132 0.0432 1000 3000
y 1SuS 75.298 0 0.002 0.015
I
cooI
u.9S 0.008513 0 -10 10
y u u.196 0.014 0

y
2
67S7u 3894 0

Constant 4.72

R=0.979 DF=282 RMS=1.18 Q=0.979

Results and Discussion ______ i
_______________________________________________________________________________________
60
Statistical parameters show that the obtained model, represented by equation 5.1, can explain successfully
the 97.9% of variations in the temperature of the bulk. The most interesting aspect of a Parameters Study is
to elucidate the contribution of each variable, individually, to the temperature variation of the system in a
specified range of values for any of the parameters. This task is not as simple as taking into account the
coefficient that multiplies the corresponding variable, but also variables interactions or second order
contributions must be considered. An appropriate pattern for clarifying the contribution of a variable is to
represent equation 5.1 considering the rest of variables as a constant (adopting the average value each
one). Therefore, individual contributions are graphed next:

Figure 5.1 Individual contribution of the parameters
Figure 5.1 evidences that cooling temperature is the most influent variable, being the slope of the line of
almost the unity. This is an important result that confirms the suitability of the design of our
electrochromatographic device for evacuating the heat generated in the system.
Electrical voltage has a linear influence in the studied range, while electrical conductivity displays a more
complex behavior. This could be the result of using values out of the experimental range. It would be logical
to find an increase in temperature if the electrical conductivity is higher, since that implies a bigger amount
of heat being produced due to Joule Effect.
In conclusion, present Parameters Study has proved that the most important variables as far as
temperature variations are considered are the applied voltage, the cooling temperature as well as the
electrical conductivity. A secondary result of the study is that the influence of the glass conductivity, the air
temperature or the porosity of the suspension could be neglected.

Results and Discussion ______ i
_______________________________________________________________________________________
61
5.3 A Theoretical Approach to Unequal Heating
In this section it is suggested a theoretical approach to a phenomena that could explain the spatial
heterogeneities in heat generation. It is worth pointing out that there are other lines being followed in
order to explain Unequal Heating, apart from this one. This approach is not part of the simulation program,
but posting it in this work has been considered interesting, since it can contribute to explain the Unequal
Heating.
From the point of view of the model here proposed, heat is unequally generated due to spatial
heterogeneities in the porosity of the stationary phase. Here, the difference in the heat generated in two
different regions with distinct porosity is mathematically estimated.
The region where separation takes place is filled with a suspension of silica particles in an electrolyte. The
suspension is not saturated, so silica particles possess some movement freedom. Since there is a mass flow
headed from top to bottom, and due also to natural sedimentation, silica particles are incited to move in
this direction. According to that, it would not be surprising to find out that the porosity of the bulk is higher
at the bottom of the separation region than at the top.
For simplifying the mathematical demonstration, only two regions are going to be considered in order to
study the influence of different values of porosity in heat generation. The two hypothetical separation
regions are represented in figure 5.2.






Figure 5.2 Transformation of a homogeneous separation region into two different regions. e

, y

and

represent the porosity,


electrical conductivity and heat generation of the region i respectively
If the initial porosity of the mixture is known, the porosities of the other two regions are related:
e
0
I
0
= e
1
I
1
+ e
2
I
2

Being I

the height of the region i. Previous relationship provides an equation for obtaining the value of
porosity in the upper region, if porosity in the lower is known.

e
2
=
e
0
I
0
e
1
I
1
I
2

(S.2)
According to [LOP02], the electrical conductivity of a medium is determined by the multiplication of the
density of free charges (p) and the mobility of those charges (p):
y = p p
(S.S)
Obviously, the density of free charges is directly proportional to the porosity of the medium. If that
constant of proportionality is referred as , previous equation would be expressed as:
y = e p
e
0
, y
0
,
0

e
2
, y
2
,
2

e
1
, y
1
,
1

Results and Discussion ______ i
_______________________________________________________________________________________
62
Where is a constant characteristic of the solution. As far as the movility of the charges is concerned, two
cases are going to be considered:
Case a) The mobility of the charges is constant.
In that case, the electrical conductivity is directly proportional to the porosity of the suspension, so next
relationship can be established:

y
0
y
1
=
e
0
e
1

(S.4)

Case b) The mobility of the charges depends on the porosity.
The mobility of the charges is proportional to the speed at which those move along the electrolyte.
According to the model of the electric double layer (see section 2.2.1), the speed of the free charges
reaches its maximum value in the bulk of the fluid, and the closer the charge is to the surface of a silica
particle, the slower it moves, resulting a profile similar to next representation:

Figure 5.3 Speed profile of charges
In order to quantify the effect a model is considered, in which the speed profile is approximated to two
regions, slow and fast, with speed :

and :
s
respectively. Clearly, this model does not fit
reality, but can be used for our proposal.

Figure 5.4 Speed profile approximation
The average speed of a charged molecule moving through the suspension depends on both, :
s
and
:

, as well as on the time it spends in each one of the regions from figure 5.4. But the time the
charged molecule spends moving in each region must be related with porosity: the more silica particles are
in the medium, the more time the charge spends moving in a slow region, since the number of slow
regions increases with the number of silica particles in the suspension. The expression describing the time
required for crossing all the slow regions is stated bellow:

Results and Discussion ______ i
_______________________________________________________________________________________
63

t
sIow
=
Iolumc (1 e) o
< :

> Arco e

(S.S)

Equation 5.5 deserves an explanation. In first place, it is worth pointing out that the time required for
crossing all the slow regions is equal to the distance the charge covers in its trip divided by the average
speed in the region. Besides, that distance could be expressed as the volume of the slow regions divided
by the area occupied by the fluid. Thus, next relationship can be established:
t
sIow
=
Iolumc o tc slow rcgions
< :

> Arco e

If that expression is compared with equation 6.5, it can be concluded that the volume of the slow regions
has been considered proportional to the volume of particles in the medium. In that model, it has been
supposed that each silica particle induces a volume of slow region equal to a fraction of the volume of the
own particle. The variable o represents that fraction. Thus, for example, if o = u.u1 it means that a particle
induces a slow region equal to the 1% of the volume of the particle.
On the other hand, following the same reasoning, the time required for crossing all the fast regions is:
t
sIow
=
Iolumc |e (1 e) o]
< :
s
> Arco e

It must be noticed that the volume of the fast regions is equal to the volume of liquid minus the slow
regions.
So, the average speed of a charged molecule along the suspension is equal to the height of the dispositive
divided by the time required for crossing that distance. Therefore:
< : >=
Ecigt
Iolumc (1 e) o
< :

> Arco e
+
Iolumc |e (1 e) o]
< :
s
> Arco e

< : >=
Ecigt < :

>< :
s
> Arco e
Iolumc |(1 e) o < :
s
> +(e (1 e) o) < :

>]

< : >=
Ecigt < :

>< :
s
> Arco e
Iolumc |e < :

> +(1 e) o (< :


s
> < :

>)]

Now, an appropriate approximation is taken:
< :
s
> < :

>< :

>
And since:
Iolumc = Ecigt Arco
The average speed can be expressed using a simple expression:
< : >=
< :
s
> e
e +(1 e) o

Equation 5.8 means that the average speed in the whole region is equal to the average speed in the fast
regions multiplied by the factor
s
s+(1-s)6
1. If o is taken equal to zero, that factor is the unity and so the
mobility of the charges is not considered to be dependent on the porosity (case a), so from now on,
equations are valid for cases a and b, taking o = u or o u respectively. If o u, that influency is being
(5.6)
(5.7)
(5.8)
Results and Discussion ______ i
_______________________________________________________________________________________
64
taken into account, and the movility of the charges (proportional to the average speed) depends on the
porosity:
p
0
p
1
=
e
0
e
1

e
1
+(1 e
1
) o
e
0
+(1 e
0
) o

Therefore, according to equation 5.3, due to the influence of the porosity in the density of free charges and
in their mobility, it is obtained the following result:
y
0
y
1
= _
e
0
e
1
]
2
e
1
+(1 e
1
)o
e
0
+(1 e
0
)o

Equation 5.10 indicates the relationship among the conductivity of a suspension with initial porosity e
0
and
the conductivity of a hypothetical region, where the porosity has decreased to e
1
due to the sedimentation
of the particles. Now that relationship has been established, it is possible to analyze the influence of the
phenomenon described in the figure 5.2 in the heat generation.
In first place, it is necessary to study the value of the electrical current. After the establishment of the two
regions represented in figure 5.2, there are two electrical resistors in series. Using the general expression
for electrical resistance:
Rcsistoncc =
Icngt
ConJucti:ity Arco

Ohms law leads to:
I =
u
R
=
u
I
1
y
1
e
1
Arco
+
I
2
y
2
e
2
Arco

Being Arco the cross sectional area of the equipment. Previous equation can be reordered:
I =
u Arco
I
0
y
0
e
0

I
0
y
0
e
0
I
1
y
1
e
1
+
I
2
y
2
e
2


I = I
0

I
0
y
0
e
0
(
I
1
y
1
e
1
+
I
2
y
2
e
2
)

Being I
0
the electrical current that would flow if there were just an homogeneous region with porosity
equal to e
0
. If equation 5.9 is implemented in last relationship, it is obtained a useful expression for the
electrical current:
I = I
0
I
0
I
1
[
e
0
e
1

3
e
1
+(1 e
1
)o
e
0
+(1 e
0
)o
+I
2
[
e
0
e
2

3
e
2
+(1 e
2
)o
e
0
+(1 e
0
)o

Finally, the heat generated in each one of the regions is:

=
I
2
I

Arco e



(5.9)
(5.10)
(5.11)
(5.12)
(5.13)
Results and Discussion ______ i
_______________________________________________________________________________________
65
According to the general expression:
= I
2
Rcsistoncc
Equations have already been established, so it is time to analyze the situation. In first place, a suspension
with known values of porosity and electrical conductivity is prepared and introduced into the
electrochromatographic device. That suspension splits in two regions, with known height, with a different
value of porosity for each one (being both related by equation 5.2). According to equation 5.9 it is possible
to estimate the electrical conductivity of each region from the values of porosity and the conductivity of the
first suspension (before it splits in two regions).
The parameter o will be approximated to o = u.u1. Althought it is possible to go into further details about
that parameter, this would be out of the aims of the present work, and just using the suggested value is
enough for our purpose.
Once the electrical conductivity of each region has been estimated, it is possible to calculate the electrical
current that should flow through the electrolyte, from equation 5.12. Finally, the heat generated in each
region obeys equation 5.13.
Now, this procedure is employed for a demonstration:
An initial suspension with e
0
= u.SS is placed in the electrochromatographic device developed in the
department. After that, the suspension splits in two regions with different porosity. The region at the
bottom is 16 millimeters long. Study the heat generation in each region depending on the porosity of the
bottom region, if the electrical conductivity of the original solution is y
0
= u.u1S2 S/m.
The results are collected in next table:
Table 5.5 Results of the demonstration of the theoretical approach
s
1
s
2
I (A)
y

y
1

y

y
2

Q
1
(W) Q
2
(W) Extia heat Extia heat Extia heat Extia heat
u,SS u,SS u,uu4S 1 1 1,u8 12,41 1
u,S u,SS4 u,uu446 1,21 u,98 1,Su 11,87 1,4S
u,2S u,SS9 u,uu4S2 1,SS u,97 2,1S 1u,8u 2,27
u,2 u,S6S u,uuS96 2,u7 u,96 S,u2 8,84 S,92
u,1S u,S67 u,uuS21 S,u8 u,94 S,9S S,67 8,u2
u,1 u,S72 u,uu19u S,61 u,9S S,76 1,92 22,46

It table 5.5 the following results can be observed:
- Naturally, if e
1
decreases, e
2
increases.
- The electrical current decreases if the difference in the porosity of the regions is bigger.
- Logically, the electrical conductivity of region 1 is smaller than the original, and in region 2 is bigger
than in the original suspension.
- The values for the heat generated do not provide much information, but the column Extra heat
does. In this column it is represented the quotient resulting of divide the heat generated per unit of
volume in region 1 by the heat generated per unit of volume in region 2. Therefore, the splitting of
the suspension in two regions would imply a unequal heat generation.
The mathematical approach in this section has been applied for the case in which there are just two regions
well limited, but reality is expected to be much more complex. Nevertheless, the theoretical model here
Results and Discussion ______ i
_______________________________________________________________________________________
66
deducted can be extrapolated, since each one of the new regions can also split in two new regions,
producing the corresponding unequal heating.

In conclusion, the theoretical approach proposed is able to explain the existence of differences in the heat
generation based on the distinct porosity of the suspension in different regions. So, according to the model,
the IR pictures are actually a map representing the porosity of the suspension, being this variable smaller
in the hotter bands.
_______________________ i
_______________________________________________________________________________________
67
6. Conclusions
In the present project it has been designed, created and analyzed a simulation program for describing the
thermal behavior of a new electrochromatographic device that it is being developed in our department.
During the creation of the program the following achievements have been reached:
- Conversion of the original problem, a PDE, into a system of ODEs using spatial discretization.
- Two different methods for spatial discretization have been proposed, in order to reduce the
calculation time if high accuracy is desirable.
- Design of an algorithm able to solve that system of thousands of ODEs.
- Improvement of calculation speed with respect to usual Runge-Kutta as well as to Cash-Karp
Method for the present case.
- Implementation of a technical solution in order to explain the Unequal Heating observed
experimentally.
- Implementation of the possibility of simulate single experiences or a Parameters Study.
- Development of a User Interface for the program stand alone.
All those achievements are related with the program itself, but there are others derived from the
theoretical study of the electrochromatographic apparatus:
- The influences of the main variables in the temperature of the bulk have been quantified by a
Parameters Study. The most influent variables are the temperature of the cooling liquid, the
electrical conductivity of the suspension and the voltage applied.
- A theory that could explain the Unequal Heating observed experimentally has been developed.
- A simple equation for estimating the thermal conductivity of a suspension has been deducted.
- The results suggest that the complex experimental behavior observed might be caused by the kind
of silica particles, so it would be desirable to replace them by another ones with more silanol
groups on the surface.

__________________ ______ i
_______________________________________________________________________________________
68
7. Outlook
Main lines of investigation that can be followed after this project:
- Build a program for simulating the mass transference in the system. After that, it would be
desirable to create a single program containing the simulation for both phenomena, mass
transference and heat flow.
- Deeper Parameters Studies, including other variables or ranges.
- Study the thermal behavior experimentally using other silica particles.
- Study experimentally the relationship between porosity and electrical conductivity, in order to
check the theoretical approach here introduced for explaining the Unequal Heating.
- Collect more data in order to build a better regression model for predicting the height of the hot
region as well as the temperature difference among that and the cold region.

__________________ ______ i
_______________________________________________________________________________________
69
8. Literature
[ANY08] C. Anyakora, I. Afolami, T. Ehianeta, F. Onwumere. HPLC analysis of nicotinamide, pyridoxine,
riboflavin and thiamin in some selected food products in Nigeria. African Journal of Pharmacy
and Pharmacology, Vol. 2, 29-36, April 2008
[BOT06] D. Bottenus, D. Leatzow, C. Ivory. Effects of increased voltage on resolution in preparative
isoelectric focusing of myoglobin varia. Electrophoresis 2006, 27, 33253331.
[CAS90] J. R. Cash, Alan H. Karp. A Variable Order Runge-Kutta Method for Initial Value Problems with
Rapidly Varying Right-Hand Sides. 1990.
[CHE98] S. Cherkaoui, E. Varesio, P. Christen, J.L. Veuthey. Selectivity manipulation using nonaqueous
capillary electrophoresis. Application to tropane alkaloids and amphetamine derivatives.
Electrophoresis 1998, 19, 2900-2906.
[DEL94] C. Delgado, F.A. Toms-Barbern, T. Talou, A. Gaset. Capillary Electrophoresis as an
Alternative to HPLC for Determination of Honey Flavonoids. Chromatographia Vol. 38, No ,
January 1994.
[FIN02] B. Finke, B. Stahl, M. Pritschet, D. Facius, J. Wolfgang, G. Boehm. Preparative Continuous
Annular Chromatography (P-CAC) Enables the Large-Scale Fractionation of Fructans. Journal
of Agricultural and Food Chemistry, 2002, 50, 4743-4748.
[GIO02] R. Giovannini, R. Freitag. Continuous Isolation of Plasmid DNA by Annular Chromatography.
Biotechnology and Bioengineering, Vol. 77, No.4, 2002.
[JEI06] J. Jeinhao Ma. Thermal Conductivity of Fluids Containing Suspensions of Nanometer-Sized
Particles. Massachusetts Institute of Technology, 2006.
[JIS02] Jan Jiskra. Capillary Electrochromatography; Fundamentals and Applications. Doctoral Thesis
2002.
[JPC90] J. P. De Carli II, G. Carta, C. H. Byers. Displacement Separations by Continuous Annular
Chromatography, AIChE Journal, August 1990 Vol. 36, No. 8.
[LEV93] O. Levenspiel. Engineering Flow and Heat Exchange. 1993.
[LIE11] J. H. Lienhard. A heat transfer textbook. 2011.
[LOP02] V. Lpez Rodrguez. Electromagnetismo. 2002.
[MAR52] Archer J.P. Martin. The development of partition chromatography. Nobel Lecture, December
12, 1952.
[PUI06] L. Puigjaner, G. Heyen, Computer Aided Process and Product Engineering vol. 1. 2006.
[SAN04] Sandip Ghosal. Fluid mechanics of electroosmotic flow and its effect on band broadening in
capillary electrophoresis. Electrophoresis, 2004.
[SMI05] H. Schmidt-Traub. Preparative Chromatography. 2005.
[SMI55] 0. Smithies. Zone Electrophoresis in Starch Gels: Group Variations in the Serum Proteins of
Normal Human Adults. Biochemical Journal, 1955.
[TIS30] Arne W.K. Tiselius. The moving-boundary method of studying the electrophoresis of
proteins. Nova Acta Regiae Societatis Scientiarum Upsaliensis Ser.IV, Vol. 7, 1930.
__________________ ______ i
_______________________________________________________________________________________
70
[TIS37] Arne W.K. Tiselius. A new apparatus for electrophoretic analysis of colloidal mixtures.
Transactions of the Faraday Society, 1935.
[TIS48] Arne W.K. Tiselius. Electrophoresis and adsorption analysis as aids in investigations of large
molecular weight substances and their breakdown products. Nobel Lecture, December 13,
1948.
[TWS05] M.S. Twsett. On a New Category of Adsorption Phenomena and their Application to
Biochemical Analysis. Lecture on the 8
th
of March, 1903, Meeting of the Biological Section of
the Warsaw Society of Natural Scientists.
[WOO94] A.T. Woolley, R.A. Mathies. Ultra-high-speed DNA fragment separations using microfabricated
capillary array electrophoresis chips. Biophysics, Vol. 91, 11348-11352, November 1994.
i


















Appendix: Code of the Simulation Program


function varargout = Interface(varargin)
% Last Modified by GUIDE v2.5 20-Jul-2011 05:42:02
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Interface_OpeningFcn,
...
'gui_OutputFcn', @Interface_OutputFcn,
...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State,
varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Interface is made visible.
function Interface_OpeningFcn(hObject, eventdata, handles,
varargin)

global numberfile ratio_std ratio k_g_std k_g Eps_std Eps
k_sil_std k_sil
global Cp_water_std Cp_water Cp_methanol_std Cp_methanol
k_air_std k_air
global Cp_air_std Cp_air ro_air_std ro_air k_cool_std k_cool
ro_glass_std
global ro_glass Cp_glass_std Cp_glass ro_sil_std ro_sil
Cp_sil_std k_mix
global Cp_sil Cond Cond_std ro x_w_m nu k_liq nu_air_std
nu_air ny_std
global nz_std ny nz popstencil k_mixcalc h_air_std h_air y x
z dy dz dx

uistack(handles.execute,'up',3);
uistack(handles.finish_bottom,'bottom',2);
uistack(handles.intensity_bottom,'up',1);

% Standard Parameters
numberfile=0;
ratio_std=6; %Vol methanol/Vol water
k_g_std=0.96; %Glass thermal conductivity,
W/(m*K)
Eps_std=0.35; %Porosity
k_sil_std=1.38; %Silica thermal conductivity,
W/(m*K)
Cp_water_std=4180; %Specific heat water,
J/(kg*K)
Cp_methanol_std=2480; %Specific heat methanol,
J/(kg*K)
k_air_std=0.0257; %Air thermal conductivity,
W/(m*K)
Cp_air_std=1005; %Specific heat air, J/(kg*K)
ro_air_std=1.205; %Air density, kg/m3
nu_air_std=1.82E-5; %Air dinamic viscosity, Pas
k_cool_std=0.58; %Cooling liquid (water)
thermal conductivity, W/(m*K)
ro_glass_std=2500; %Glass density, kg/m3
Cp_glass_std=840; %Specific heat glass,
J/(kg*K)
ro_sil_std=2000; %Silica density, kg/m3
Cp_sil_std=700; %Specific heat silica,
J/(kg*K)
Cond_std=60E-4; %Electrical conductivity of
the suspension, S/m
ny_std=60; %Discretization points, y-
axis
nz_std=50; %Discretization points, z-
axis
h_air_std=10; %Convection coefficient air,
W/(m2K)

% Parameters for the program
popstencil=1;
k_mixcalc=1;

% Variables
ratio=ratio_std;


k_g=k_g_std;
Eps=Eps_std;
k_sil=k_sil_std;
Cp_water=Cp_water_std;
Cp_methanol=Cp_methanol_std;
k_air=k_air_std;
Cp_air=Cp_air_std;
ro_air=ro_air_std;
k_cool=k_cool_std;
ro_glass=ro_glass_std;
Cp_glass=Cp_glass_std;
ro_sil=ro_sil_std;
Cp_sil=Cp_sil_std;
Cond=Cond_std;
nu_air=nu_air_std;
ny=ny_std;
nz=nz_std;
h_air=h_air_std;

%Predefined blocks
dy=0.015/ny;
dz=0.2/nz;
dx=0.065;
y=0:dy:0.015; % Y position vector, m
z=0:dz:0.2; % Z position vector, m
x=0:dx:0.065;

if ratio==4
ro=866; %Solution density, kg/m3
x_w_m=0.735; %Weight fraction methanol
nu=1.6E-3; %viscosity Pa*s
k_liq=0.29; %solution thermal conductivity W/(m*K)
elseif ratio==6
ro=850;
x_w_m=0.8;
nu=1.4E-3;
k_liq=0.27;
elseif ratio==8
ro=840;
x_w_m=0.84;
nu=1.25E-3;
k_liq=0.26;
elseif ratio==0 %Ethanol experiment
ro=789;
x_w_m=1;
nu=8.34E-4;
k_liq=0.171;
end

%Standard value for k_mix
R=30E-6; %Particle radio, m
dr=1E-7;
r=0;
area_k=0;
i=1;
func=zeros(1,100);
while r<=R
func(i)=r/((R-(R^2-r^2)^0.5)/k_liq+(R^2-
r^2)^0.5/k_sil); %Function for integration
if i>1
increase=func(i-1)*dr+(func(i)-func(i-1))*dr/2;
area_k=area_k+increase;
end
i=i+1;
r=r+dr;
end
k_mix=(2/R)*area_k;
k_mixcalc=1;

% Choose default command line output for Interface
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);


% --- Outputs from this function are returned to the command
line.
function varargout = Interface_OutputFcn(hObject, eventdata,
handles)
varargout{1} = handles.output;

% Executes in menu single_sim
function single_sim_Callback(hObject, eventdata, handles)



global ratio_std ratio k_g_std k_g Eps_std Eps k_sil_std
k_sil
global Cp_water_std Cp_water Cp_methanol_std Cp_methanol
k_air_std k_air
global Cp_air_std Cp_air ro_air_std ro_air k_cool_std k_cool
ro_glass_std
global ro_glass Cp_glass_std Cp_glass ro_sil_std ro_sil
Cp_sil_std k_mix
global Cp_sil Cond Cond_std ro x_w_m nu k_liq nu_air_std
nu_air ny_std
global nz_std ny nz popstencil k_mixcalc h_air_std h_air y x
z dy dz dx

% Parameters for the program
popstencil=1;
k_mixcalc=1;

% Variables
ratio=ratio_std;
k_g=k_g_std;
Eps=Eps_std;
k_sil=k_sil_std;
Cp_water=Cp_water_std;
Cp_methanol=Cp_methanol_std;
k_air=k_air_std;
Cp_air=Cp_air_std;
ro_air=ro_air_std;
k_cool=k_cool_std;
ro_glass=ro_glass_std;
Cp_glass=Cp_glass_std;
ro_sil=ro_sil_std;
Cp_sil=Cp_sil_std;
Cond=Cond_std;
nu_air=nu_air_std;
ny=ny_std;
nz=nz_std;
h_air=h_air_std;

%Predefined blocks
dy=0.015/ny;
dz=0.2/nz;
dx=0.065;
y=0:dy:0.015; % Y position vector, m
z=0:dz:0.2; % Z position vector, m
x=0:dx:0.065;

if ratio==4
ro=866; %Solution density, kg/m3
x_w_m=0.735; %Weight fraction methanol
nu=1.6E-3; %viscosity Pa*s
k_liq=0.29; %solution thermal conductivity W/(m*K)
elseif ratio==6
ro=850;
x_w_m=0.8;
nu=1.4E-3;
k_liq=0.27;
elseif ratio==8
ro=840;
x_w_m=0.84;
nu=1.25E-3;
k_liq=0.26;
elseif ratio==0 %Ethanol experiment
ro=789;
x_w_m=1;
nu=8.34E-4;
k_liq=0.171;
end

%Standard value for k_mix
R=30E-6; %Particle radio, m
dr=1E-7;
r=0;
area_k=0;
i=1;
func=zeros(1,100);
while r<=R
func(i)=r/((R-(R^2-r^2)^0.5)/k_liq+(R^2-
r^2)^0.5/k_sil); %Function for integration
if i>1
increase=func(i-1)*dr+(func(i)-func(i-1))*dr/2;
area_k=area_k+increase;
end
i=i+1;
r=r+dr;
end
k_mix=(2/R)*area_k;


k_mixcalc=1;

set(handles.voltage,'enable','on')
set(handles.intensity,'enable','on')
set(handles.airtemperature,'enable','on')
set(handles.coolingtemperature,'enable','on')
set(handles.initialtemperature,'enable','on')
set(handles.specify_I,'enable','on')
set(handles.calc_I,'enable','on')
set(handles.time,'enable','on')
set(handles.steady,'enable','on')
set(handles.t_limit,'enable','on')
set(handles.execute,'enable','on')
set(handles.execute,'BackgroundColor',[0.941 0.941 0.941])
set(handles.Setting,'enable','on')
set(handles.Results,'enable','off')
set(handles.prop,'enable','off')
set(handles.time,'value',1)
set(handles.specify_I,'value',1)
set(handles.save_profile,'enable','off')
set(handles.save_front,'enable','off')

subplot(handles.profile)
cla
subplot(handles.front_im)
cla

% Executes in menu par_study
function par_study_Callback(hObject, eventdata, handles)
Parameter_Study

% Executes in menu save
function save_Callback(hObject, eventdata, handles)
answer=inputdlg('Save as:','Save');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
filename=['Save_data\' answer.name];
saveas(handles.figure1,filename,'fig')
end

% --- Executes on button press in save_front.
function save_front_Callback(hObject, eventdata, handles)
answer=inputdlg('Save as:','Save');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
filename=['Save_data\' answer.name '.jpg'];
I=getframe(handles.axes4);
imwrite(I.cdata,filename,'Quality', 100)
end

% --- Executes on button press in save_profile.
function save_profile_Callback(hObject, eventdata, handles)
answer=inputdlg('Save as:','Save');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
filename=['Save_data\' answer.name '.jpg'];
I=getframe(handles.axes3);
imwrite(I.cdata,filename,'Quality', 100)
end

% Executes in menu exit
function Exit_Callback(hObject, eventdata, handles)
close

% Executes in menu properties
function Properties_Callback(hObject, eventdata, handles)
Parameters

% Executes in menu AdvOptions
function AdvOptions_Callback(hObject, eventdata, handles)
Options

% Executes in menu Run
function Run_Callback(hObject, eventdata, handles)
execute_Callback(hObject, eventdata, handles)

% Executes in push Results
function Results_Callback(hObject, eventdata, handles)
Graphics

% Executes in menu value


function value_Callback(hObject, eventdata, handles)
Parameter_values

% Executes in change option in intensity_bottom
function intensity_bottom_SelectionChangeFcn(hObject,
eventdata, handles)
if get(handles.specify_I,'value')==1
set(handles.intensity,'enable','on');
else
set(handles.intensity,'enable','off');
set(handles.intensity,'string','');
end

% Executes in change option in finish_bottom
function finish_bottom_SelectionChangeFcn(hObject, eventdata,
handles)
if get(handles.time,'value')==1
set(handles.t_limit,'enable','on');
else
set(handles.t_limit,'enable','off');
set(handles.t_limit,'string','');
end

% --- Executes on button press in execute.
function execute_Callback(hObject, eventdata, handles)
tic
global Eps Cp_water Cp_methanol k_cool ro_glass Cp_glass
ro_sil
global Cp_sil Cond ro x_w_m U I_real T_out T_cool T_ini
DeltaT0 k_max
global h_cool dz dy dx ny nz A_y A_z Den Q t_limit reach Q1
Q2 DZ1 DZ2
global z y Length popstencil time Temp T t pp j_int1
k_control i j_int2

U=str2double(get(handles.voltage,'string'));
if get(handles.specify_I,'value')==1
I_real=str2double(get(handles.intensity,'string'));
else
I_real=(U*Cond*0.001*0.065*Eps)/0.2;
end
T_out=str2double(get(handles.airtemperature,'string'));
T_cool=str2double(get(handles.coolingtemperature,'string'));
T_ini=str2double(get(handles.initialtemperature,'string'));
Length=0.2;
t_limit=str2double(get(handles.t_limit,'string'));

%Messages for input failure
if ~isnan(U) && ~isnan(I_real) && ~isnan(T_out) &&
~isnan(T_cool) && ~isnan(T_ini)
if U>=0 && I_real>=0
if get(handles.time,'value')==0 ||
(get(handles.time,'value')==1 && ~isnan(t_limit) &&
t_limit>=0)

set(handles.voltage,'enable','inactive')
set(handles.intensity,'enable','inactive')
set(handles.airtemperature,'enable','inactive')
set(handles.coolingtemperature,'enable','inactive')
set(handles.initialtemperature,'enable','inactive')
set(handles.specify_I,'enable','inactive')
set(handles.calc_I,'enable','inactive')
set(handles.time,'enable','inactive')
set(handles.steady,'enable','inactive')
set(handles.t_limit,'enable','inactive')
set(handles.execute,'enable','off')
set(handles.execute,'BackgroundColor',[0.9 0.9 0.9])
set(handles.Setting,'enable','off')
set(handles.Results,'enable','on')
set(handles.prop,'enable','on')
set(handles.save_profile,'enable','on')
set(handles.save_front,'enable','on')

%Heat transfer coefficient, cooling exchange:
Deq=2*0.0054*0.001/(0.0054+0.001);
u_inf=0.84;
Pr_cool=4180*1.3E-3/k_cool;
Re_cool=1000*u_inf*Deq/1.3E-3;
Gz_cool=Re_cool*Pr_cool*(Deq/Length);
if Re_cool>10000
Nu_cool=3.66+0.085*Gz_cool/(1+0.047*Gz_cool^0.66);
else
Nu_cool=4.36;
end
h_cool=k_cool*Nu_cool/Deq; %W/(m2*K)



dy=diff(y);
dz=diff(z);

% Heat Generation
A_y=dx*dz;
A_z=dx*dy;
Cond=I_real*0.2/(U*0.001*0.065*Eps);

Length_heat=(0.856636*U/1000+2.403893*I_real*1000-
2.15892*(I_real*1000)^2+0.416072*(I_real*1000)^3-0.2179)/100;
if Length_heat<0.015
Length_heat=0;
elseif Length_heat>0.07
Length_heat=0;
end

if Length_heat==0
DeltaT0=0;
else
DeltaT0=5.567703-3.54284*U/1000-
3.56301*I_real*1000+1.96067*U*I_real+0.418898*(U/1000)^3-
0.07157*(U/1000)^4;
end

k_max=1;
while z(k_max)<Length_heat
k_max=k_max+1;
end
DZ1=sum(dz(1:k_max-1));
DZ2=sum(dz(k_max:end));

Q=zeros(ny,nz);
Q_joule=U*I_real;
Q1=Q_joule*DZ1/Length;
Q2=Q_joule*(1-DZ1/Length);

%Joules/Kelvin: Liquid and glass
J_K_M=Cp_methanol*Eps*ro*x_w_m; %Methanol
J/(K*m3)
J_K_W=Cp_water*Eps*ro*(1-x_w_m); %Water, "
J_K_S=Cp_sil*(1-Eps)*ro_sil; %Silica, "

V_c=zeros(ny,nz);
for j=1:ny
if y(j)-0.01<1E-8 %Mathematical failure if condition
is y(j)==0.01 !!!
j_int1=j;
elseif y(j)-0.011<1E-8
j_int2=j-1;
end

for k=1:nz
V_c(j,k)=dx*dz(k)*dy(j);
if y(j)>=0.01-1E-8 && y(j)<0.011-1E-8
Den(j,k)=(J_K_M+J_K_W+J_K_S)*V_c(j,k);
%Denominator Heat balance, Liquid
if k>=1 && k<k_max
Q(j,k)=Q1*dz(k)*dy(j)/(DZ1*0.001);
elseif k>=k_max
Q(j,k)=Q2*dz(k)*dy(j)/(DZ2*0.001);
end
else
Den(j,k)=Cp_glass*V_c(j,k)*ro_glass;
%Denominator Heat Balance, Glass
end
end
end

%Solver
T=zeros(ny,nz,2);
T(:,:,1)=ones(ny,nz,1)*T_ini;
t_inc=0.0002;
t=zeros(1,2);
time=zeros(200,1);
Temp=zeros(ny,nz,200);
time(1)=t(1);
Temp(:,:,1)=T(:,:,1);
pp=1;

i=1;
nstep=1;
INC=zeros(ny,nz);
Y=1;
be=0;
fail=0;


do=0;
reach=0;
in=0;
save1=0;
save2=0;
save3=0;

if DZ1==0
k_control=1;
else
k_control=k_max-2;
end

if get(handles.time,'value')==1

t_limit=str2double(get(handles.t_limit,'string'));
while t(i)<t_limit

i=i+1;
nstep=nstep+1;
t(i)=t(i-1)+t_inc;
k1=t_inc*derivative(T(:,:,i-1));
k2=t_inc*derivative(T(:,:,i-1)+(1/5)*k1);
k3=t_inc*derivative(T(:,:,i-1)+(3/40)*k1+(9/40)*k2);
k4=t_inc*derivative(T(:,:,i-1)+(3/10)*k1-
(9/10)*k2+(6/5)*k3);
k5=t_inc*derivative(T(:,:,i-1)-(11/54)*k1+(5/2)*k2-
(70/27)*k3+(35/27)*k4);
k6=t_inc*derivative(T(:,:,i-
1)+(1631/55296)*k1+(175/512)*k2+(575/13824)*k3+(44275/110592)
*k4+(253/4096)*k5);
T(:,:,i)=T(:,:,i-
1)+k1*2825/27648+k3*18575/48384+k4*13525/55296+k6*1/4+277/143
36*k5;

Delta1=(37/378-2825/27648)*k1+(250/621-
18575/48384)*k3+(125/594-13525/55296)*k4-
277/14336*k5+(512/1771-1/4)*k6;3E-4;
gru=max(max(max(T)))-min(min(min(T)));
if gru~=0
Delta0=gru*1E-6*ones(size(Delta1));
else
Delta0=1E-5*ones(size(Delta1));
end
for j=1:ny
for k=1:nz
if Delta1(j,k)==0
INC(j,k)=1E50;
else
INC(j,k)=Delta0(j,k)/Delta1(j,k);
end
end
end
t_inc=t_inc*(min(min(abs(INC)))).^0.2;
if t_inc>1
t_inc=1;
end

if (min(min(abs(INC))))<1
fail=fail+1;
end

%Data record
if t(i)<=2
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>2 && t(i)<=200 && save1==0 &&
mod(round(t(i)),2)==0
save1=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>200 && t(i)<=600 && save2==0 &&
mod(round(t(i)),4)==0
save2=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>600 && save3==0 && mod(round(t(i)),10)==0
save3=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
end



if mod(round(t(i)),2)==0
elseif save1==1;
save1=0;
end
if mod(round(t(i)),4)==0
elseif save2==1;
save2=0;
end
if mod(round(t(i)),10)==0
elseif save3==1;
save3=0;
end

%Control of the difference in heat generation:
if DeltaT0 ~=0 && mod(round(t(i)),2)==0 && do==0 &&
round(t(i))>0
do=1;
in=in+1;
Q=heat_rest(k1);
end

if mod(round(t(i)),2)==0
elseif do==1
do=0;
end

%Next step
if i==2
nstep=nstep+1;
i=1;
t(i)=t(2)+t_inc;
k1=t_inc*derivative(T(:,:,2));
k2=t_inc*derivative(T(:,:,2)+(1/5)*k1);
k3=t_inc*derivative(T(:,:,2)+(3/40)*k1+(9/40)*k2);
k4=t_inc*derivative(T(:,:,2)+(3/10)*k1-
(9/10)*k2+(6/5)*k3);
k5=t_inc*derivative(T(:,:,2)-(11/54)*k1+(5/2)*k2-
(70/27)*k3+(35/27)*k4);

k6=t_inc*derivative(T(:,:,2)+(1631/55296)*k1+(175/512)*k2+(57
5/13824)*k3+(44275/110592)*k4+(253/4096)*k5);

T(:,:,i)=T(:,:,2)+k1*2825/27648+k3*18575/48384+k4*13525/55296
+k6*1/4+277/14336*k5;

Delta1=(37/378-2825/27648)*k1+(250/621-
18575/48384)*k3+(125/594-13525/55296)*k4-
277/14336*k5+(512/1771-1/4)*k6;3E-4;

for j=1:ny
for k=1:nz
if Delta1(j,k)==0
INC(j,k)=1E50;
else
INC(j,k)=Delta0(j,k)/Delta1(j,k);
end
end
end
t_inc=t_inc*(min(min(abs(INC)))).^0.2;
if t_inc>1
t_inc=1;
end

if (min(min(abs(INC))))<1
fail=fail+1;
end

%Data record
if t(i)<=2
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>2 && t(i)<=200 && save1==0 &&
mod(round(t(i)),2)==0
save1=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>200 && t(i)<=600 && save2==0 &&
mod(round(t(i)),4)==0
save2=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);


elseif t(i)>600 && save3==0 && mod(round(t(i)),10)==0
save3=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
end

if mod(round(t(i)),2)==0
elseif save1==1;
save1=0;
end
if mod(round(t(i)),4)==0
elseif save2==1;
save2=0;
end
if mod(round(t(i)),10)==0
elseif save3==1;
save3=0;
end

%Control of the difference in heat generation:
if DeltaT0 ~=0 && mod(round(t(i)),2)==0 && do==0 &&
round(t(i))>0
do=1;
in=in+1;
Q=heat_rest(k1);
end

if mod(round(t(i)),2)==0
elseif do==1
do=0;
end

end
end

else

while Y>0.01

i=i+1;
nstep=nstep+1;
t(i)=t(i-1)+t_inc;
k1=t_inc*derivative(T(:,:,i-1));
k2=t_inc*derivative(T(:,:,i-1)+(1/5)*k1);
k3=t_inc*derivative(T(:,:,i-1)+(3/40)*k1+(9/40)*k2);
k4=t_inc*derivative(T(:,:,i-1)+(3/10)*k1-
(9/10)*k2+(6/5)*k3);
k5=t_inc*derivative(T(:,:,i-1)-(11/54)*k1+(5/2)*k2-
(70/27)*k3+(35/27)*k4);
k6=t_inc*derivative(T(:,:,i-
1)+(1631/55296)*k1+(175/512)*k2+(575/13824)*k3+(44275/110592)
*k4+(253/4096)*k5);
T(:,:,i)=T(:,:,i-
1)+k1*2825/27648+k3*18575/48384+k4*13525/55296+k6*1/4+277/143
36*k5;

if mod(round(t(i)),20)==0 && be==0
be=1;
T_ref1=T(:,:,i);
elseif mod(round(t(i)),20)==0 && be==2
be=0;
T_ref2=T(:,:,i);
Y=max(max(abs(T_ref2-T_ref1)));
end

if mod(round(t(i)),20)==0
elseif be==1
be=2;
end

Delta1=(37/378-2825/27648)*k1+(250/621-
18575/48384)*k3+(125/594-13525/55296)*k4-
277/14336*k5+(512/1771-1/4)*k6;3E-4;
gru=max(max(max(T)))-min(min(min(T)));
if gru~=0
Delta0=gru*1E-6*ones(size(Delta1));
else
Delta0=1E-5*ones(size(Delta1));
end
for j=1:ny
for k=1:nz
if Delta1(j,k)==0
INC(j,k)=1E50;
else


INC(j,k)=Delta0(j,k)/Delta1(j,k);
end
end
end
t_inc=t_inc*(min(min(abs(INC)))).^0.2;
if t_inc>1
t_inc=1;
end

if (min(min(abs(INC))))<1
fail=fail+1;
end

%Data record
if t(i)<=2
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>2 && t(i)<=200 && save1==0 &&
mod(round(t(i)),2)==0
save1=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>200 && t(i)<=600 && save2==0 &&
mod(round(t(i)),4)==0
save2=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>600 && save3==0 && mod(round(t(i)),10)==0
save3=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
end

if mod(round(t(i)),2)==0
elseif save1==1;
save1=0;
end
if mod(round(t(i)),4)==0
elseif save2==1;
save2=0;
end
if mod(round(t(i)),10)==0
elseif save3==1;
save3=0;
end

%Control of the difference in heat generation:
if DeltaT0 ~=0 && mod(round(t(i)),2)==0 && do==0 &&
round(t(i))>0
do=1;
in=in+1;
Q=heat_rest(k1);
end

if mod(round(t(i)),2)==0
elseif do==1
do=0;
end

if i==2
nstep=nstep+1;
i=1;
t(i)=t(2)+t_inc;
k1=t_inc*derivative(T(:,:,2));
k2=t_inc*derivative(T(:,:,2)+(1/5)*k1);
k3=t_inc*derivative(T(:,:,2)+(3/40)*k1+(9/40)*k2);
k4=t_inc*derivative(T(:,:,2)+(3/10)*k1-
(9/10)*k2+(6/5)*k3);
k5=t_inc*derivative(T(:,:,2)-(11/54)*k1+(5/2)*k2-
(70/27)*k3+(35/27)*k4);

k6=t_inc*derivative(T(:,:,2)+(1631/55296)*k1+(175/512)*k2+(57
5/13824)*k3+(44275/110592)*k4+(253/4096)*k5);

T(:,:,i)=T(:,:,2)+k1*2825/27648+k3*18575/48384+k4*13525/55296
+k6*1/4+277/14336*k5;

if mod(round(t(i)),20)==0 && be==0
be=1;
T_ref1=T(:,:,i);
elseif mod(round(t(i)),20)==0 && be==2
be=0;


T_ref2=T(:,:,i);
Y=max(max(abs(T_ref2-T_ref1)));
end

if mod(round(t(i)),20)==0
elseif be==1
be=2;
end

Delta1=(37/378-2825/27648)*k1+(250/621-
18575/48384)*k3+(125/594-13525/55296)*k4-
277/14336*k5+(512/1771-1/4)*k6;3E-4;

for j=1:ny
for k=1:nz
if Delta1(j,k)==0
INC(j,k)=1E50;
else
INC(j,k)=Delta0(j,k)/Delta1(j,k);
end
end
end
t_inc=t_inc*(min(min(abs(INC)))).^0.2;
if t_inc>1
t_inc=1;
end

if (min(min(abs(INC))))<1
fail=fail+1;
end

%Data record
if t(i)<=2
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>2 && t(i)<=200 && save1==0 &&
mod(round(t(i)),2)==0
save1=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>200 && t(i)<=600 && save2==0 &&
mod(round(t(i)),4)==0
save2=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>600 && save3==0 && mod(round(t(i)),10)==0
save3=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
end

if mod(round(t(i)),2)==0
elseif save1==1;
save1=0;
end
if mod(round(t(i)),4)==0
elseif save2==1;
save2=0;
end
if mod(round(t(i)),10)==0
elseif save3==1;
save3=0;
end

%Control of the difference in heat generation:
if DeltaT0 ~=0 && mod(round(t(i)),2)==0 && do==0 &&
round(t(i))>0
do=1;
in=in+1;
Q=heat_rest(k1);
end

if mod(round(t(i)),2)==0
elseif do==1
do=0;
end

if t(i)>1800
Y=0;
msgbox('Simulation was stopped when time was 1800
seconds, for avoiding an endless loop','Error','warn')


end
end

end
end

set(handles.t_limit,'string',t(i))
set(handles.intensity,'string',round(I_real*1E6)/1E6)

%Temperature profile, steady state
T_prof=T(1:ny,1:nz,1)';
Y=y(1:ny)+diff(y)/2;
Z=z(1:nz)+diff(z)/2;
[y,z]=meshgrid(Y,Z); %Array
subplot(handles.profile)
surf(y(1:nz,1:ny),z(1:nz,1:ny),T_prof,'EdgeColor','none');xla
bel('y');ylabel('z');zlabel('Temperature');rotate3d on

%Frontal view
if popstencil==1
dy=0.015/ny;
dz=0.2/nz;
dx=0.065;
y=0:dy:0.015;
z=0:dz:0.2;
x=0:dx:0.065;
else
dy=0.00025;
dz=0.004;
dx=0.065;
x=0:dx:0.065;
y=[0 dy/2 dy:dy:4*dy 6*dy 8*dy:3*dy:32*dy 34*dy
36*dy:dy:39*dy 39.5*dy 40*dy:dy/4:44*dy 44.5*dy
45*dy:dy:48*dy 50*dy:2*dy:56*dy 57*dy:dy:59*dy 59.5*dy
60*dy];
z=[0 dz/10 dz/5:dz/5:dz 1.5*dz:0.5*dz:10*dz
11*dz:dz:19*dz 20*dz:3*dz:50*dz];
end
Ti(1:nz,1)=T(j_int1,1:nz,1);
Ti(1:nz,2)=T(j_int1,1:nz,1);
Z=z(1:nz)+diff(z)/2;
subplot(handles.front_im)
[x,z]=meshgrid(x,Z);
surface(x(1:nz,:),z(1:nz,:),(min(min(Ti))-
0.5)*ones(size(Ti)),'EdgeColor','none')
surface(x(1:nz,:),z(1:nz,:),Ti,'EdgeColor','none');xlabel('x'
);ylabel('z');zlabel('Temperature');colorbar

if popstencil==1
z=0:dz:0.2;
x=0:dx:0.065;
else
x=0:dx:0.065;
z=[0 dz/10 dz/5:dz/5:dz 1.5*dz:0.5*dz:10*dz
11*dz:dz:19*dz 20*dz:3*dz:50*dz];
end

else
msgbox('Time must be a real positive number, your suggestion
is physically imposible.','Input error','error')
end
else
msgbox('Sorry, but both voltage and electrical current must
be positive','Input error','error')
end
else
msgbox('Please, make sure you fill all the required
fields.','Input error','error')
end
toc











function varargout = Parameter_Study(varargin)
% Last Modified by GUIDE v2.5 29-Jul-2011 14:57:48

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn',
@Parameter_Study_OpeningFcn, ...
'gui_OutputFcn',
@Parameter_Study_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State,
varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Parameter_Study is made visible.
function Parameter_Study_OpeningFcn(hObject, eventdata,
handles, varargin)
global ratio k_g Eps k_sil Cp_water Cp_methanol k_air Cp_air
ro_air k_cool
global ro_glass Cp_glass ro_sil Cp_sil Cond ro x_w_m nu k_liq
nu_air
global h_air last matrix vary numberfile totalcases

numberfile=0;
totalcases=0;
set(handles.k_glass,'string',k_g)
set(handles.ro_glass,'string',ro_glass)
set(handles.Cp_glass,'string',Cp_glass)
set(handles.k_out,'string',k_air)
set(handles.ro_air,'string',ro_air)
set(handles.Cp_air,'string',Cp_air)
set(handles.k_sil,'string',k_sil)
set(handles.ro_sil,'string',ro_sil)
set(handles.Cp_sil,'string',Cp_sil)
set(handles.Cp_water,'string',Cp_water)
set(handles.Cp_methanol,'string',Cp_methanol)
set(handles.Cond,'string',Cond)
set(handles.Eps,'string',Eps)
set(handles.k_cool,'string',k_cool)
set(handles.ro_mix,'string',ro);
set(handles.x_w_m,'string',x_w_m);
set(handles.nu_mix,'string',nu);
set(handles.k_mix,'string',k_liq);
set(handles.nu_air,'string',nu_air);
set(handles.h_air,'string',h_air);

switch ratio
case 4
set(handles.popup_ratio,'value',1)
case 6
set(handles.popup_ratio,'value',2)
case 8
set(handles.popup_ratio,'value',3)
case 'Other'
set(handles.popup_ratio,'value',4)
end

last=zeros(1,24);
matrix=0;
vary=0;

% Choose default command line output for Parameter_Study
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% --- Outputs from this function are returned to the command
line.
function varargout = Parameter_Study_OutputFcn(hObject,
eventdata, handles)
varargout{1} = handles.output;



% --- Executes on button press in push_std.
function push_std_Callback(hObject, eventdata, handles)
global k_g_std Eps_std k_sil_std Cp_water_std Cp_methanol_std
k_air_std
global Cp_air_std ro_air_std k_cool_std ro_glass_std
Cp_glass_std
global ro_sil_std Cp_sil_std Cond_std nu_air_std h_air_std

set(handles.k_glass,'string',num2str(k_g_std))
set(handles.ro_glass,'string',num2str(ro_glass_std))
set(handles.Cp_glass,'string',num2str(Cp_glass_std))
set(handles.k_out,'string',num2str(k_air_std))
set(handles.ro_air,'string',num2str(ro_air_std))
set(handles.Cp_air,'string',num2str(Cp_air_std))
set(handles.k_sil,'string',num2str(k_sil_std))
set(handles.ro_sil,'string',num2str(ro_sil_std))
set(handles.Cp_sil,'string',num2str(Cp_sil_std))
set(handles.Cp_water,'string',num2str(Cp_water_std))
set(handles.Cp_methanol,'string',num2str(Cp_methanol_std))
set(handles.Cond,'string',num2str(Cond_std))
set(handles.popup_ratio,'value',2)
set(handles.Eps,'string',num2str(Eps_std))
set(handles.k_cool,'string',num2str(k_cool_std))
set(handles.ro_mix,'string',850)
set(handles.x_w_m,'string',0.8)
set(handles.nu_mix,'string',1.4E-3)
set(handles.k_mix,'string',0.27)
set(handles.ro_mix,'enable','off')
set(handles.x_w_m,'enable','off')
set(handles.nu_mix,'enable','off')
set(handles.k_mix,'enable','off')
set(handles.nu_air,'string',num2str(nu_air_std))
set(handles.h_air,'string',num2str(h_air_std));

% --- Executes on selection change in popup_ratio.
function popup_ratio_Callback(hObject, eventdata, handles)
switch get(hObject,'Value')
case 1
set(handles.ro_mix,'string',866);
set(handles.x_w_m,'string',0.735);
set(handles.nu_mix,'string',1.6E-3);
set(handles.k_mix,'string',0.29);
set(handles.ro_mix,'enable','off');
set(handles.x_w_m,'enable','off');
set(handles.nu_mix,'enable','off');
set(handles.k_mix,'enable','off');
case 2
set(handles.ro_mix,'string',850);
set(handles.x_w_m,'string',0.8);
set(handles.nu_mix,'string',1.4E-3);
set(handles.k_mix,'string',0.27);
set(handles.ro_mix,'enable','off');
set(handles.x_w_m,'enable','off');
set(handles.nu_mix,'enable','off');
set(handles.k_mix,'enable','off');
case 3
set(handles.ro_mix,'string',840);
set(handles.x_w_m,'string',0.84);
set(handles.nu_mix,'string',1.25E-3);
set(handles.k_mix,'string',0.26);
set(handles.ro_mix,'enable','off');
set(handles.x_w_m,'enable','off');
set(handles.nu_mix,'enable','off');
set(handles.k_mix,'enable','off');
case 4
set(handles.ro_mix,'string','');
set(handles.x_w_m,'string','');
set(handles.nu_mix,'string','');
set(handles.k_mix,'string','');
set(handles.ro_mix,'enable','on');
set(handles.x_w_m,'enable','on');
set(handles.nu_mix,'enable','on');
set(handles.k_mix,'enable','on');
end

% --- Executes on button press in push_apply.
function push_apply_Callback(hObject, eventdata, handles)
global ratio k_g_ Eps_ k_sil_ Cp_water_ Cp_methanol_ k_air_
Cp_air_ ro_air_ k_cool_
global ro_glass_ Cp_glass_ ro_sil_ Cp_sil_ Cond_ ro_ x_w_m_
nu_ k_liq_ nu_air_ U_
global T_out_ T_cool_ t_limit_ vary h_air_ matrix last

switch get(handles.popup_ratio,'value')
case 1


ratio=4;
case 2
ratio=6;
case 3
ratio=8;
case 4
ratio='Other';
end

column='';
U_=str2double(get(handles.voltage,'string'));
if isnan(U_)
vary(1)=1;
column=[column; 'Potential applied '];
end
T_out_=str2double(get(handles.airtemperature,'string'));
if isnan(T_out_)
vary(2)=1;
column=[column; 'Air temperature '];
end
T_cool_=str2double(get(handles.coolingtemperature,'string'));
if isnan(T_cool_)
vary(3)=1;
column=[column; 'Cooling temperature'];
end
t_limit_=str2double(get(handles.t_limit,'string'));
if isnan(t_limit_)
vary(4)=1;
column=[column; 'Transcurred time '];
end
k_g_=str2double(get(handles.k_glass,'string'));
if isnan(k_g_)
vary(5)=1;
column=[column; 'Glass conductivity '];
end
ro_glass_=str2double(get(handles.ro_glass,'string'));
if isnan(ro_glass_)
vary(6)=1;
column=[column; 'Glass density '];
end
Cp_glass_=str2double(get(handles.Cp_glass,'string'));
if isnan(Cp_glass_)
vary(7)=1;
column=[column; 'Glass Cp '];
end
k_air_=str2double(get(handles.k_out,'string'));
if isnan(k_air_)
vary(8)=1;
column=[column; 'Air conductivity '];
end
ro_air_=str2double(get(handles.ro_air,'string'));
if isnan(ro_air_)
vary(9)=1;
column=[column; 'Air density '];
end
Cp_air_=str2double(get(handles.Cp_air,'string'));
if isnan(Cp_air_)
vary(10)=1;
column=[column; 'Air Cp '];
end
k_sil_=str2double(get(handles.k_sil,'string'));
if isnan(k_sil_)
vary(11)=1;
column=[column; 'Silica conductivity'];
end
ro_sil_=str2double(get(handles.ro_sil,'string'));
if isnan(ro_sil_)
vary(12)=1;
column=[column; 'Silica density '];
end
Cp_sil_=str2double(get(handles.Cp_sil,'string'));
if isnan(Cp_sil_)
vary(13)=1;
column=[column; 'Silica Cp '];
end
Cp_water_=str2double(get(handles.Cp_water,'string'));
if isnan(Cp_water_)
vary(14)=1;
column=[column; 'Water Cp '];
end
Cp_methanol_=str2double(get(handles.Cp_methanol,'string'));
if isnan(Cp_methanol_)
vary(15)=1;
column=[column; 'Methanol Cp '];
end
Cond_=str2double(get(handles.Cond,'string'));


if isnan(Cond_)
vary(16)=1;
column=[column; 'Electric conductiv.'];
end
ro_=str2double(get(handles.ro_mix,'string'));
if isnan(ro_)
vary(17)=1;
column=[column; 'Liquid density '];
end
x_w_m_=str2double(get(handles.x_w_m,'string'));
if isnan(x_w_m_)
vary(18)=1;
column=[column; 'Meth. mass fraction'];
end
nu_=str2double(get(handles.nu_mix,'string'));
if isnan(nu_)
vary(19)=1;
column=[column; 'Liquid viscosity '];
end
k_liq_=str2double(get(handles.k_mix,'string'));
if isnan(k_liq_)
vary(20)=1;
column=[column; 'Liquid conductivity'];
end
Eps_=str2double(get(handles.Eps,'string'));
if isnan(Eps_)
vary(21)=1;
column=[column; 'Porosity '];
end
k_cool_=str2double(get(handles.k_cool,'string'));
if isnan(k_cool_)
vary(22)=1;
column=[column; 'Cooling conductiv. '];
end
h_air_=str2double(get(handles.h_air,'string'));
if isnan(h_air_)
vary(23)=1;
column=[column; 'Air convection coef'];
end
nu_air_=str2double(get(handles.nu_air,'string'));
if isnan(nu_air_)
vary(24)=1;
column=[column; 'Air viscosity '];
else
vary(24)=0;
end
set(handles.tab,'ColumnName',column);
set(handles.list,'string',column);
matrix=0;
last=zeros(1,24);
set(handles.tab,'Data',matrix);

% --- Executes on button press in push_cancel.
function push_cancel_Callback(hObject, eventdata, handles)
close

% --- Executes on button press in push_add.
function push_add_Callback(hObject, eventdata, handles)
global last matrix vary totalcases

last(get(handles.list,'value'))=last(get(handles.list,'value'
))+1;
matrix(last(get(handles.list,'value')),get(handles.list,'valu
e'))=str2double(get(handles.add,'string'));
set(handles.tab,'Data',matrix);
totalcases=1;
for i=1:sum(vary)
totalcases=totalcases*last(i);
end
message=['With the specified conditions, it is necessary to
simulate ' num2str(totalcases) ' cases.'];
set(handles.cases,'string',message);
set(handles.add,'string','');

% --- Executes on button press in push_clear.
function push_clear_Callback(hObject, eventdata, handles)
global last matrix vary
matrix(1:last(get(handles.list,'value')),get(handles.list,'va
lue'))=zeros(1:last(get(handles.list,'value')),1);
last(get(handles.list,'value'))=0;
set(handles.tab,'Data',matrix);
totalcases=1;
for i=1:sum(vary)
totalcases=totalcases*last(i);
end


message=['With the specified conditions, it is necessary to
simulate ' num2str(totalcases) ' cases.'];
set(handles.cases,'string',message);
set(handles.add,'string','');

% --- Executes on selection change in popup_stencil.
function popup_stencil_Callback(hObject, eventdata, handles)
switch get(handles.popup_stencil,'value')
case 1
set(handles.ny,'enable','on')
set(handles.nz,'enable','on')
case 2
set(handles.ny,'enable','off')
set(handles.nz,'enable','off')
set(handles.ny,'string',52)
set(handles.nz,'string',44)
end

% --- Executes on button press in execute.
function execute_Callback(hObject, eventdata, handles)
global k_g_ Eps_ k_sil_ Cp_water_ Cp_methanol_ k_air_ Cp_air_
ro_air_
global ro_glass_ Cp_glass_ ro_sil_ Cp_sil_ Cond_ ro_ x_w_m_
nu_ k_liq_ nu_air_
global T_out_ T_cool_ T_ini t_limit_ h_air_ matrix last k_mix
U_
global Eps Cp_water Cp_methanol k_cool ro_glass Cp_glass
ro_sil k_cool_
global Cp_sil Cond ro x_w_m U I_real T_out T_cool numberfile
global h_cool dz dy dx ny nz A_y A_z Den Q t_limit totalcases
global z y Length popstencil time Temp T t pp

if totalcases==0
msgbox('You have to specify a value for all
parameters.','Input error','warn')
else

if get(handles.popup_stencil,'value')==2 ||
(get(handles.popup_stencil,'value')==1 &&
str2double(get(handles.ny,'string'))>0 &&
str2double(get(handles.nz,'string'))>1 &&
mod(str2double(get(handles.ny,'string')),15)==0)

answer=inputdlg('Save cases as:','Save');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
save_as=['Save_data\' answer.name];

i=1;
if isnan(U_)
U_=matrix(:,i);
aa=last(i);
i=i+1;
else
aa=1;
end
if isnan(T_out_)
T_out_=matrix(:,i);
ab=last(i);
i=i+1;
else
ab=1;
end
if isnan(T_cool_)
T_cool_=matrix(:,i);
ac=last(i);
i=i+1;
else
ac=1;
end
if isnan(t_limit_)
t_limit_=matrix(:,i);
ad=last(i);
i=i+1;
else
ad=1;
end
if isnan(k_g_)
k_g_=matrix(:,i);
ae=last(i);
i=i+1;
else
ae=1;
end


if isnan(ro_glass_)
ro_glass_=matrix(:,i);
af=last(i);
i=i+1;
else
af=1;
end
if isnan(Cp_glass_)
Cp_glass_=matrix(:,i);
ag=last(i);
i=i+1;
else
ag=1;
end
if isnan(k_air_)
k_air_=matrix(:,i);
ah=last(i);
i=i+1;
else
ah=1;
end
if isnan(ro_air_)
ro_air_=matrix(:,i);
ai=last(i);
i=i+1;
else
ai=1;
end
if isnan(Cp_air_)
Cp_air_=matrix(:,i);
aj=last(i);
i=i+1;
else
aj=1;
end
if isnan(k_sil_)
k_sil_=matrix(:,i);
ak=last(i);
i=i+1;
else
ak=1;
end
if isnan(ro_sil_)
ro_sil_=matrix(:,i);
al=last(i);
i=i+1;
else
al=1;
end
if isnan(Cp_sil_)
Cp_sil_=matrix(:,i);
am=last(i);
i=i+1;
else
am=1;
end
if isnan(Cp_water_)
Cp_water_=matrix(:,i);
an=last(i);
i=i+1;
else
an=1;
end
if isnan(Cp_methanol_)
Cp_methanol_=matrix(:,i);
ao=last(i);
i=i+1;
else
ao=1;
end
if isnan(Cond_)
Cond_=matrix(:,i);
ap=last(i);
i=i+1;
else
ap=1;
end
if isnan(ro_)
ro_=matrix(:,i);
aq=last(i);
i=i+1;
else
aq=1;
end
if isnan(x_w_m_)
x_w_m_=matrix(:,i);


ar=last(i);
i=i+1;
else
ar=1;
end
if isnan(nu_)
nu_=matrix(:,i);
as=last(i);
i=i+1;
else
as=1;
end
if isnan(k_liq_)
k_liq_=matrix(:,i);
at=last(i);
i=i+1;
else
at=1;
end
if isnan(Eps_)
Eps_=matrix(:,i);
au=last(i);
i=i+1;
else
au=1;
end
if isnan(k_cool_)
k_cool_=matrix(:,i);
av=last(i);
i=i+1;
else
av=1;
end
if isnan(h_air_)
h_air_=matrix(:,i);
aw=last(i);
i=i+1;
else
aw=1;
end
if isnan(nu_air_)
nu_air_=matrix(:,i);
ax=last(i);
else
ax=1;
end

ny=str2double(get(handles.ny,'string'));
nz=str2double(get(handles.nz,'string'));

for ba=1:aa
for bb=1:ab
for bc=1:ac
for bd=1:ad
for be=1:ae
for bf=1:af
for bg=1:ag
for bh=1:ah
for bi=1:ai
for bj=1:aj
for bk=1:ak
for bl=1:al
for bm=1:am
for bn=1:an
for bo=1:ao
for bp=1:ap
for bq=1:aq
for br=1:ar
for bs=1:as
for bt=1:at
for bu=1:au
for bv=1:av
for bw=1:aw
for bx=1:ax
tic

switch get(handles.popup_stencil,'value')
case 1
dy=0.015/ny;
dz=0.2/nz;
dx=0.065;
y=0:dy:0.015; % Y position vector, m
z=0:dz:0.2; % Z position vector, m
popstencil=1;
case 2
dy=0.00025;


dz=0.004;
dx=0.065;
y=[0 dy/2 dy:dy:4*dy 6*dy 8*dy:3*dy:32*dy 34*dy
36*dy:dy:39*dy 39.5*dy 40*dy:dy/4:44*dy 44.5*dy
45*dy:dy:48*dy 50*dy:2*dy:56*dy 57*dy:dy:59*dy 59.5*dy
60*dy];
z=[0 dz/10 dz/5:dz/5:dz 1.5*dz:0.5*dz:10*dz
11*dz:dz:19*dz 20*dz:3*dz:50*dz];
popstencil=2;
end

numberfile=numberfile+1;
U=U_(ba);
T_out=T_out_(bb);
T_cool=T_cool_(bc);
t_limit=t_limit_(bd);
k_g=k_g_(be);
ro_glass=ro_glass_(bf);
Cp_glass=Cp_glass_(bg);
k_air=k_air_(bh);
ro_air=ro_air_(bi);
Cp_air=Cp_air_(bj);
k_sil=k_sil_(bk);
ro_sil=ro_sil_(bl);
Cp_sil=Cp_sil_(bm);
Cp_water=Cp_water_(bn);
Cp_methanol=Cp_methanol_(bo);
Cond=Cond_(bp);
ro=ro_(bq);
x_w_m=x_w_m_(br);
nu=nu_(bs);
k_liq=k_liq_(bt);
Eps=Eps_(bu);
k_cool=k_cool_(bv);
h_air=h_air_(bw);
nu_air=nu_air_(bx);

T_ini=T_cool*0.8+T_out*0.2;
I_real=(U*Cond*0.001*0.065*Eps)/0.2;
Length=0.2;

if get(handles.volint,'value')==1
R=30E-6; %Particle radio, m
dr=1E-7;
r=0;
area_k=0;
i=1;
func=zeros(1,100);
while r<=R
func(i)=r/((R-(R^2-r^2)^0.5)/k_liq+(R^2-
r^2)^0.5/k_sil); %Function for integration
if i>1
increase=func(i-1)*dr+(func(i)-func(i-1))*dr/2;
area_k=area_k+increase;
end
i=i+1;
r=r+dr;
end
k_mix=(2/R)*area_k;
else
k_mix=k_liq*Eps+k_sil*(1-Eps);
end

%Heat transfer coefficient, cooling exchange:
Deq=2*0.0054*0.001/(0.0054+0.001);
u_inf=0.84;
Pr_cool=4180*1.3E-3/k_cool;
Re_cool=1000*u_inf*Deq/1.3E-3;
Gz_cool=Re_cool*Pr_cool*(Deq/Length);
if Re_cool>10000
Nu_cool=3.66+0.085*Gz_cool/(1+0.047*Gz_cool^0.66);
else
Nu_cool=4.36;
end
h_cool=k_cool*Nu_cool/Deq; %W/(m2*K)

dy=diff(y);
dz=diff(z);

% Heat Generation
A_y=dx*dz;
A_z=dx*dy;
Cond=I_real*0.2/(U*0.001*0.065*Eps);

Length_heat=(0.856636*U/1000+2.403893*I_real*1000-
2.15892*(I_real*1000)^2+0.416072*(I_real*1000)^3-0.2179)/100;


if Length_heat<0.015
Length_heat=0;
elseif Length_heat>0.07
Length_heat=0;
end

if Length_heat==0
DeltaT0=0;
else
DeltaT0=5.567703-3.54284*U/1000-
3.56301*I_real*1000+1.96067*U*I_real+0.418898*(U/1000)^3-
0.07157*(U/1000)^4;
end

k_max=1;
while z(k_max)<Length_heat
k_max=k_max+1;
end
DZ1=sum(dz(1:k_max-1));
DZ2=sum(dz(k_max:end));

Q=zeros(ny,nz);
Q_joule=U*I_real;
Q1=Q_joule*DZ1/Length;
Q2=Q_joule*(1-DZ1/Length);

%Joules/Kelvin: Liquid and glass
J_K_M=Cp_methanol*Eps*ro*x_w_m; %Methanol
J/(K*m3)
J_K_W=Cp_water*Eps*ro*(1-x_w_m); %Water, "
J_K_S=Cp_sil*(1-Eps)*ro_sil; %Silica, "

V_c=zeros(ny,nz);
for j=1:ny
if y(j)-0.01<1E-8 %Mathematical failure if condition
is y(j)==0.01 !!!
j_int1=j;
elseif y(j)-0.011<1E-8
j_int2=j-1;
end

for k=1:nz
V_c(j,k)=dx*dz(k)*dy(j);
if y(j)>=0.01-1E-8 && y(j)<0.011-1E-8
Den(j,k)=(J_K_M+J_K_W+J_K_S)*V_c(j,k);
%Denominator Heat balance, Liquid
if k>=1 && k<k_max
Q(j,k)=Q1*dz(k)*dy(j)/(DZ1*0.001);
elseif k>=k_max
Q(j,k)=Q2*dz(k)*dy(j)/(DZ2*0.001);
end
else
Den(j,k)=Cp_glass*V_c(j,k)*ro_glass;
%Denominator Heat Balance, Glass
end
end
end

%Solver
T=zeros(ny,nz,2);
T(:,:,1)=ones(ny,nz,1)*T_ini;
t_inc=0.0002;
t=zeros(1,2);
time=zeros(200,1);
Temp=zeros(ny,nz,200);
time(1)=t(1);
Temp(:,:,1)=T(:,:,1);
pp=1;

i=1;
INC=zeros(ny,nz);
do=0;
save1=0;
save2=0;
save3=0;

if DZ1==0
k_control=1;
else
k_control=k_max-2;
end

while t(i)<t_limit



i=i+1;
t(i)=t(i-1)+t_inc;
k1=t_inc*derivative(T(:,:,i-1));
k2=t_inc*derivative(T(:,:,i-1)+(1/5)*k1);
k3=t_inc*derivative(T(:,:,i-1)+(3/40)*k1+(9/40)*k2);
k4=t_inc*derivative(T(:,:,i-1)+(3/10)*k1-
(9/10)*k2+(6/5)*k3);
k5=t_inc*derivative(T(:,:,i-1)-(11/54)*k1+(5/2)*k2-
(70/27)*k3+(35/27)*k4);
k6=t_inc*derivative(T(:,:,i-
1)+(1631/55296)*k1+(175/512)*k2+(575/13824)*k3+(44275/110592)
*k4+(253/4096)*k5);
T(:,:,i)=T(:,:,i-
1)+k1*2825/27648+k3*18575/48384+k4*13525/55296+k6*1/4+277/143
36*k5;

Delta1=(37/378-2825/27648)*k1+(250/621-
18575/48384)*k3+(125/594-13525/55296)*k4-
277/14336*k5+(512/1771-1/4)*k6;3E-4;
gru=max(max(max(T)))-min(min(min(T)));
if gru~=0
Delta0=gru*1E-6*ones(size(Delta1));
else
Delta0=1E-5*ones(size(Delta1));
end
for j=1:ny
for k=1:nz
if Delta1(j,k)==0
INC(j,k)=1E50;
else
INC(j,k)=Delta0(j,k)/Delta1(j,k);
end
end
end
t_inc=t_inc*(min(min(abs(INC)))).^0.2;
if t_inc>1
t_inc=1;
end

%Data record
if t(i)<=2
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>2 && t(i)<=200 && save1==0 &&
mod(round(t(i)),2)==0
save1=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>200 && t(i)<=600 && save2==0 &&
mod(round(t(i)),4)==0
save2=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>600 && save3==0 && mod(round(t(i)),10)==0
save3=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
end

if mod(round(t(i)),2)==0
elseif save1==1;
save1=0;
end
if mod(round(t(i)),4)==0
elseif save2==1;
save2=0;
end
if mod(round(t(i)),10)==0
elseif save3==1;
save3=0;
end

%Control of the difference in heat generation:
if DeltaT0 ~=0 && mod(round(t(i)),2)==0 && do==0 &&
round(t(i))>0
do=1;
in=in+1;
Q=heat_rest(k1);
end

if mod(round(t(i)),2)==0
elseif do==1


do=0;
end

if i==2
i=1;
t(i)=t(2)+t_inc;
k1=t_inc*derivative(T(:,:,2));
k2=t_inc*derivative(T(:,:,2)+(1/5)*k1);
k3=t_inc*derivative(T(:,:,2)+(3/40)*k1+(9/40)*k2);
k4=t_inc*derivative(T(:,:,2)+(3/10)*k1-
(9/10)*k2+(6/5)*k3);
k5=t_inc*derivative(T(:,:,2)-(11/54)*k1+(5/2)*k2-
(70/27)*k3+(35/27)*k4);

k6=t_inc*derivative(T(:,:,2)+(1631/55296)*k1+(175/512)*k2+(57
5/13824)*k3+(44275/110592)*k4+(253/4096)*k5);

T(:,:,i)=T(:,:,2)+k1*2825/27648+k3*18575/48384+k4*13525/55296
+k6*1/4+277/14336*k5;

Delta1=(37/378-2825/27648)*k1+(250/621-
18575/48384)*k3+(125/594-13525/55296)*k4-
277/14336*k5+(512/1771-1/4)*k6;3E-4;

for j=1:ny
for k=1:nz
if Delta1(j,k)==0
INC(j,k)=1E50;
else
INC(j,k)=Delta0(j,k)/Delta1(j,k);
end
end
end
t_inc=t_inc*(min(min(abs(INC)))).^0.2;
if t_inc>1
t_inc=1;
end

%Data record
if t(i)<=2
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>2 && t(i)<=200 && save1==0 &&
mod(round(t(i)),2)==0
save1=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>200 && t(i)<=600 && save2==0 &&
mod(round(t(i)),4)==0
save2=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
elseif t(i)>600 && save3==0 && mod(round(t(i)),10)==0
save3=1;
pp=pp+1;
time(pp)=t(i);
Temp(:,:,pp)=T(:,:,i);
end

if mod(round(t(i)),2)==0
elseif save1==1;
save1=0;
end
if mod(round(t(i)),4)==0
elseif save2==1;
save2=0;
end
if mod(round(t(i)),10)==0
elseif save3==1;
save3=0;
end

%Control of the difference in heat generation:
if DeltaT0 ~=0 && mod(round(t(i)),2)==0 && do==0 &&
round(t(i))>0
do=1;
in=in+1;
Q=heat_rest(k1);
end

if mod(round(t(i)),2)==0
elseif do==1
do=0;


end

end
end

%Temperature profile, steady state
T_prof=T(1:ny,1:nz,1)';
clear Y
clear Z
Y=y(1:ny)+diff(y)/2;
Z=z(1:nz)+diff(z)/2;
[y,z]=meshgrid(Y,Z); %Array
figure
surf(y(1:nz,1:ny),z(1:nz,1:ny),T_prof,'EdgeColor','none');xla
bel('y');ylabel('z');zlabel('Temperature');rotate3d on
filename=[save_as num2str(numberfile) 'figure.fig'];
saveas(gcf,filename,'fig');
close

filename=[save_as num2str(numberfile) 'data.xls'];
xlswrite(filename,T(:,:,1),'Temperature in blocks')
variablename={'Potential applied '; 'Air temperature ';
'Cooling temperature'; 'Transcurred time '; 'Glass
conductivity '; 'Glass density '; 'Glass Cp ';
'Air conductivity '; 'Air density '; 'Air Cp
'; 'Silica conductivity'; 'Silica density '; 'Silica Cp
'; 'Water Cp '; 'Methanol Cp '; 'Electric
conductiv.'; 'Liquid density '; 'Meth. mass fraction';
'Liquid viscosity '; 'Liquid conductivity'; 'Porosity
'; 'Cooling conductiv. '; 'Air convection coef'; 'Air
viscosity '; 'Electric current '};
xlswrite(filename,variablename,'Parameters','B1:B25');
variablevalue=[U; T_out; T_cool; t_limit; k_g; ro_glass;
Cp_glass; k_air; ro_air; Cp_air; k_sil; ro_sil; Cp_sil;
Cp_water; Cp_methanol; Cond; ro; x_w_m; nu; k_liq; Eps;
k_cool; h_air; nu_air; I_real];
xlswrite(filename,variablevalue,'Parameters','A1:A25');
toc

end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
set(handles.execute,'enable','off')
msgbox('Parameters Study finished','Done')

else
msgbox('Fixed Size Stencil requires that the number of
points along y-axis to be a multiple of 15. Any natural
number bigger than 1 is valid along z-axis.','Error','warn')
end
end
end









function varargout = Parameters(varargin)
% Last Modified by GUIDE v2.5 19-Jul-2011 05:02:48

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @parameters_OpeningFcn,
...
'gui_OutputFcn', @parameters_OutputFcn,
...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State,
varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Parameters is made visible.
function parameters_OpeningFcn(hObject, eventdata, handles,
varargin)

global ratio k_g Eps k_sil Cp_water Cp_methanol k_air Cp_air
ro_air k_cool
global ro_glass Cp_glass ro_sil Cp_sil Cond ro x_w_m nu k_liq
nu_air

set(handles.k_glass,'string',k_g)
set(handles.ro_glass,'string',ro_glass)
set(handles.Cp_glass,'string',Cp_glass)
set(handles.k_out,'string',k_air)
set(handles.ro_air,'string',ro_air)
set(handles.Cp_air,'string',Cp_air)
set(handles.k_sil,'string',k_sil)
set(handles.ro_sil,'string',ro_sil)
set(handles.Cp_sil,'string',Cp_sil)
set(handles.Cp_water,'string',Cp_water)
set(handles.Cp_methanol,'string',Cp_methanol)
set(handles.Cond,'string',Cond)
set(handles.Eps,'string',Eps)
set(handles.k_cool,'string',k_cool)
set(handles.ro_mix,'string',ro);
set(handles.x_w_m,'string',x_w_m);
set(handles.nu_mix,'string',nu);
set(handles.k_mix,'string',k_liq);
set(handles.nu_air,'string',nu_air);

switch ratio
case 4
set(handles.popup_ratio,'value',1)
case 6
set(handles.popup_ratio,'value',2)
case 8
set(handles.popup_ratio,'value',3)
case 'Other'
set(handles.popup_ratio,'value',4)
end

% Choose default command line output for parameters
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% --- Outputs from this function are returned to the command
line.
function varargout = parameters_OutputFcn(hObject, eventdata,
handles)
varargout{1} = handles.output;

% --- Executes on button press in push_std.
function push_std_Callback(hObject, eventdata, handles)
global k_g_std Eps_std k_sil_std Cp_water_std Cp_methanol_std
k_air_std
global Cp_air_std ro_air_std k_cool_std ro_glass_std
Cp_glass_std


global ro_sil_std Cp_sil_std Cond_std nu_air_std

set(handles.k_glass,'string',num2str(k_g_std))
set(handles.ro_glass,'string',num2str(ro_glass_std))
set(handles.Cp_glass,'string',num2str(Cp_glass_std))
set(handles.k_out,'string',num2str(k_air_std))
set(handles.ro_air,'string',num2str(ro_air_std))
set(handles.Cp_air,'string',num2str(Cp_air_std))
set(handles.k_sil,'string',num2str(k_sil_std))
set(handles.ro_sil,'string',num2str(ro_sil_std))
set(handles.Cp_sil,'string',num2str(Cp_sil_std))
set(handles.Cp_water,'string',num2str(Cp_water_std))
set(handles.Cp_methanol,'string',num2str(Cp_methanol_std))
set(handles.Cond,'string',num2str(Cond_std))
set(handles.popup_ratio,'value',2)
set(handles.Eps,'string',num2str(Eps_std))
set(handles.k_cool,'string',num2str(k_cool_std))
set(handles.ro_mix,'string',850)
set(handles.x_w_m,'string',0.8)
set(handles.nu_mix,'string',1.4E-3)
set(handles.k_mix,'string',0.27)
set(handles.ro_mix,'enable','off')
set(handles.x_w_m,'enable','off')
set(handles.nu_mix,'enable','off')
set(handles.k_mix,'enable','off')
set(handles.nu_air,'string',num2str(nu_air_std))

%Executes when change popup_ratio
function popup_ratio_Callback(hObject, eventdata, handles)
switch get(hObject,'Value')
case 1
set(handles.ro_mix,'string',866);
set(handles.x_w_m,'string',0.735);
set(handles.nu_mix,'string',1.6E-3);
set(handles.k_mix,'string',0.29);
set(handles.ro_mix,'enable','off');
set(handles.x_w_m,'enable','off');
set(handles.nu_mix,'enable','off');
set(handles.k_mix,'enable','off');
case 2
set(handles.ro_mix,'string',850);
set(handles.x_w_m,'string',0.8);
set(handles.nu_mix,'string',1.4E-3);
set(handles.k_mix,'string',0.27);
set(handles.ro_mix,'enable','off');
set(handles.x_w_m,'enable','off');
set(handles.nu_mix,'enable','off');
set(handles.k_mix,'enable','off');
case 3
set(handles.ro_mix,'string',840);
set(handles.x_w_m,'string',0.84);
set(handles.nu_mix,'string',1.25E-3);
set(handles.k_mix,'string',0.26);
set(handles.ro_mix,'enable','off');
set(handles.x_w_m,'enable','off');
set(handles.nu_mix,'enable','off');
set(handles.k_mix,'enable','off');
case 4
set(handles.ro_mix,'string','');
set(handles.x_w_m,'string','');
set(handles.nu_mix,'string','');
set(handles.k_mix,'string','');
set(handles.ro_mix,'enable','on');
set(handles.x_w_m,'enable','on');
set(handles.nu_mix,'enable','on');
set(handles.k_mix,'enable','on');
end

% --- Executes on button press in push_apply.
function push_apply_Callback(hObject, eventdata, handles)
global ratio k_g Eps k_sil Cp_water Cp_methanol k_air Cp_air
ro_air k_cool
global ro_glass Cp_glass ro_sil Cp_sil Cond ro x_w_m nu k_liq
nu_air

switch get(handles.popup_ratio,'value')
case 1
ratio=4;
case 2
ratio=6;
case 3
ratio=8;
case 4
ratio='Other';
end



k_g=str2double(get(handles.k_glass,'string'));
ro_glass=str2double(get(handles.ro_glass,'string'));
Cp_glass=str2double(get(handles.Cp_glass,'string'));
k_air=str2double(get(handles.k_out,'string'));
ro_air=str2double(get(handles.ro_air,'string'));
Cp_air=str2double(get(handles.Cp_air,'string'));
k_sil=str2double(get(handles.k_sil,'string'));
ro_sil=str2double(get(handles.ro_sil,'string'));
Cp_sil=str2double(get(handles.Cp_sil,'string'));
Cp_water=str2double(get(handles.Cp_water,'string'));
Cp_methanol=str2double(get(handles.Cp_methanol,'string'));
Cond=str2double(get(handles.Cond,'string'));
ro=str2double(get(handles.ro_mix,'string'));
x_w_m=str2double(get(handles.x_w_m,'string'));
nu=str2double(get(handles.nu_mix,'string'));
k_liq=str2double(get(handles.k_mix,'string'));
Eps=str2double(get(handles.Eps,'string'));
k_cool=str2double(get(handles.k_cool,'string'));
nu_air=str2double(get(handles.nu_air,'string'));

if isnan(k_g) || isnan(ro_glass) || isnan(Cp_glass) ||
isnan(k_air) || isnan(ro_air) || isnan(Cp_air) ||
isnan(k_sil) || isnan(ro_sil) || isnan(Cp_sil) ||
isnan(Cp_water) || isnan(Cp_methanol) || isnan(Cond) ||
isnan(ro) || isnan(x_w_m) || isnan(nu) || isnan(k_liq) ||
isnan(Eps) || isnan(k_cool) || isnan(nu_air)
msgbox('Please, make sure all fields are specified, or
the simulation will not run properly','Error','warn')
else
close
end

% --- Executes on button press in push_cancel.
function push_cancel_Callback(hObject, eventdata, handles)
close



























function varargout = Options(varargin)
% Last Modified by GUIDE v2.5 19-Jul-2011 04:44:52

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Options_OpeningFcn, ...
'gui_OutputFcn', @Options_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State,
varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT

% --- Executes just before Options is made visible.
function Options_OpeningFcn(hObject, eventdata, handles,
varargin)

global ny nz popstencil k_mixcalc h_air

set(handles.ny,'string',num2str(ny))
set(handles.nz,'string',num2str(nz))
set(handles.popup_stencil,'value',popstencil)
set(handles.h_air,'string',h_air)

if ny==52
set(handles.ny,'enable','off')
set(handles.nz,'enable','off')
else
set(handles.ny,'enable','on')
set(handles.nz,'enable','on')
end

if k_mixcalc==2
set(handles.simpave,'value',1)
end



% Choose default command line output for Options
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% --- Outputs from this function are returned to the command
line.
function varargout = Options_OutputFcn(hObject, eventdata,
handles)
varargout{1} = handles.output;

% --- Executes on selection change in popup.
function popup_stencil_Callback(hObject, eventdata, handles)

switch get(handles.popup_stencil,'value')
case 1
set(handles.ny,'enable','on')
set(handles.nz,'enable','on')
case 2
set(handles.ny,'enable','off')
set(handles.nz,'enable','off')
set(handles.ny,'string',52)
set(handles.nz,'string',44)

end

% --- Executes on button press in push_apply.
function push_apply_Callback(hObject, eventdata, handles)

global ny nz dy dz dx y z x k_mix k_liq k_sil Eps popstencil
k_mixcalc
global Cp_air nu_air k_air Length h_air



if get(handles.popup_stencil,'value')==2 ||
(get(handles.popup_stencil,'value')==1 &&
str2double(get(handles.ny,'string'))>0 &&
str2double(get(handles.nz,'string'))>0 &&
mod(str2double(get(handles.ny,'string')),15)==0)

if get(handles.volint,'value')==1

R=30E-6; %Particle radio, m
dr=1E-7;
r=0;
area_k=0;
i=1;
while r<=R
func(i)=r/((R-(R^2-r^2)^0.5)/k_liq+(R^2-
r^2)^0.5/k_sil); %Function for integration
if i>1
increase=func(i-1)*dr+(func(i)-func(i-1))*dr/2;
area_k=area_k+increase;
end
i=i+1;
r=r+dr;
end
k_mix=(2/R)*area_k;
k_mixcalc=1;

else
k_mix=k_liq*Eps+k_sil*(1-Eps);
k_mixcalc=2;
end

if get(handles.estimate_kair,'value')==1
Pr_air=Cp_air*nu_air/k_air;
Gr_air=(9.81*3.43E-3*6*Length^3)/((15.11E-6)^2);

Nu_air=0.68+(0.67*(Pr_air*Gr_air)^0.25)/((1+(0.492/Pr_air)^(9
/16))^(4/9));
h_air=k_air*Nu_air/Length;
else
h_air=str2double(get(handles.h_air,'string'));
end

ny=str2double(get(handles.ny,'string'));
nz=str2double(get(handles.nz,'string'));
switch get(handles.popup_stencil,'value')
case 1
dy=0.015/ny;
dz=0.2/nz;
dx=0.065;
y=0:dy:0.015; % Y position vector, m
z=0:dz:0.2; % Z position vector, m
x=0:dx:0.065;
popstencil=1;
close
case 2
dy=0.00025;
dz=0.004;
dx=0.065;
x=0:dx:0.065;
y=[0 dy/2 dy:dy:4*dy 6*dy 8*dy:3*dy:32*dy 34*dy
36*dy:dy:39*dy 39.5*dy 40*dy:dy/4:44*dy 44.5*dy
45*dy:dy:48*dy 50*dy:2*dy:56*dy 57*dy:dy:59*dy 59.5*dy
60*dy];
z=[0 dz/10 dz/5:dz/5:dz 1.5*dz:0.5*dz:10*dz
11*dz:dz:19*dz 20*dz:3*dz:50*dz];
popstencil=2;
close
end

else
msgbox('For using Fixed Size Stencil, the value of
variable ny must be a multiple of 15','Error','warn')
end

% --- Executes on button press in push_cancel.
function push_cancel_Callback(hObject, eventdata, handles)
close

% --- Executes on selection change in h_calc.
function h_calc_SelectionChangeFcn(hObject, eventdata,
handles)
if get(handles.estimate_kair,'value')==1
set(handles.h_air,'enable','off')
set(handles.h_air,'string','')
else


set(handles.h_air,'enable','on')
end

% --- Executes on selection change in k_calc.
function k_calc_SelectionChangeFcn(hObject, eventdata,
handles)





































































function varargout = Graphics(varargin)

% Last Modified by GUIDE v2.5 20-Jul-2011 06:20:24

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Graphics_OpeningFcn,
...
'gui_OutputFcn', @Graphics_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State,
varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before Graphics is made visible.
function Graphics_OpeningFcn(hObject, eventdata, handles,
varargin)
global T ny nz data

T_data=zeros(ny,nz);
for j=1:ny
for k=1:nz
T_data(j,k)=T(j,k,1);
end
end

data=0;
set(handles.table_temp,'Data',T_data(:,:))
set(handles.block,'visible','on')
data=[0;0];
set(handles.table_graph,'Data',data)

% Choose default command line output for Graphics
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% --- Outputs from this function are returned to the command
line.
function varargout = Graphics_OutputFcn(hObject, eventdata,
handles)
varargout{1} = handles.output;

% --- Executes on selection change in popup.
function popup_Callback(hObject, eventdata, handles)

subplot(handles.figure);title('');xlabel('');ylabel('')
cla
set(handles.add,'enable','off')
set(handles.add,'value',0)
data=[0;0];
set(handles.table_graph,'Data',data)

switch get(hObject,'value')
case 1
set(handles.block,'visible','on')
set(handles.line,'visible','off')
set(handles.setj,'visible','off')
set(handles.setk,'visible','off')
set(handles.k,'enable','on')
set(handles.j,'enable','on')
case 2
set(handles.block,'visible','off')
set(handles.line,'visible','on')
set(handles.setj,'visible','on')
set(handles.setk,'visible','on')
set(handles.setj,'value',1)
set(handles.setk,'value',0)
set(handles.j,'string','')
set(handles.k,'string','')
set(handles.k,'enable','off')


end

% --- Executes during object creation, after setting all
properties.
function popup_CreateFcn(hObject, eventdata, handles)

if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in represent.
function represent_Callback(hObject, eventdata, handles)
global T Temp time y z ny nz pp data

j=str2double(get(handles.j,'string'));
k=str2double(get(handles.k,'string'));

if get(handles.popup,'value')==2 || (~isnan(j) && ~isnan(k)
&& j>0 && j<=ny && k>0 && k<=nz && mod(j,1)==0 &&
mod(k,1)==0)
if (~isnan(j) && j>0 && j<=ny && mod(j,1)==0) ||
(~isnan(k) && k>0 && k<=nz && mod(k,1)==0)

if get(handles.add,'value')==0
hold off
data=[j;k];
color='blue';
col=1;
else
hold on
[row,col]=size(data);
data(1,col+1)=j;
data(2,col+1)=k;
if mod(col+4,5)==0
color='green';
elseif mod(col+3,5)==0
color='red';
elseif mod(col+2,5)==0
color='yellow';
elseif mod(col+1,5)==0
color='black';
elseif mod(col,5)==0
color='blue';
end
end

switch get(handles.popup,'value')
case 1
for i=1:pp
Temp_plot(i)=Temp(j,k,i);
time_(i)=time(i);
end

plot(time_,Temp_plot,'Color',color);title('Temperature over
time');xlabel('Time (s)');ylabel('Temperature (C)')
case 2
if get(handles.setj,'value')==1
j=str2double(get(handles.j,'string'));
for k=1:nz
Temp_plot(k)=T(j,k,1);
end
Z=z(1:nz)+diff(z)/2;
plot(Z,Temp_plot);title('Temperature along z-
axis');xlabel('z (m)');ylabel('Temperature (C)')
else
k=str2double(get(handles.k,'string'));
for j=1:ny
Temp_plot(j)=T(j,k,1);
end
Y=y(1:ny)+diff(y)/2;
plot(Y,Temp_plot);title('Temperature along y-
axis');xlabel('y (m)');ylabel('Temperature (C)')
end
end
set(handles.add,'enable','on')
set(handles.table_graph,'Data',data(:,:))
if col==4
set(handles.add,'enable','off')
set(handles.add,'value',0)
end

else
msgbox('Not a valid value of j or k','Input
error','error')


end
else
msgbox('Not a valid value of j or k','Input
error','error')
end

% --- Executes on button press in clear.
function clear_Callback(hObject, eventdata, handles)
subplot(handles.figure);title('');xlabel('');ylabel('')
cla
set(handles.add,'enable','off')
set(handles.add,'value',0)

% --- Executes on button press in add.
function add_Callback(hObject, eventdata, handles)

% --- Executes on button press in setj.
function setj_Callback(hObject, eventdata, handles)
if get(hObject,'value')==1
set(handles.setk,'value',0)
set(handles.k,'enable','off')
set(handles.k,'string','')
set(handles.j,'enable','on')
end

if get(hObject,'value')==0
set(handles.setk,'value',1)
set(handles.k,'enable','on')
set(handles.j,'string','')
set(handles.j,'enable','off')
end

% --- Executes on button press in setk.
function setk_Callback(hObject, eventdata, handles)
if get(hObject,'value')==1
set(handles.setj,'value',0)
set(handles.j,'enable','off')
set(handles.j,'string','')
set(handles.k,'enable','on')
end

if get(hObject,'value')==0
set(handles.setj,'value',1)
set(handles.j,'enable','on')
set(handles.k,'string','')
set(handles.k,'enable','off')
end

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
close

% --- Executes on button press in export_excel.
function export_excel_Callback(hObject, eventdata, handles)
global Eps Cp_water Cp_methanol k_cool ro_glass Cp_glass
ro_sil ro_air
global Cp_sil Cond ro x_w_m U T_out T_cool ny nz t_limit T
k_g k_air Cp_air
global k_sil nu k_liq h_air nu_air

answer=inputdlg('Input the Excel file name','Export');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
filename=['Save_data\' answer.name];
for j=1:ny
for k=1:nz
T_(j+1,k+1)=T(j,k,1);
T_(1,k+1)=k;
T_(j+1,1)=j;
end
end
xlswrite(filename,T_,'Temperature')
variablename={'Potential applied '; 'Air temperature
'; 'Cooling temperature'; 'Transcurred time '; 'Glass
conductivity '; 'Glass density '; 'Glass Cp ';
'Air conductivity '; 'Air density '; 'Air Cp
'; 'Silica conductivity'; 'Silica density '; 'Silica Cp
'; 'Water Cp '; 'Methanol Cp '; 'Electric
conductiv.'; 'Liquid density '; 'Meth. mass fraction';
'Liquid viscosity '; 'Liquid conductivity'; 'Porosity
'; 'Cooling conductiv. '; 'Air convection coef'; 'Air
viscosity '};
xlswrite(filename,variablename,'Parameters','B1:B24');


variablevalue=[U; T_out; T_cool; t_limit; k_g; ro_glass;
Cp_glass; k_air; ro_air; Cp_air; k_sil; ro_sil; Cp_sil;
Cp_water; Cp_methanol; Cond; ro; x_w_m; nu; k_liq; Eps;
k_cool; h_air; nu_air];
xlswrite(filename,variablevalue,'Parameters','A1:A24');
end

% --- Executes on button press in save_case.
function save_case_Callback(hObject, eventdata, handles)
answer=inputdlg('Save as:','Save');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
filename=['Save_data\' answer.name];
saveas(handles.graphics,filename,'fig')
end

% --- Executes on button press in save_image.
function save_image_Callback(hObject, eventdata, handles)
answer=inputdlg('Save as:','Save');
fields='name';
if ~isempty(answer)
answer=cell2struct(answer,fields);
filename=['Save_data\' answer.name '.jpg'];
I=getframe(handles.axes2);
imwrite(I.cdata,filename,'Quality', 100)
end



















%derivative.m
function HB = derivative(zx)

global T_cool T_out h_cool h_air dz dy ny nz A_y A_z k_g
k_mix Den Q y

HB=zeros(ny,nz);

for j=1:ny
for k=1:nz
if k==1

if j==1
Num=h_air*A_y(k)*(T_out-
zx(j,k))+k_g*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_g*A_z(j)*(zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)>0 && y(j+1)+dy(j)-0.01<1E-10
Num=k_g*A_y(k)*((zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_g*A_z(j)*(zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.01<1E-10

Num=(1/(dy(j)/(2*k_g)+dy(j+1)/(2*k_mix)))*A_y(k)*(zx(j+1,k)-
zx(j,k))+k_g*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_g*A_z(j)*(zx(j,k+1)-zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)-0.01<1E-10
Num=Q(j,k)+(1/(dy(j-
1)/(2*k_g)+dy(j)/(2*k_mix)))*A_y(k)*(zx(j-1,k)-
zx(j,k))+k_mix*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_mix*A_z(j)*(zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)>0.01+1E-10 && y(j+1)+dy(j)-0.011<1E-10
Num=Q(j,k)+k_mix*A_y(k)*((zx(j-1,k)-
zx(j,k))/((dy(j)+dy(j-1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_mix*A_z(j)*(zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.011<1E-10

Num=Q(j,k)+(1/(dy(j)/(2*k_mix)+dy(j+1)/(2*k_g)))*A_y(k)*(zx(j
+1,k)-zx(j,k))+k_mix*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_mix*A_z(j)*(zx(j,k+1)-zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)-0.011<1E-10
Num=(1/(dy(j-
1)/(2*k_mix)+dy(j)/(2*k_g)))*A_y(k)*(zx(j-1,k)-
zx(j,k))+k_g*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_g*A_z(j)*(zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)>0.011+1E-10 && y(j+1)+dy(j)-0.015<1E-10
Num=k_g*A_y(k)*((zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_g*A_z(j)*(zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.015<1E-10
Num=h_cool*A_y(k)*(T_cool-
zx(j,k))+k_g*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_g*A_z(j)*(zx(j,k+1)-zx(j,k))/((dz(k)+dz(k+1))/2);
HB(j,k)=Num/Den(j,k);
end

elseif k<nz

if j==1
Num=h_air*A_y(k)*(T_out-
zx(j,k))+k_g*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_g*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j)>0 && y(j+1)+dy(j)-0.01<1E-10
Num=k_g*A_y(k)*((zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_g*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.01<1E-10



Num=(1/(dy(j)/(2*k_g)+dy(j+1)/(2*k_mix)))*A_y(k)*(zx(j+1,k)-
zx(j,k))+k_g*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_g*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j)-0.01<1E-10
Num=Q(j,k)+(1/(dy(j-
1)/(2*k_g)+dy(j)/(2*k_mix)))*A_y(k)*(zx(j-1,k)-
zx(j,k))+k_mix*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_mix*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j)>0.01+1E-10 && y(j+1)+dy(j)-0.011<1E-10
Num=Q(j,k)+k_mix*A_y(k)*((zx(j-1,k)-
zx(j,k))/((dy(j)+dy(j-1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_mix*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.011<1E-10

Num=Q(j,k)+(1/(dy(j)/(2*k_mix)+dy(j+1)/(2*k_g)))*A_y(k)*(zx(j
+1,k)-zx(j,k))+k_mix*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_mix*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j)-0.011<1E-10
Num=(1/(dy(j-
1)/(2*k_mix)+dy(j)/(2*k_g)))*A_y(k)*(zx(j-1,k)-
zx(j,k))+k_g*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_g*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j)>0.011+1E-10 && y(j+1)+dy(j)-0.015<1E-10
Num=k_g*A_y(k)*((zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_g*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.015<1E-10
Num=h_cool*A_y(k)*(T_cool-
zx(j,k))+k_g*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_g*A_z(j)*((zx(j,k+1)-
zx(j,k))/((dz(k)+dz(k+1))/2)+(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2));
HB(j,k)=Num/Den(j,k);
end

elseif k==nz

if j==1
Num=h_air*A_y(k)*(T_out-
zx(j,k))+k_g*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_g*A_z(j)*(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)>0 && y(j+1)+dy(j)-0.01<1E-10
Num=k_g*A_y(k)*((zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_g*A_z(j)*(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.01<1E-10

Num=(1/(dy(j)/(2*k_g)+dy(j+1)/(2*k_mix)))*A_y(k)*(zx(j+1,k)-
zx(j,k))+k_g*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_g*A_z(j)*(zx(j,k-1)-zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)-0.01<1E-10
Num=Q(j,k)+(1/(dy(j-
1)/(2*k_g)+dy(j)/(2*k_mix)))*A_y(k)*(zx(j-1,k)-
zx(j,k))+k_mix*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_mix*A_z(j)*(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)>0.01+1E-10 && y(j+1)+dy(j)-0.011<1E-10
Num=Q(j,k)+k_mix*A_y(k)*((zx(j-1,k)-
zx(j,k))/((dy(j)+dy(j-1))/2)+(zx(j+1,k)-


zx(j,k))/((dy(j)+dy(j+1))/2))+k_mix*A_z(j)*(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.011<1E-10

Num=Q(j,k)+(1/(dy(j)/(2*k_mix)+dy(j+1)/(2*k_g)))*A_y(k)*(zx(j
+1,k)-zx(j,k))+k_mix*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_mix*A_z(j)*(zx(j,k-1)-zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)-0.011<1E-10
Num=(1/(dy(j-
1)/(2*k_mix)+dy(j)/(2*k_g)))*A_y(k)*(zx(j-1,k)-
zx(j,k))+k_g*A_y(k)*(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2)+k_g*A_z(j)*(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j)>0.011+1E-10 && y(j+1)+dy(j)-0.015<1E-10
Num=k_g*A_y(k)*((zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+(zx(j+1,k)-
zx(j,k))/((dy(j)+dy(j+1))/2))+k_g*A_z(j)*(zx(j,k-1)-
zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
elseif y(j+1)-0.015<1E-10
Num=h_cool*A_y(k)*(T_cool-
zx(j,k))+k_g*A_y(k)*(zx(j-1,k)-zx(j,k))/((dy(j)+dy(j-
1))/2)+k_g*A_z(j)*(zx(j,k-1)-zx(j,k))/((dz(k)+dz(k-1))/2);
HB(j,k)=Num/Den(j,k);
end

end
end
end

end









function QJ = heat_rest(ka1)

global T j_int1 j_int2 k_control i nz DeltaT0 reach Q1 Q2 dy
dz DZ1 DZ2
global k_max
DeltaT=T(j_int1,k_control,i)-T(j_int1,nz,i);

if ka1(j_int1,nz)>=0

if DeltaT/DeltaT0<0.6
if ka1(j_int1,1)/ka1(j_int1,nz)>=10
Q2=Q2+Q1*0.05;
Q1=Q1*0.95;
elseif ka1(j_int1,1)/ka1(j_int1,nz)<10
Q1=Q1+Q2*0.05;
Q2=Q2*0.95;
end

elseif DeltaT/DeltaT0>=0.6 && DeltaT/DeltaT0<0.9
if ka1(j_int1,1)/ka1(j_int1,nz)<5
Q1=Q1+Q2*0.03;
Q2=Q2*0.97;
elseif ka1(j_int1,1)/ka1(j_int1,nz)>=5
Q2=Q2+Q1*0.03;
Q1=Q1*0.97;
end

elseif DeltaT/DeltaT0>=0.9 && DeltaT/DeltaT0<0.98
if ka1(j_int1,1)/ka1(j_int1,nz)<3
Q1=Q1+Q2*0.01;
Q2=Q2*0.99;
elseif ka1(j_int1,1)/ka1(j_int1,nz)>=3
Q2=Q2+Q1*0.01;
Q1=Q1*0.99;
end

elseif DeltaT/DeltaT0>=0.99 && DeltaT/DeltaT0<=1
reach=reach+1;
if ka1(j_int1,1)/ka1(j_int1,nz)<1.3
Q1=Q1+Q2*0.001;
Q2=Q2*0.999;
elseif ka1(j_int1,1)/ka1(j_int1,nz)>=1.3
Q2=Q2+Q1*0.001;
Q1=Q1*0.999;
end

elseif DeltaT/DeltaT0>1 && DeltaT/DeltaT0<=1.01
reach=reach+1;
if ka1(j_int1,nz)/ka1(j_int1,1)<1.3
Q2=Q2+Q1*0.001;
Q1=Q1*0.999;
elseif ka1(j_int1,nz)/ka1(j_int1,1)>=1.3
Q1=Q1+Q2*0.001;
Q2=Q2*0.999;
end

elseif DeltaT/DeltaT0>1.01 && DeltaT/DeltaT0<=1.2
if ka1(j_int1,nz)/ka1(j_int1,1)<2
Q2=Q2+Q1*0.01;
Q1=Q1*0.99;
elseif ka1(j_int1,nz)/ka1(j_int1,1)>=2
Q1=Q1+Q2*0.01;
Q2=Q2*0.99;
end

elseif DeltaT/DeltaT0>1.2
if ka1(j_int1,nz)/ka1(j_int1,1)<3
Q2=Q2+Q1*0.03;
Q1=Q1*0.97;
elseif ka1(j_int1,nz)/ka1(j_int1,1)>=3
Q1=Q1+Q2*0.03;
Q2=Q2*0.97;
end
end

else

if ka1(j_int1,1)<0

if DeltaT/DeltaT0<0.6
if ka1(j_int1,nz)/ka1(j_int1,1)>=10
Q2=Q2+Q1*0.05;
Q1=Q1*0.95;
elseif ka1(j_int1,nz)/ka1(j_int1,1)<10


Q1=Q1+Q2*0.05;
Q2=Q2*0.95;
end

elseif DeltaT/DeltaT0>=0.6 && DeltaT/DeltaT0<0.9
if ka1(j_int1,nz)/ka1(j_int1,1)<5
Q1=Q1+Q2*0.03;
Q2=Q2*0.97;
elseif ka1(j_int1,nz)/ka1(j_int1,1)>=5
Q2=Q2+Q1*0.03;
Q1=Q1*0.97;
end

elseif DeltaT/DeltaT0>=0.9 && DeltaT/DeltaT0<0.98
if ka1(j_int1,nz)/ka1(j_int1,1)<3
Q1=Q1+Q2*0.01;
Q2=Q2*0.99;
elseif ka1(j_int1,nz)/ka1(j_int1,1)>=3
Q2=Q2+Q1*0.01;
Q1=Q1*0.99;
end

elseif DeltaT/DeltaT0>=0.99 && DeltaT/DeltaT0<=1
reach=reach+1;
if ka1(j_int1,nz)/ka1(j_int1,1)<1.3
Q1=Q1+Q2*0.001;
Q2=Q2*0.999;
elseif ka1(j_int1,nz)/ka1(j_int1,1)>=1.3
Q2=Q2+Q1*0.001;
Q1=Q1*0.999;
end

elseif DeltaT/DeltaT0>1 && DeltaT/DeltaT0<=1.01
reach=reach+1;
if ka1(j_int1,1)/ka1(j_int1,nz)<1.3
Q2=Q2+Q1*0.001;
Q1=Q1*0.999;
elseif ka1(j_int1,1)/ka1(j_int1,nz)>=1.3
Q1=Q1+Q2*0.001;
Q2=Q2*0.999;
end

elseif DeltaT/DeltaT0>1.01 && DeltaT/DeltaT0<=1.2
if ka1(j_int1,1)/ka1(j_int1,nz)<2
Q2=Q2+Q1*0.01;
Q1=Q1*0.99;
elseif ka1(j_int1,1)/ka1(j_int1,nz)>=2
Q1=Q1+Q2*0.01;
Q2=Q2*0.99;
end

elseif DeltaT/DeltaT0>1.2
if ka1(j_int1,1)/ka1(j_int1,nz)<3
Q2=Q2+Q1*0.03;
Q1=Q1*0.97;
elseif ka1(j_int1,1)/ka1(j_int1,nz)>=3
Q1=Q1+Q2*0.03;
Q2=Q2*0.97;
end
end

else

if DeltaT/DeltaT0<0.85
Q1=Q1+Q2*0.02;
Q2=Q2*0.98;
elseif DeltaT/DeltaT0>1
Q2=Q2+Q1*0.01;
Q1=Q1*0.99;
end

end

end

QJ=zeros(size(ka1));
for j=j_int1:j_int2
for k=1:nz
if k>=1 && k<k_max
QJ(j,k)=Q1*dz(k)*dy(j)/(DZ1*0.001);
elseif k>=k_max
QJ(j,k)=Q2*dz(k)*dy(j)/(DZ2*0.001);
end
end


end

end

Вам также может понравиться