-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] LatticeReactionSystem internal update #756
Conversation
Have you verified what order MOL uses? |
Still waiting for Alex to confirm, think he is probably on vacation. Holding off one actually changing anything until I've gotten in contact with him. If we need to chang the order I will do so here. |
Ok, ordering os variables/compartments doesn't really seem to be thing in MoL, so I will skip that step here. |
f0fab91
to
afef75e
Compare
This PR is ready now. There is one error that I only get when I run CI tests locally/here (but now when I run it in a normal environment). I wouldn't be surprised if it is related to the new MTK changes that are lying around. Since #737 should be merged before this one anyway, I will look into it further after that. |
This is not complete yet, but I will initiate the PR so that I can summarise what I have lined up for the internal update of the
LatticeReactionStructure
. The idea is to include all the needed stuff (except for using PDEBase to update the indexing of the solution).This is an example of the new workflow:
This is what I will include/have included:
More or less Major
CartesianGrid
, (2) an Array ofBool
, (3) An undirected graph, and (4) a directed graph (for the cartesian grid and array, I currently only allowed dimensions up to 3.edge_iterator
. This is an iterator over `Pair{Int64,Int64} representing the edges on the lattice. This is required to handle the 3 possible types of lattices now permitted.ODEProblem
). Previously, for each parameter, we stored a vector with its values. Now we store a sparse matrix (where value i,j is its value from edge i to j). If the parameter is uniform, the sparse matrix is size 1x1, storing the parameters only value.[p => 1.0, d => 2.0]
) form (or corresponding dictionary form).make_edge_p_values
) andmake_directed_edge_values
.Minor stuff
view_vert_ps_vector!
function is now called directly onLatticeTransportODEf
/LatticeTransportODEjac
(instead of directly on their field).p
vector stored in theODEProblem
not contain both vertex and edge parameters (vertex parameters first, then edge parameters).LatticeReactionSystem
(getting information on the lattice).Other notes
Edge parameter value generation functions
Since setting edge parameter values can be a fit fiddly, I have created two functions to help the user do this for (Cartesian and masked) grid lattices.
make_edge_p_values(lrs::LatticeReactionSystem, make_edge_p_value::Function)
enables the user to provide a function (make_edge_p_value
) which takes two arguments (src_vert
anddst_vert
) and from these determines a value along that edge. E.g. in the following example, we assign the value0.1
to all edges, except for the one leading from vertex (1,1) to vertex (1,2), to which we assign the value1.0
:make_directed_edge_values(lrs, ...)
allows the user to provide a number of two-values Tuple's (equal to the grid's number of dimensions). These tuples determines the edges values according to that dimension and that direction. E.g. in the following example, we wish to have diffusion in the x dimension, but a constant flow from low y values to high y values (so not transportation from high to low y). We achieve it in the following manner:Here, since we have a 2d grid, we only provide the first two Tuples to
make_directed_edge_values
.