In the previous example we have seen a basic example of how to setup hsolve and configure it to simulate a model represented by two compartments. How is this related to the mathematics we discussed earlier on ? Which numerical scheme was used for the cable equation and which numerical scheme was used for channels ? These questions are answered by inspecting the chanmode field. Basically you have to make a major distinction between the lower chanmodes (chanmode 0 and 1) and the higher chanmodes (chanmode 2 to 5). The lower chanmodes are modes intended for compatibility with other Genesis objects and they are slow compared to the higher chanmodes. Hsolve will automatically update all the computed fields in the original elements, such as to create the illusion that the original elements still perform their own computations. The updated fields are then available for plotting or for other elements to do additional calculations.
To communicate variables to/from other elements, hsolve uses the message system of Genesis. This makes the chanmode 0 the most compatible mode of operation and it is recommended for people that have developed their own set of custom objects.
To use chanmode 1 in the previous example, you configure hsolve with the following command:
genesis > setfield solver path "../##[][TYPE=compartment]" chanmode 1
NOTE: The compartmental Im field is only computed by hsolve running in chanmode 0 or 1 if you turn on the field 'computeIm'. Calculation of the Im field incurs a small performance penalty. |
When using the higher chanmodes, hsolve will compile all elements that belong to your model to byte-codes. During the simulation these byte-codes are emulated which results in a high performance (the higher chanmodes can be 5-10 times faster than the lower chanmodes, depending on the model structure). To be able to compile an element into byte-codes, hsolve must be aware of the element type (the Genesis object) and its computations. The objects hsolve is able to compile to byte-codes, are documented in the Genesis manuals.
The higher chanmodes all share the property that hsolve computes all the elements present in your model on the staggered time grid, so this guarantees second-order accuracy under all circumstances. A single time step in the simulation will compute the membrane potential at the simulated time after an update of the conductance at an intermediate time point.
In most cases the original elements' fields will not be updated. For hsolve the elements only serve as a description of the model to be computed, so we call these elements modeling elements. To inspect calculated values, they have to be fetched with the findsolvefield command. We will show examples of the use of this command shortly. The difference between the different chanmodes lies in the fact that some fields might not be computed and are not accessible - even with the findsolvefield command - as explained in the following: