The DNA and Natural Algorithms Group:

Write Temperature File help



First, the utility function write_temperature_file is meant to be used to make the --TempFile option in Ksim more usable. Basically, the temperature file consists of two types of lines: comment/readme lines, which must begin with a # at the first character of the line and may only appear at the beginning of the file, and data lines, which are a pair of floating point numbers seperated by an equals sign. The left hand side is the time at which the temperature should change, and the right hand side is the new temperature for that time.
Here's an example of this:

#this is a sample section from a temperature file
#the following lines are all data:
0.0 = 37.0
50.0 = 39.0
55.0 = 41.0
60.0 = 43.0
505.0 = 43.0

Note that this file MUST have a line for a time higher than the ending time of the simulation. Preferably it must be at least 10-20 secs after the ending time, if not more, as there may be problems if the simulation goes past that time.

Now, in order to make writing these files easier, there is a matlab file called write_temperature_file.m, available in /research/src.
This file contains one function, write_temperature_file(...), which has the following parameters: write_temperature_file( f, time_start, time_stop, time_step, filename).
These parameters are:

f is a symbolic function of one variable, which should be 't'

time_start is beginning time t to evaluate f at. (float)

time_end is ending time t for evaluating f (float)

time_step is the increment between the times to use. Should be the difference between time_start and time_end, divided by an integer. (float)

filename is the file to write to
Here is an example of a matlab session that uses this function to do a simple raise in temperature (from 100-300s, updating every second)and then drop back to 37.0. The output file is my_temperature.in

>> syms t
>> f = -((t - 200.0)/25.0)^2 + 53.0

f =

-(1/25*t-8)^2+53

>> write_temperature_file( f, 100.0, 300.0, 1.0, 'my_temperature.in');
>>

Joseph Schaeffer 1/16/02