Trying to create system from PDEs

I have a PKPD system I worked through the differential equations suite from Chris and would like to compare my results with Pumas. My system consists of 11 actuall differential equations and 5 algebraic equations that inform the differential equations.
For example

dCc/dt = (-K1-KE)Cc + K2Cp (Concentration = transfer from periferal - elimination from Central - transfer to periferal)
dV1/dt = TG-TD (subVolume = growth - death)

death= KdCc
growth = Kg

This is clearly not the system (willing to share if you want), but as you see my algebaric equations do not belong in post processing as their values are linked to dynamic parameters that change during the solution of the system.
After reading the tutorials I am not sure in which section of the model should I define them.
Could you please help me with that?



Are these algebraic variables implicit or explicit? If they are explicit, use the vars block. If they are implicit then you will need to use the function based interface to define a mass matrix DAE.

Thanks Chris-

I think I can define them explicitly, but they’ll depend on dynamic values so their values change with time.

I’ll try to use them in vars block or move onto function based interface.

Thanks :slight_smile:

I’ll let you know how it goes-

And I’ll be happy to contribute the example if it works well.


The vars block will keep the algebraic variables updated.

1 Like

One more sort of related question.
Is there a way to stop the simulation when using @model when one of the vars or derived vars reach 0 or any arbitrary value? or do you need the function interface and define callbacks to do that?
If not it could be cool to add an “@stop” block

Take care

If you add a callback to any of the API functions it should just work. You’d have to do non-fancy indexing though, like integrator.u[I]=…

so if I understand you correctly the callback function - would be a kwarg in for example simobs function

Yes. The current implementation should automatically generate a CallbackSet with the internal callback if you use the callback keyword argument.

1 Like