An Help with ODE system

An Help with ODE system - Сообщения

#41 Опубликовано: 30.11.2020 09:46:59
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

It is possible to solve the system in this way, i.e. integrating each equation separately. But here you need to be very careful.
...



Hi Viacheslav. Please, explain me with more details about what do you do. I have two questions:

1. Original equations are decupled? Sorry, I don't check that, I ask it because I assume you see this problem in depth and it's easy for you answer this.
2. Is your setup general for solve an ode with a large interval of integration? This is, I know that if the domain for an ode is too large, numerical methods can be implemented "by parts", with small portions of it, but actually never use that in the practice, or remember practical examples of it.

Best regards.
Alvaro.
#42 Опубликовано: 30.11.2020 10:43:16
francesco88

francesco88

1 сообщений из 34 понравились пользователям.

Группа: User

Wrote

Euler is still good.

Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 2 (uni).png



Viacheslav, thanks a lot for this advice.

Now I try to see if I can make it all work.
Veniamo da molto lontano e andiamo molto lontano! Palmiro Togliatti
#43 Опубликовано: 30.11.2020 11:30:17
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

Hi Viacheslav. Please, explain me with more details about what do you do. I have two questions:

1. Original equations are decupled? Sorry, I don't check that, I ask it because I assume you see this problem in depth and it's easy for you answer this.


No. I showed the same method, only written differently. For this example both algorithms do almost the same thing.

Wrote

2. Is your setup general for solve an ode with a large interval of integration? This is, I know that if the domain for an ode is too large, numerical methods can be implemented "by parts", with small portions of it, but actually never use that in the practice, or remember practical examples of it.


Yes, you can split a large interval into small portions. The solvers themselves do this. Usually inside the solver there is a loop in which a so-called step-function is called for each portion. This step-function can also split the portion into small parts depending on the complexity or accuracy of the method.

I didn’t point out correctly that it can be integrated separately. I meant that you can split the vector of derivatives D(t,x) into separate parts and integrate each element separately. Since the equations are dependent on each other, then this should be done as I showed.

I did this to make it easier to add elements to the vector of derivatives. Instead of one huge program block, you get many small expressions. This may not always be done, but if the derivatives are smooth over a given interval, then you can even use Euler's method.

I just took the inner for-loop of the solver out and limited the solution to two points (one step). That's all.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Alvaro Diaz Falconi 30.11.2020 12:25:00
#44 Опубликовано: 30.11.2020 12:38:10
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

I have seen this type of construction from Viacheslav himself, long time ago.
Just not directly implementable from the ODE library, maybe the last SS.
1. Fill-in all those '?' ... what are they ?
2. Compare solutions with the "paper PDF"
3. The compactum program adds confusion.
4. Always think in term of sanity check outside Smath, i.e: make it piece wise.

Prova modello permeabilita Initial.sm (158 КиБ) скачан 27 раз(а).
#45 Опубликовано: 30.11.2020 14:33:17
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi. Thanks Viacheslav for your answer. In the attached, the usual setup for the system of two equations with two unknowns, showing that uni's solution it's the same than the given by Rkadapt. I also can setup a good solution for a 4x4 ode system, but the r's coeffs must to be recalculated before the concentration of O & CO. If not we get a nonsense solution, and guess that this issue is why it's hard to setup a system with more variables, as efus comment that is required. So probably he must to study in which order the updates must to be evaluated for the physical situation.

But what's more impressive to me, it's the Viacheslav intuition for the magistral setup that he do for solve the problem with a runge kutta method with ... one as the step!. Ok, he's the author of the solver plugin, maybe he know what it's talking about.

Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 2 (uni).sm (23 КиБ) скачан 31 раз(а).

Best regards.
Alvaro.
#46 Опубликовано: 30.11.2020 15:15:22
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

I wanted a compact and scalable algorithm. You, Alvaro, did it better. It should be remembered that the values of the variables r1 and r2 are implicitly passed to the expressions for derivatives. The solvers also support optional parameters after t and x. You can enter both variables r1 and r2: D( t,x,r1,r2 ). This will make the calculation of derivative values clearer.

For those who are not familiar with numerical methods, it is difficult to describe the problem for the solver. I still can't finish a new solver, where the system can be written in a natural form, like a set of equations. This would make things easier for most typical cases.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Alvaro Diaz Falconi 30.11.2020 16:40:00
#47 Опубликовано: 30.11.2020 16:21:22
francesco88

francesco88

1 сообщений из 34 понравились пользователям.

Группа: User

In any case, I have really to give a very big thank you to every one of you.

What I'm learning from all your post is really useful and interesting.

Veniamo da molto lontano e andiamo molto lontano! Palmiro Togliatti
1 пользователям понравился этот пост
Alvaro Diaz Falconi 30.11.2020 16:47:00
#48 Опубликовано: 30.11.2020 16:44:44
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

