User-supplied time dependent voltages.

See also the general note on voltages.

General notes for time-dependent voltages:

The time-dependent fields are dealt with in the 'quasi-static' approximation. In other words, the program ignores any magnetic fields that are generated from the time variations of the electric fields (that is, electromagnetic effects), and so the user must ensure that the frequency of the field is not too high and that the wavelength is much longer than the electrode lengths.

User-supplied routine

The CPO program sends the time to the user-supplied routine, in the first element of the array param_copy, and the total number of voltages (nvolts), in the second element.

The user_supplied routine is then expected to calculate the values of all the applied voltages, which are returned to the CPO program, in param_copy(2 to nvolts+1).

Examples of user supplied routines are provided as part of the CPO package. They are called time2d.cpp (for 2D programs) and user3d.cpp (for 3D programs, and including user-defined magnetic fields). Their links to the main program, called time2d.dll and user3d.dll (dynamically linked libraries) are also provided. Read-only copies of the cpp files, called tim2copy.cpp and use3copy.cpp are also supplied with the package. For instructions for editing the cpp files and building the dll files, see the instructions given recently for the scattering routine.

Examples of data files for user-defined voltages are test2d24.dat and test3d16.dat.

3 different types of time dependence are available in this example:

(1) sinusoidal, (2) square-wave, (3) saw-tooth.

Up to 3 different time dependencies can be superimposed (that is, applied simultaneously).

Any of these types of time dependencies can therefore be easily accessed by clicking on Time-dependence/user-supplied. The type is easily selected through a data file (see below). No other actions are required.

The routines time2d.cpp and user3d.cpp read data from a user-supplied file that is named in databuilder. For example it could be called 'time2D.dat' or ‘time3D.dat’ (which are the default names) and it must be in the same directory as cpo2d.exe or cpo3d.exe.

The first line of this data file must be the number N of different time dependencies that are simultaneously applied. The maximum value of N is 3. For example this number would be 3 if there is a fundamental sine wave plus two harmonics. Or the number would be 1 if a simple square wave is to be applied.

The second line of this data file must contain 3 numbers, to indicate the types of time dependence. Each of these numbers is 1, 2 or 3, which represent a sine wave, square wave or sawtooth wave respectively (details of these are given below). For example the second line might be

1 1 1

-then 3 sine waves would be simultaneously applied. If N < 3 then 'dummy' numbers must be added, to make the total number 3. For example if N = 1 the second line might be

1 0 0

Then there must be N lines for each voltage, giving the details of the time dependence (see below). The total number of voltages in use is automatically transferred from the CPO program to the present routine. The N lines must exist even for voltages that are constant.

Note that the initial time is the value entered in the databuilder -it is not reset here.

An example of time3d.dat, to give the same results as the program-defined sine wave in test3d08.dat:

1 for 1 type of time dependence

1 0 0 1 sine wave and 2 dummies

0. -30. 1.E-6 0. = voltage number 1 (v0, v1, period in ms, phi)

0. 0. 1.E-6 0. = voltage number 2

(but without the comments at the end of the lines)

Another example:

Suppose that voltage number 1 has the constant value 10V, while voltage number 2 is made up of a constant 5V, plus a fundamental frequency of 1MHz and amplitude 4V, plus the first 2 harmonics, with amplitudes 1V and 0.1V respectively. Then the data file would be:

3 for 3 types of time dependence

1 1 1 all 3 are sine waves

10. 0. 1.E-6 0. = constant for voltage number 1 (see below)

0. 0. 1.E-6 0. = 0 for voltage number 1 again

0. 0. 1.E-6 0. = 0 for voltage number 1 again

5. 4. 1.E-6 0. = constant and fundamental of voltage number 2

0. 1. 0.5E-6 0. = 1st harmonic of voltage number 2

0. 0.1. 0.33333333E-6 0. = 2nd harmonic of voltage number 2

(but without the comments at the end of the lines)

(and all the phases are 0 here)

The examples of ‘time2d.dat’ and 'time3d.dat' are part of the CPO package and contain examples of the data needed for all 3 types of time dependence. Read-only versions, called tim2copy.dat and tim3copy.dat, are supplied with the package.

Sinusoidal time dependence (type = 1):

The voltages are defined to be:

v = v0 + v1*sin(phi + 2.0*pi*time/tau)

where tau is in millisecs.

The data file ‘time2D.dat’ or ‘time3D.dat’ must have the format:

1 = type of time dependence

0. 30. 1.E-6 0. = v0 , v1 , tau , phi

0. 0. 1.E-6 0. = v0 , v1 , tau , phi

-one line for each voltage (of which there are nvolts)

Square wave (type = 2):

More precisely, not square because the 2 time lengths might be different.

The voltages are defined to be:

v = v1 from t >= (t0 + n*tau) to t = (t0 +n*tau + tau1),

v = v2 from t >= (t0 + n*tau + tau1) to t = (t0 +n*tau + tau1 + tau2),

where n is any positive integer, and tau = tau1 + tau2 (and all times are in msecs and are assumed to be positive).

The data file ‘time2D.dat’ or ‘time3D.dat’ must have the format:

2 = type of time dependence

0. 30. 0. 1.E-6 1.E-6 = t0 , v1 , v2 , tau1 , tau2

0. 60. 0. 1.E-6 1.E-6 = t0 , v1 , v2 , tau1 , tau2

-one line for each voltage (of which there are nvolts)

Sawtooth wave (type = 3):

The voltage is defined to be:

v = v1 to v2 from t >= (t0 + n*tau) to t = (t0 +(n+0.5)*tau),

v = v2 to v1 from t >= (t0 + (n+0.5)*tau) to t = (t0 +(n+1)*tau),

where n is any positive integer (and all times are in msecs and are assumed to be positive).

The data file ‘time2D.dat’ or ‘time3D.dat’ must have the format:

2 = type of time dependence

0. 0. 30. 1.E-6 = t0 , v1 , v2 , tau

0. 0. 60. 1.E-6 = t0 , v1 , v2 , tau

-one line for each voltage (of which there are nvolts)

Other forms:

The user can also edit the examples that is provided as part of the CPO package, time2d.cpp and user3d.cpp, to create other forms of time dependence. The files time2d.dll and user3d.dll must then be created, following the general instructions given for the scattering dll files.