feat: sundials

This commit is contained in:
Henri Saudubray 2025-05-12 15:10:10 +02:00
parent 6cec3d6c5d
commit 80d4aef23f
Signed by: hms
GPG key ID: 7065F57ED8856128
8 changed files with 33 additions and 34 deletions

View file

@ -2,7 +2,4 @@
(library
(name solvers)
(libraries
hsim
;sundialsml
))
(libraries hsim sundialsml))

View file

@ -17,7 +17,7 @@ module Functional : Csolver.CsolverC =
let state = initialize (fun _ _ _ -> ()) (vec v) in
set_stop_time state 1.0; { state; vec=v } in
let reset { fder; init; stop; _ } _ =
let reset { fder; init; stop; _ } _ =
let fder t cvec dvec = Zls.blit (fder t cvec) dvec in
let state = initialize fder (vec init) in
set_stop_time state stop;

View file

@ -1,4 +1,4 @@
(*
open Hsim.Types
open Hsim.Solver
open Zls
@ -64,8 +64,8 @@ module InPlace : Csolver.Csolver =
let y = Nvector_serial.wrap s.vec in
let h, _ = solve_one_step s.state h y in
let f t = get_dky s.state y t 0; Nvector_serial.unwrap y in
(h, f), s in
(h, f), s in
DNode { init; reset; step }
end
*)

View file

@ -64,6 +64,6 @@ module InPlace : Zsolver.ZsolverC =
else (h, None), s in
let copy _ = raise Common.Errors.TODO in
DNodeC { init; step; reset; copy }
end

View file

@ -42,7 +42,7 @@ let copy c1 = let c2 = cmake (length c1) in blit c1 c2; c2
let blit_matrix m1 m2 = Array.iter2 blit m1 m2
let copy_matrix m = Array.map copy m
type 's f_alloc = unit -> 's
type 's f_maxsize = 's -> int * int
type 's f_csize = 's -> int
@ -126,7 +126,7 @@ module type STATE_ODE_SOLVER =
time [t] since the last mesh-point or the initial instant. *)
val get_dky : t -> dkyfn
(* generic solver parameters *)
val set_stop_time : t -> float -> unit
val set_min_step : t -> float -> unit
@ -196,7 +196,7 @@ module type STATE_ZEROC_SOLVER =
- the returned values is the simulation time of the earliest
zero-crossing that was found. *)
val find : t -> ((float -> int -> unit) * carray) -> zarray -> float
(* locate the fields for which there is a takeoff *)
val find_takeoff : t -> zarray -> float
end