... The solvers also support optional parameters after t and x. You can enter both variables r1 and r2: D( t,x,r1,r2 ). This will make the calculation of derivative values clearer.



I did not know this feature of your plugin. Here, in case that this setup it's ok, it fails, I guess for the order in the updates too.

Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 2 (uni).sm (51 КиБ) скачан 30 раз(а).

Best regards.
Alvaro.
#49 Опубликовано: 30.11.2020 16:45:29
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

What I'm learning from all your post is really useful and interesting.


The ancestor of all these solvers is Euler [Fortran 1970], print stars instead of line.
Your two system DE's can you make them Euler style ?

ODE Euler Multitask.sm (129 КиБ) скачан 41 раз(а).
#50 Опубликовано: 30.11.2020 21:08:01
francesco88

francesco88

1 сообщений из 34 понравились пользователям.

Группа: User

Wrote

Wrote

What I'm learning from all your post is really useful and interesting.


The ancestor of all these solvers is Euler [Fortran 1970], print stars instead of line.
Your two system DE's can you make them Euler style ?

ODE Euler Multitask.sm (129 КиБ) скачан 41 раз(а).



To be honest, really I don't know if is possible, I can try and we will see what happens.

The problem with these 5 ODE is that they aren't really stable and a lot of strange things happen if the order of resolution isn't correct.

For sure isn't the best-case scenario to face for someone like me, that has basically zero experience with software/numerical methods.

Now I'm sure that in R someone was able to implement and validate it...but really I would like to avoid it for the moment

I will spend this week working on all your advice and trying various approaches, in a way or another some sort of result will come!
Veniamo da molto lontano e andiamo molto lontano! Palmiro Togliatti
#51 Опубликовано: 30.11.2020 21:35:52
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

The problem with these 5 ODE is that they aren't really stable


Why don't you stick with the two DE's from the paper ?
In fact you just want to reproduce the paper, before getting lost in adventure.
If all those things/coefficients aren't identified, may as well don't have.
Presume some smart cat has done the project otherwise than Smath,
looking at your proposal will discredit both in red cross all over.
Why not first reproduce the paper 1/1, c/w the plotted solutions ?
From there, if solutions deviate from lab test ... what is the cause.
This is in fact the interest of the adventure, isn't ?
#52 Опубликовано: 01.12.2020 02:59:33
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

I did not know this feature of your plugin. Here, in case that this setup it's ok, it fails, I guess for the order in the updates too.


This was mentioned here.

Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 3 (uni).sm (18 КиБ) скачан 32 раз(а).
Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 3 (uni).pdf (79 КиБ) скачан 25 раз(а).

Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 4 (uni).sm (18 КиБ) скачан 31 раз(а).
Modeling respiration-transpiration in a modified atmosphere packaging system containing blueberry 4 (uni).pdf (77 КиБ) скачан 35 раз(а).

This is an optional feature. Everything works without explicitly specifying variables, but this is not always clear.

Файл не найден. Файл не найден.
Russia ☭ forever, Viacheslav N. Mezentsev
#53 Опубликовано: 01.12.2020 07:34:38
francesco88

francesco88

1 сообщений из 34 понравились пользователям.

Группа: User

Wrote

Wrote

The problem with these 5 ODE is that they aren't really stable


Why don't you stick with the two DE's from the paper ?
In fact you just want to reproduce the paper, before getting lost in adventure.
If all those things/coefficients aren't identified, may as well don't have.
Presume some smart cat has done the project otherwise than Smath,
looking at your proposal will discredit both in red cross all over.
Why not first reproduce the paper 1/1, c/w the plotted solutions ?
From there, if solutions deviate from lab test ... what is the cause.
This is in fact the interest of the adventure, isn't ?



Jean, unfortunately, the model on paper has more than these two ODE, so even for the comparing of results would be needed to implement all the other pieces. The respiration and transpiration rate are both temperature-dependent.

Capture.PNG

In any case, the implementation of the system of two made by Viacheslav work really well and the results have a physical sense, so being more precise require do add more things.


Someone suggest me to try to use lsoda for this problem...I have to try.

You know "Audentes Fortuna iuvat"
Veniamo da molto lontano e andiamo molto lontano! Palmiro Togliatti
#54 Опубликовано: 01.12.2020 13:25:15
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

ISODA is too much for me, I didn't see much maths/graphs.
My friend next door used to transport raspberries from California => Montréal.
Temperature control was fine. The most impressive was the opening of the cargo
at destination. They had to wear mask of the Scot Pack style to avoid poisoning
from the dreadful environment in the cargo.
A DE's system of 7 is pretty big monster. It could probably be optimized via
Mathcad ODEsolve, GivenMinerr, having the 7 sets of lab data. Up to 3 was done
for different applications [Medical, Chemical ...]
@ 1000 km per driver, California => Montréal is 3 days journey 2 drivers.
Hurry to see the 7 parametric DE's system in piece wise mode.
Cheers ... Jean
#55 Опубликовано: 01.12.2020 13:32:36
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Wrote

