Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
aa486408
Commit
aa486408
authored
Jun 21, 2019
by
REMONDEAU Paul
Browse files
now does not go beyond the final time of the simulation (20 by default)
parent
ac0ae2e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
rosenbrock.pl
View file @
aa486408
...
...
@@ -50,6 +50,7 @@ kinetics_init_hook :-
step_size
,
step_doubling
,
init_stoch
,
TIMETRESH
=
0.01
,
SAFE
=
0.9
,
GROW
=
1.5
,
PGROW
=
-
0.25
,
SHRINK
=
0.5
,
PSHRINK
is
-
1.0
/
3.0
,
ERRCON
=
0.1296
,
%MAXTRY = 40,
...
...
@@ -60,6 +61,7 @@ kinetics_init_hook :-
E1
is
17.0
/
54.0
,
E2
is
7.0
/
36.0
,
E3
is
0.0
,
E4
is
125.0
/
108.0
,
% C1X, C2X, C3X, C4X,
% A2X is 1.0, A3X is 3.0/5.0,
nb_setval
(
time_tresh
,
TIMETRESH
),
nb_setval
(
k_rbk_safe
,
SAFE
),
nb_setval
(
k_rbk_grow
,
GROW
),
nb_setval
(
k_rbk_pgrow
,
PGROW
),
...
...
@@ -271,6 +273,24 @@ counter(Times) :-
Times
is
Time
+
1
,
nb_setval
(
counterr
,
Times
).
final_interpolation
(
_
,[],
_
,[],
_
,[]).
final_interpolation
(
Time1
,[
Value1
|
Data1
],
Time2
,[
Value2
|
Data2
],
FinalTime
,[
NewValue
|
NewData
])
:-
NewValue
is
(
20
*
(
Value1
-
Value2
)
+
Time2
*
Value2
-
Time1
*
Value1
)
/
(
Time2
-
Time1
),
final_interpolation
(
Time1
,
Data1
,
Time2
,
Data2
,
FinalTime
,
NewData
).
final_interpolation
(
FinalTime
)
:-
%Make th final point at the time FinalTime, with linear interpolation between 2 last state
nb_getval
(
numerical_table
,
Data
),
get_last_line
(
Data
,
Time1
,
State1
),
last
(
Data
,
LastRow
),
append
(
Data2
,[
LastRow
],
Data
),
get_last_line
(
Data2
,
Time2
,
State2
),
final_interpolation
(
Time1
,
State1
,
Time2
,
State2
,
FinalTime
,
FinalValues
),
FinalRow
=..
[
row
,
FinalTime
|
FinalValues
],
append
(
Data2
,[
FinalRow
],
FinalData
),
nb_setval
(
numerical_table
,
FinalData
).
rosenbrock
(
Equations
,
InitialTime
,
Duration
,
Parameters
,
Jacobian
)
:-
% formal differenciation
...
...
@@ -335,6 +355,7 @@ rosenbrock(Equations,InitialTime,Duration,Parameters,Jacobian) :-
nb_setval
(
numerical_table
,
NewTable
),
EventTime
>=
FinalTime
,!,
%end_event,
final_interpolation
(
FinalTime
),
nb_setval
(
hdid
,
0
).
...
...
rosenbrock.plt
0 → 100644
View file @
aa486408
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment