A small correction: I wrongly spelled PETSc as "PetSc" in the video. The source-code on GitHub has been fixed: github.com/Ceyron/machine-learning-and-simulation/blob/main/english/petsc/petsc_python_simple_heat_diffusion_1d.py And a pointer to the great collection of petsc4py demos, that could help you get started in more complicated scenarios (also with MPI): gitlab.com/petsc/petsc4py/-/tree/master/demo
@Ken-v1w8 ай бұрын
Thank you for sharing this useful tutorial. Hope to see more contents about PETSc and petsc4py!
@MachineLearningSimulation8 ай бұрын
Thanks for the kind comment 😊. Yes, I do have some more PetSc videos on my To-do list. There is a lot to show. For now, I follow more closely what I also do in my PhD, but there is definitely the plan to continue with the PetSc series at some point 😊
@asdf7777asd4 ай бұрын
Thaks for sharing this useful tutorial.
@MachineLearningSimulation3 ай бұрын
You're welcome 🤗
@SO-dl2pv2 жыл бұрын
Thank you very much for sharing your amazing work! Could you please do more videos about PETSc, I can't find any useful resources on internet to learn it. Thank you
@MachineLearningSimulation2 жыл бұрын
Hey :) Thanks for the comment, really appreciate your feedback. Sure, there will of course be more videos on PETSc, but unfortunately not in the near future. I am currently trying to continue on some older Playlists. Maybe in ~2 months I will return to the PETSc Playlist. :) In the meantime, maybe you find this collection of demos helpful: gitlab.com/petsc/petsc4py/-/tree/master/demo
@chenguangzhang82922 жыл бұрын
Great job! By the way, what's the editor or IDE you were using? I like its rendering of equations.
@MachineLearningSimulation2 жыл бұрын
Thanks a lot for the feedback, :) Much appreciated. I am using VS Code, the equations consist of Unicode symbols. I use the website www.unicodeit.net/ for this.
@chenguangzhang82922 жыл бұрын
@@MachineLearningSimulation Thank you. I always dream of an editor that can render markdown comments in-place within the code. I guess there is still a long way to go. Anyway, thanks for the website!
@MachineLearningSimulation2 жыл бұрын
@@chenguangzhang8292 You're welcome :) Maybe you find this helpful: marketplace.visualstudio.com/items?itemName=devzstudio.emoji-snippets
@jerryli302 жыл бұрын
thank you, this is very useful for my summer research! We are changing the implementation of one of our solvers from scipy to PETSc
@MachineLearningSimulation2 жыл бұрын
Wonderful! :) I'm glad I could help.
@OdhranOC2 жыл бұрын
Very useful stuff. Love the Python simulations. One question - why use manual differencing schemes when there exists packages like odeint or solve_ivp? Also I am curious to know if you know of other channels like this that use Python for CFD simulations?
@MachineLearningSimulation2 жыл бұрын
Good question! And thanks for the kind words. :) It's indeed possible. We could frame a mapping from a previous state to the derivative d(u)/d(t) as a function and then feed it into any ode integrator. Indeed, it can actually be beneficial, for instance, if we are not too interested in the temporal trajectory and then an adaptive integrator can make quite large time steps. I was not doing it here has two reasons: 1) It would be a bit too complicated. This video was aimed to be a super simple introduction to PetSc, and it can be quite some fiddling to get the interface with functions etc. correct. But, of course, that does not mean it's impossible. PetSc also has many great ODE steppers, and could use them in this semi-discrete "method-of-lines"-fashion 2) An argument against using ODE integrators is that the overall order of convergence of any discretized PDE is dominated by the order of convergence of the approximation with the lowest order. In other words: If we used a Runge-Kutta 4 integrator, which is consistent of order 4, and keep a Central difference approximation to the second derivative, which is consistent of order 2, our total order of convergence would be 2. Then we somehow used "a more expensive integrator" than necessary. Therefore, one commonly tries to balance the order of consistencies between all involved operators. Btw, that's also the reason one mostly only sees commercial CFD codes up to order 2 in convergence, with 2 being kind of the sweet spot there. But order of convergence is not everything. The usually interesting quantity is the efficiency of a numerical scheme, kind of defined as accuracy over computational cost. It is super hard to assess and highly problem- and scheme-dependent. In some cases, therefore, you see a higher efficiency when using a high-order ODE integrator together with a second-order spatial approximation. And regarding your question for KZbin channel. There are not much yet, unfortunately. That's also the reason this channel here exists ;). So I would extremely appreciate if you could spread the word and recommend the channel to your peers and colleagues. Though, one channel I liked was kzbin.info
@uqyge2 жыл бұрын
really nice work
@MachineLearningSimulation2 жыл бұрын
Thanks a lot
@learnmore_today2 жыл бұрын
Thank you for the video. Could you please do the same video but with Fortran ? I couldn't find anything as straightforward with Petsc in Fortran. And if you could make it in two parts it will be great: One without MPI and one with MPI. Thanks again!
@MachineLearningSimulation2 жыл бұрын
You're very welcome :). Thanks for the comment. I want to continue in the PETSc playlist, but I am currently working on the other series. I think I will return to it in a couple of months and will then also focus on implementations in FORTRAN. :) There is so much to show from PETSc, also with regard to MPI-based parallelism. Sorry for the potential delay between the comment and release of the video. Maybe you can find help on the PETSc website until then.
@learnmore_today2 жыл бұрын
@@MachineLearningSimulation I'll be waiting. Thanks again!
@lodo9787 Жыл бұрын
How can I open PETSC?
@MachineLearningSimulation Жыл бұрын
Hi, thanks for the comment 😊 I'm not quite sure what you mean. Do you want to install petsc4py (the package I used in this video), then I'd suggest to take a look at the installation instructions. This might be what you're looking for: www.mcs.anl.gov/petsc/petsc4py-current/docs/usrman/install.html
@qwm10072 жыл бұрын
A bit hard but interesting. Thank you.
@MachineLearningSimulation2 жыл бұрын
Hey, thanks for the feedback :) I would be interested to know what spots in the video were particularly difficult? I could use that as input to put more emphasis on certain parts in the next video. Happy to hear your thoughts :)
@qwm10072 жыл бұрын
@@MachineLearningSimulation I was confused by PETSc notations, but other things are clear. Why do we need line 110, why do we need to initialize it?
@MachineLearningSimulation2 жыл бұрын
@@qwm1007 Hey, I can understand the confusion. petsc4py has a rather un-pythonic interface. The initialization is kind of an artifact of how you would program MPI software. Take a look here: mpitutorial.com/tutorials/mpi-hello-world/ MPI_Init is always the first call to the MPI library on a node before any other MPI commands are allowed. It basically takes all the necessary flags the python file is execute with (which are saved in the sys.argv list) and extracts what is relevant for it. By this PETSc also figured out that we wanted the monitoring which we do towards the end of the video. Hope that helped :)