Skip to content
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

Implement missing CAPI methods #115

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Implement missing CAPI methods #115

merged 1 commit into from
Sep 2, 2024

Conversation

schmoelder
Copy link
Contributor

@schmoelder schmoelder commented Jul 11, 2022

Since PR #59 was closed prematurely, this is a continuation.

Original description:
Adds a simple C interface to libcadet. The parameter provider interface
is realized by callback functions. A simulation can be performed and
the solution at the outlet of the unit operations can be queried.

Also includes a test application that dynamically loads the library at
runtime (only Windows) and executes a simulation specified in JSON
format internally.

This commit provides the first steps regarding #16 and, thus, #12.

To do:

  • Inlet
  • Outlet
  • Bulk
  • Particle
  • Solid
  • Flux
  • Volume
  • InletDot
  • OutletDot
  • BulkDot
  • ParticleDot
  • SolidDot
  • FluxDot
  • VolumeDot
  • InletSens
  • OutletSens
  • BulkSens
  • ParticleSens
  • SolidSens
  • FluxSens
  • InletDotSens
  • OutletDotSens
  • BulkDotSens
  • ParticleDotSens
  • SolidDotSens
  • FluxDotSens
  • VolumeDotSens
  • LastState
  • LastStateTimeDot
  • LastUnitState
  • LastUnitStateDot
  • LastSensitivityState
  • LastSensitivityStateDot
  • LastSensitivityUnitState
  • LastSensitivityUnitStateDot
  • Coordinates
  • SolutionTimes
  • getNumUnits
  • Simulation runtime (/meta/time_sim)
  • /meta/file_format

Moreover, some things are still unclear / inconsitent and will be addressed later, see #283

@schmoelder schmoelder force-pushed the feature/capi branch 6 times, most recently from ad2bdaa to f88e04c Compare July 18, 2022 16:29
@schmoelder
Copy link
Contributor Author

We implemented most of the methods but still need to test them (which we will do in tomorrow's Dev-Call). The reason why the test suite fails is probably because of the following:

https://github.com/modsim/CADET/blob/master/test/testCAPIv1.cpp#L3

So we need to modify the tests to make them OS independent.

@schmoelder schmoelder force-pushed the feature/capi branch 2 times, most recently from 405a3cf to 5b99a23 Compare July 28, 2022 08:34
@schmoelder schmoelder mentioned this pull request Feb 17, 2023
@schmoelder schmoelder force-pushed the feature/capi branch 2 times, most recently from cf51499 to 1883e4a Compare March 27, 2024 17:34
@ronald-jaepel ronald-jaepel added this to the v5.0.0 "CADET-Core" milestone Jun 12, 2024
@schmoelder schmoelder force-pushed the feature/capi branch 2 times, most recently from 22447a7 to c0fc3d8 Compare August 16, 2024 11:41
@jbreue16
Copy link
Contributor

The file format is hardcoded in both the driver.hpp where the meta output is written and now also hardcoded (with value 040000) for the CAPI.

@jbreue16 jbreue16 force-pushed the feature/capi branch 2 times, most recently from 5f8bfab to 4d8ce95 Compare August 16, 2024 14:00
@schmoelder
Copy link
Contributor Author

I don't understand the build issue with MacOS. If you have time, could you please have a look @sleweke?

@schmoelder schmoelder marked this pull request as ready for review August 23, 2024 12:27
@schmoelder
Copy link
Contributor Author

This PR is ready to be reviewed! 🥳

We test all unit operations using createLWE with different combinations of solution recorders (i.e. split_components=True/False etc) in CADET-Python and check that the simulation outputs have the correct shape. We could also consider adding such test in test/testCAPIv1.cpp but for now, it seems "good enough" to me. @jbreue16 and I also had some discussions about the parametrization of tests and that for system tests, we could also consider writing Python scrips as they are much easier to maintain and extend. If I'm not mistaken, that's also something he does for the convergence tests.

@schmoelder schmoelder requested a review from sleweke August 23, 2024 12:29
@jbreue16 jbreue16 mentioned this pull request Sep 2, 2024
5 tasks
@jbreue16 jbreue16 self-requested a review September 2, 2024 14:33
Copy link
Contributor

@jbreue16 jbreue16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MacOS build has been fixed, and all tests have successfully passed. Dimensionality of outputs has been thoroughly tested by @schmoelder.

All necessary changes for v5 have been implemented. Any outstanding issues are documented in #283.

jbreue16 added a commit that referenced this pull request Sep 2, 2024
* Add various missing CAPI methods

* Add write last sensitivity state for units

* Do not write out particle dimension for LRMP

* Add method to return CAPI version number

* Update documentation

Co-authored-by: Johannes Schmoelder
<[email protected]>
Co-authored-by: Jan Breuer <[email protected]>
jbreue16 added a commit that referenced this pull request Sep 2, 2024
* Add various missing CAPI methods

* Add write last sensitivity state for units

* Do not write out particle dimension for LRMP

* Add method to return CAPI version number

* Update documentation

Co-authored-by: Johannes Schmoelder <[email protected]>
Co-authored-by: Jan Breuer <[email protected]>
@cadet cadet deleted a comment from github-actions bot Sep 2, 2024
* Add various missing CAPI methods

* Add write last sensitivity state for units

* Do not write out particle dimension for LRMP

* Add method to return CAPI version number

* Update documentation

Co-authored-by: Johannes Schmoelder <[email protected]>
Co-authored-by: Jan Breuer <[email protected]>
@jbreue16 jbreue16 merged commit 24b9ba0 into master Sep 2, 2024
4 checks passed
@jbreue16 jbreue16 deleted the feature/capi branch September 2, 2024 15:14
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Create a plain C API for interfacing with the core simulator In-memory Python interface
4 participants