Closed meloun67 closed 9 months ago
@svoboad3 if you were bored you can check the math problem - for Langmuir's isotherm (even implicite method for Linear one) and try to come up with something (but it is not neccessary - it's my pill to swalow 😺)
Here is the solution: EDM_nonlinear_ExplicitCentral.docx
Please try to program it. You can use this colab script as a template.
Also please program new function "Convergence_check.py" which checks if the solution is converging according to "Proof of Convergence" in the document. Input for this fuction should be also relative threshold. If value of f(x)/mfeed (relative mass difference) is lower than threshold then the loop is terminated and value k is returned.
Basically, idea is to find the highest k which actually fulfils the threshold.
ye I don't understand the math of this at all, don't know if you want me to to basically copy the entire script you posted and make function out of it but I don't feel like that's useful. Same goes for #13
In the convergence proof, I don't understand what k is and how it affects the function.
I have a few clarifying questions:
Ok its mostly done but output it gives seems wrong, we should go over it sometime and look for errors(I kept the same output of Lin_Solver for testing purposes). Convergence check should also be mostly done but I cant really test it without Nonlin_Solver working correctly.
I have found some mistakes in math, could you please correct it in program: document
Also please try somehow to somehow smooth up the "corners" of the feed pulse function. I believe that it causes the problems in case of explicit solution. The way how you do it is up to you, I believe you will find out something smart. Thanks a lot!
Inspiration: Fit_Gauss.py or Cubic Splines
feed[0] = feedConc - elimination of one infinite derivative
Convergence check: use scipy.optimize.minimize_scalar() bounds = (3,inf) method='bounded' tol = 0.01 (to be tested - maybe it is threshold)
This is a output of the Nonlin_Solver having just fixed the math errors:
I have a problem with using Fit_Gauss this is the input dataframe: and this is the dataframe I get from Fit_Gauss:
One problem is that its different length, the second problem is that it returns all zeroes.
Cool, it looks much better... try to use cubic splines please and print the result (I guess you will need to delete few point nearby the corners)
In order to use Gauss_fit i believe zou would need to shift the pulse little bit away from zero. The 200 points is arbitrary number and can be changed in code (line 62)
The feed from Cubic splines based on how many points i remove looks like these:
Output for the adjusted feed (second picture) looks pretty similar to feed with no adjusted values:
also tried to just remove few point around the transition and it looks like this:
Good job! Seems like this one won't be so trivial. We need THIS. You can please try to find some code or (if you were bored) implement it by yourself.
I have also some ideas how to improve the the boundary/initial conditions formulations and formula for numerical solution. I just need some time to put it together.
Please try all bc_type options when calling scipy.interpolate.CubicSpline
bc_type=‘clamped’, first is using lesser density of points, second is removing few points around the transition:
bc_type=‘natural’, first is using lesser density of points, second is removing few points around the transition:
looks same right? could you remove maybe few more points around transition? Does it affect the final solution already? Also increasing of Nx should help.
Numerical solver of the EDM with Langmuir Isotherm - nonlinear parabolic PDE