From: Subhasis R. <ray...@gm...> - 2015-03-31 15:23:17
|
Hi, This is more of a user issue than a development issue, hence cc to moose-generic mailing list. On Tue, Mar 31, 2015 at 4:38 AM, Dilawar Singh <dil...@nc...> wrote: > > An equation in chemical model is following: > > x(t) = a(t)*b(t)*c(t); (A) > > Variable 'x' is a proxy for three independent moose.Pool with species a, > b, and > c having their own kinetics. In other reactions, 'x' is treated as input; > What do you mean by input to a reaction? > therefor it should be implemented as moose.Pool or moose.BufPool. > > In continuation of previous query, can you tell us more about the reaction system? A pool is a pool of molecules and I cannot imagine the number of molecules in one pool being the product of three others in a physical process. In another way, your equation will be dimensionally invalid. > > AFAIK, currently moose.Pool does not have a Dest-Finfo which I can use to > set > the number of molecules in Pool. For each ValueFinfo 'x', a moose class automatically gets a 'getX' and 'setX' DestFinfos. You could see this using the builtin doc function: >>> moose.doc('Pool') ... *Destination message field* setN: double getN: PSt6vectorIdSaIdEE setNInit: double getNInit: PSt6vectorIdSaIdEE setDiffConst: double getDiffConst: PSt6vectorIdSaIdEE ... > I can only use 'increment' or 'decrement' which > is fine if the equation was: > > dx/dt = a*b*c (A1) > > So it boils down to having a moose.Pool where kinetics can be described > using > the equation (A); perhaps a combination of moose.Function and moose.Table. > But > in the end, I have to set the conc/n of moose.Pool using a message. > I am not sure if setting n externally is the right approach though. The pools are supposed to participate in reactions and get their n updated through that process. > > Another way of doing it to use the moose.Function and connect > 'getDerivative' to > the x (moose.Pool) 'increment'. I don't know if it would be mathematically > wrong > but moose.connect does not allow connecting these two Finfos. I can > implement > this if it is mathematically correct or does not cause numerical issues. > You cannot connect a DestFinfo to another DestFinfo. You can use 'derivativeOut' SrcFinfo from Function. > > I extended the moose.Pool class by adding a 'N' destinfo which set the n_ > to > given value As I mentioned above, this was unnecessary. > but I don't know what values should A_ and B_ take. Merely changing > n_ and setting A_ and B_ to 0 does give me correct shape of curves, but the > values are way too high (seems like conc is replaced by number of > molecules in > Pool). > What are A_ and B_ ? conc is calculated from the number of molecules in Pool and should be proportional. It is not clear what you are trying to model. I would suggest you review your model and see if chemical kinetics is really necessary. Best, Subhasis |