Wrote

I did not know this feature of your plugin. Here, in case that this setup it's ok, it fails, I guess for the order in the updates too.


This was mentioned here.
...



Hi uni. I forgot this feature because I always thinks that it was the same as the matlab parameter placeholder, just to avoid to declare global variables for the local ones that usually appear in the m-script for define the function D. This could be more or less useless in SMath but here I think that you have an actual example of a mandatory use for this feature, because if not the RK procedure gives a bad solution if you don't pay attention to the order of the updates inside the D procedure, as first issue. I guess that there are more.

Wrote


...

This is an optional feature. Everything works without explicitly specifying variables, but this is not always clear.



I bad implement this feature in my example, and you show how to implement it well. Just as comment, for no pass parameters as global values at all, this is a minor modification:

Clipboard01.jpg

Wrote

...
Capture.PNG

In any case, the implementation of the system of two made by Viacheslav work really well and the results have a physical sense, so being more precise require do add more things.
...



Thanks efus for this drawing describing the physical situation.

Best regards.
Alvaro
#56 Опубликовано: 01.12.2020 14:05:26
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

.... that's what I meant by piece wise modular [a system of 8 DE's]
Radau DE solver was designed by Mathsoft for this difficult example.
dn_GearsBDF does 1/1 in native Smath.

ODE HIRES.sm (67 КиБ) скачан 29 раз(а).
#57 Опубликовано: 01.12.2020 14:18:01
francesco88

francesco88

1 сообщений из 34 понравились пользователям.

Группа: User

Ok, starting from an example from Viacheslav (Thx really a lot for all your work) I was able to use lsoda for the two and the result is quite good, so I will try to work another little on this road and we will see if I will be able also to add the others pieces.

Edit.

Ok, probably how the system is written isn't the most elegant thing to see, but the loss of weight due to respiration seems to be well represented (green line). The effect of the humidity isn't, at the moment, represented, but with a little bit of work I think it will do.
lsoda MAP.sm (43 КиБ) скачан 24 раз(а).


Capture.PNG

Цитата

. that's what I meant by piece wise modular [a system of 8 DE's]
Radau DE solver was designed by Mathsoft for this difficult example.
dn_GearsBDF does 1/1 in native Smath.



Thx a lot Jean, now I give it a look, I'm quite sure that I can learn useful stuff from it!

Цитата

Thanks efus for this drawing describing the physical situation.



:d Ah google come in my help for the pictures, but yes, it describes exactly what happened in the package.
Veniamo da molto lontano e andiamo molto lontano! Palmiro Togliatti
#58 Опубликовано: 01.12.2020 17:21:06
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hi efus. Maybe you could be interested in the coolprop plugin.

Clipboard01.jpg

Help for humid air: http://www.coolprop.org/fluid_properties/HumidAir.html
Collprop for SMath: https://en.smath.com/forum/yaf_postst7398_CoolProp-Wrapper.aspx

Also, I see your loda implementation, it's ok, and I don't know if the fact that you redefine the parameter "y" in the body of D() have any implication, but you must to know that in SMath if you pass parameters in that way "things happens":

Clipboard01.jpg

Best regards.
Alvaro.
#59 Опубликовано: 01.12.2020 17:50:32
francesco88

francesco88

1 сообщений из 34 понравились пользователям.

Группа: User

Wrote

Hi efus. Maybe you could be interested in the coolprop plugin.

Help for humid air: http://www.coolprop.org/fluid_properties/HumidAir.html
Collprop for SMath: https://en.smath.com/forum/yaf_postst7398_CoolProp-Wrapper.aspx

Also, I see your loda implementation, it's ok, and I don't know if the fact that you redefine the parameter "y" in the body of D() have any implication, but you must to know that in SMath if you pass parameters in that way "things happens":


Best regards.
Alvaro.



The plugin is for sure interesting! I have intention in the future to face some problem related to respiration with a pure thermodynamic approach, so for sure it will be handy!

Regarding "things happens" I have to make some confrontation in the results, but for sure know this is extremely important! So thank you a lot!

Francesco.
Veniamo da molto lontano e andiamo molto lontano! Palmiro Togliatti
#60 Опубликовано: 01.12.2020 19:24:59
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Franceso,
What I understand, this particular project is Isoda Blueberries
It can't be sanity check via one of the most, if not the most reputed Mathcad/Mathsoft.
Not even from native original Smath ... any lab data set to sanity the plots ?
We are not in phase in this project, sorry ... Cheers ... Jean gone.
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений