usnistgov / fipy

FiPy is a Finite Volume PDE solver written in Python
http://pages.nist.gov/fipy/en/latest
Other
504 stars 148 forks source link

How to C inline the fipy programme? #922

Closed Sandip433 closed 1 year ago

Sandip433 commented 1 year ago

Hi, I am using fipyTWO TEMPERATURE MODEL.txt (3.4.3) to simulate TWO TEMPERATURE MODEL . But the program is slow. I want to use C inline and --no cache to speed up. I could not make it work. Here is the code I am using.

Sandip433 commented 1 year ago

Also I was wondering other ways to speed up python code(like using numba package, cython or codon ) could work with fipy.

guyer commented 1 year ago

The weave module was removed from scipy many years ago, although it still exists. FiPy --inline has known issues (#629) and we do not test it; we should update the documentation to reflect that. Despite what the docs say, I only ever found the speed gains to be modest, at best (factor of 2 or so?); @wd15 may have seen better, but not consistently.

Sandip433 commented 1 year ago

i) Sir I imported inline command line from fipy.tools but it did not affect the overall time required to perform calculations . ii) When I try to run the program for 100 pico seconds , it takes several hours to complete the task . If I use Labview software( this software I am using to control the machine , also to simulate the experiment theoretically) , the calculations are done in minutes. iii) I tried different time steps to get similar results which I got from the experiment. I tried different cell sizes and grid spacing . Initially I was instructed by my supervisor to use 0.5 fs as time step but I got consistent results from 4 fs and below. This result I was trying to get . TTM

guyer commented 1 year ago

I know nothing about the two temperature model (it is very hard to help when you neither state nor reference what equations you're trying to solve). That said:

Sandip433 commented 1 year ago

Fipy works well to solve Two Temperature Model TTM1.pdf i) You are write about laser depth . I corrected that part and the program runs well. ii)This figure TTM I got solving Two Temperature Model with co-efficients using Fipy program specified above. Fipy has no issue of inaccuracy or instability for non - linearity. I just want see if there is any other way to run the program faster than current speed.