cvode_wrap
A wrapper around the cvode(S) ODE solver from sundials. Mirror of https://gitlab.inria.fr/InBio/Public/cvode-rust-wrap
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (4.5%) to scientific vocabulary
Keywords
Repository
A wrapper around the cvode(S) ODE solver from sundials. Mirror of https://gitlab.inria.fr/InBio/Public/cvode-rust-wrap
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
Readme.md
A wrapper around the cvode(S) ODE solver from sundials.
[ documentation ] [ lib.rs ] [ git repository ]
Building sundials
To build sundials, activate the sundials-sys/build_libraries feature.
Examples
Oscillator
An oscillatory system defined by x'' = -k * x.
Without sensitivities
rust
let y0 = [0., 1.];
//define the right-hand-side
fn f(_t: Realtype, y: &[Realtype; 2], ydot: &mut [Realtype; 2], k: &Realtype) -> RhsResult {
*ydot = [y[1], -y[0] * k];
RhsResult::Ok
}
//initialize the solver
let mut solver = SolverNoSensi::new(
LinearMultistepMethod::Adams,
f,
0.,
&y0,
1e-4,
AbsTolerance::scalar(1e-4),
1e-2,
)
.unwrap();
//and solve
let ts: Vec<_> = (1..100).collect();
println!("0,{},{}", y0[0], y0[1]);
for &t in &ts {
let (_tret, &[x, xdot]) = solver.step(t as _, StepKind::Normal).unwrap();
println!("{},{},{}", t, x, xdot);
}
With sensitivities
The sensitivities are computed with respect to x(0), x'(0) and k.
```rust let y0 = [0., 1.]; //define the right-hand-side fn f(t: Realtype, y: &[Realtype; 2], ydot: &mut [Realtype; 2], k: &Realtype) -> RhsResult { *ydot = [y[1], -y[0] * k]; RhsResult::Ok } //define the sensitivity function for the right hand side fn fs( _t: Realtype, y: &[Realtype; 2], _ydot: &[Realtype; 2], ys: [&[Realtype; 2]; NSENSI], ysdot: [&mut [Realtype; 2]; N_SENSI], k: &Realtype, ) -> RhsResult { // Mind that when indexing sensitivities, the first index // is the parameter index, and the second the state variable // index *ysdot[0] = [ys[0][1], -ys[0][0] * k]; *ysdot[1] = [ys[1][1], -ys[1][0] * k]; *ysdot[2] = [ys[2][1], -ys[2][0] * k - y[0]]; RhsResult::Ok }
const N_SENSI: usize = 3;
// the sensitivities in order are d/dy0[0], d/dy0[1] and d/dk let ys0 = [[1., 0.], [0., 1.], [0., 0.]];
//initialize the solver let mut solver = SolverSensi::new( LinearMultistepMethod::Adams, f, fs, 0., &y0, &ys0, 1e-4, AbsTolerance::scalar(1e-4), SensiAbsTolerance::scalar([1e-4; NSENSI]), 1e-2, ) .unwrap(); //and solve let ts: Vec<> = (1..100).collect(); println!("0,{},{}", y0[0], y0[1]); for &t in &ts { let (tret, &[x, xdot], [&[dy0dy00, dy1dy00], &[dy0dy01, dy1dy01], &[dy0dk, dy1dk]]) = solver.step(t as _, StepKind::Normal).unwrap(); println!( "{},{},{},{},{},{},{},{},{}", t, x, xdot, dy0dy00, dy1dy00, dy0dy01, dy1dy01, dy0dk, dy1_dk ); } ```
Owner
- Name: Arthur Carcano
- Login: krtab
- Kind: user
- Location: Paris, France
- Company: @OCamlPro
- Website: ngr.yt
- Repositories: 14
- Profile: https://github.com/krtab
Flazingly bast
Citation (CITATION.cff)
authors:
-
affiliation: "Inria, Institut Pasteur, Université de Paris"
family-names: Carcano
given-names: Arthur
orcid: "https://orcid.org/0000-0002-9946-1645"
cff-version: "1.1.0"
message: "If you use this software, please cite it using these metadata."
title: "cvode-wrap"
version: 0.1.3
doi: 10.5281/zenodo.5337060
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0