Skip to content

Add support for DAE models #544

@agarny

Description

@agarny

Right now, libOpenCOR can be used to solve ODE and NLA models, but not DAE models. In SED-ML, to specifiy the solver to be used for an ODE or NLA model requires specifying the algorithm element:

<listOfSimulations>
  <uniformTimeCourse id="simulation1" initialTime="0" numberOfPoints="50000" outputEndTime="50" outputStartTime="0">
    <algorithm kisaoID="KISAO:0000019">
      <listOfAlgorithmParameters>
        <algorithmParameter kisaoID="KISAO:0000211" value="1e-07" />
        <algorithmParameter kisaoID="KISAO:0000475" value="BDF" />
        <algorithmParameter kisaoID="KISAO:0000481" value="true" />
        <algorithmParameter kisaoID="KISAO:0000476" value="Newton" />
        <algorithmParameter kisaoID="KISAO:0000477" value="Dense" />
        <algorithmParameter kisaoID="KISAO:0000480" value="0" />
        <algorithmParameter kisaoID="KISAO:0000415" value="500" />
        <algorithmParameter kisaoID="KISAO:0000467" value="0" />
        <algorithmParameter kisaoID="KISAO:0000478" value="Banded" />
        <algorithmParameter kisaoID="KISAO:0000209" value="1e-07" />
        <algorithmParameter kisaoID="KISAO:0000479" value="0" />
      </listOfAlgorithmParameters>
    </algorithm>
  </uniformTimeCourse>
</listOfSimulations>

Now, SED-ML doesn't have support for a second algorithm. Yet, DAE models are currently being solved by solving an ODE system and one or several systems of NLA equations. This means that we need both an ODE solver and an NLA solver, something that cannot be specified in SED-ML.

In legacy OpenCOR, we specified the NLA solver using a SED-ML annotation. For instance:

<listOfSimulations>
  <uniformTimeCourse id="simulation1" initialTime="0" numberOfPoints="1000" outputEndTime="1000" outputStartTime="0">
    <annotation>
      <nlaSolver name="KINSOL" xmlns="http://www.opencor.ws/">
        <solverProperty id="LinearSolver" value="Dense" />
        <solverProperty id="LowerHalfBandwidth" value="0" />
        <solverProperty id="MaximumNumberOfIterations" value="200" />
        <solverProperty id="UpperHalfBandwidth" value="0" />
      </nlaSolver>
    </annotation>
    <algorithm kisaoID="KISAO:0000019">
      <listOfAlgorithmParameters>
        <algorithmParameter kisaoID="KISAO:0000211" value="1e-07" />
        <algorithmParameter kisaoID="KISAO:0000475" value="BDF" />
        <algorithmParameter kisaoID="KISAO:0000481" value="true" />
        <algorithmParameter kisaoID="KISAO:0000476" value="Newton" />
        <algorithmParameter kisaoID="KISAO:0000477" value="Dense" />
        <algorithmParameter kisaoID="KISAO:0000480" value="0" />
        <algorithmParameter kisaoID="KISAO:0000415" value="500" />
        <algorithmParameter kisaoID="KISAO:0000467" value="0" />
        <algorithmParameter kisaoID="KISAO:0000478" value="Banded" />
        <algorithmParameter kisaoID="KISAO:0000209" value="1e-07" />
        <algorithmParameter kisaoID="KISAO:0000479" value="0" />
      </listOfAlgorithmParameters>
    </algorithm>
  </uniformTimeCourse>
</listOfSimulations>

However, this relies on a completely different "syntax". So, in libOpenCOR, we do it using an nlaAlgorithm element within a libOpenCOR namespace. For instance:

<listOfSimulations>
  <uniformTimeCourse id="simulation1" initialTime="0" outputStartTime="0" outputEndTime="1000" numberOfSteps="1000">
    <algorithm kisaoID="KISAO:0000019">
      <listOfAlgorithmParameters>
        <algorithmParameter kisaoID="KISAO:0000209" value="1e-07"/>
        <algorithmParameter kisaoID="KISAO:0000211" value="1e-07"/>
        <algorithmParameter kisaoID="KISAO:0000415" value="500"/>
        <algorithmParameter kisaoID="KISAO:0000467" value="0"/>
        <algorithmParameter kisaoID="KISAO:0000475" value="BDF"/>
        <algorithmParameter kisaoID="KISAO:0000476" value="Newton"/>
        <algorithmParameter kisaoID="KISAO:0000477" value="Dense"/>
        <algorithmParameter kisaoID="KISAO:0000478" value="Banded"/>
        <algorithmParameter kisaoID="KISAO:0000479" value="0"/>
        <algorithmParameter kisaoID="KISAO:0000480" value="0"/>
        <algorithmParameter kisaoID="KISAO:0000481" value="true"/>
      </listOfAlgorithmParameters>
    </algorithm>
    <nlaAlgorithm xmlns="https://opencor.ws/libopencor" kisaoID="KISAO:0000282">
      <listOfAlgorithmParameters>
        <algorithmParameter kisaoID="KISAO:0000477" value="Dense"/>
        <algorithmParameter kisaoID="KISAO:0000479" value="0"/>
        <algorithmParameter kisaoID="KISAO:0000480" value="0"/>
        <algorithmParameter kisaoID="KISAO:0000486" value="200"/>
      </listOfAlgorithmParameters>
    </nlaAlgorithm>
  </uniformTimeCourse>
</listOfSimulations>

The "syntax" is the same as for algorithm and is more "standard".

Anyway, libOpenCOR can already generate this kind of SED-ML file, but it cannot currently read them. That's effectively all that is missing to have support for DAE models in libOpenCOR (since we can already compute ODE models and NLA models).


For this issue we want support for:

  • legacy OpenCOR's way of handling DAE models;
  • libOpenCOR's new way of handling DAE models.

For the former, we can test using the following DAE model. Using our libOpenCOR's playground, we can see that we can open and run the CellML file, but neither the SED-ML file nor the COMBINE archive. In the latter cases, we get a message that reads:

Error: task | Simulation: simulation 'simulation1' is to be used with model 'model' which requires an NLA solver but none is provided.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions