fipy | FiPy is a Finite Volume PDE solver written in Python
kandi X-RAY | fipy Summary
kandi X-RAY | fipy Summary
FiPy is a Finite Volume PDE solver written in Python
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Test if this is a binary operation .
- Run leveler .
- Compute the union of two meshes .
- Compute the shape of an index .
- Test method .
- Return a dict of command - line arguments .
- Reads the node data .
- Runs a simple trench system
- Open a . mmh file .
- Builds a diffusion term equation
fipy Key Features
fipy Examples and Code Snippets
Community Discussions
Trending Discussions on fipy
QUESTION
I am currently trying to solve a large PDE system with 18 PDEs and ODEs (which is why I use FiPy and not odeint from scipy). One of the equations is quite simple: dROS/dt = 0.06 which I implemented as follows:
...ANSWER
Answered 2022-Feb-02 at 14:00[Answered on GitHub. Please ask in one location or the other, but not both]
You are taking 3650 steps of size 1e-5, for a total duration of 3.65e-2, so I would expect ROS to be 0.00219 at the end, which is what happens.
This equation is linear in ROS, so there's no need to sweep it.
QUESTION
I am trying to solve a set of PDEs with FiPy, but not sure how to represent the equations: see the PDEs here.
The terms give me trouble are those in red rectangle and blue rectangle. The one in red rectangle is a convection term times a function depending on x, T1 and T2; The one in blue rectangle is a transient term times another function depending on x, T1 and T2.
I couldn't find any example including this kind of terms. Could you please give me some suggestions, or share me an example?
I appreciate any help. Thanks in advance.
...ANSWER
Answered 2021-Dec-29 at 18:43This question is similar to cellvariable*Diffusion in fipy, but for convection instead of diffusion. The solution is the same though. Use,
to convert the red terms into a convection term with a coefficient of f and a source term.
For the blue terms do exactly the same to get a transient term with a coefficient and a source term.
Edit: if we assume that then we can still use
and approximate explicitly (with f as a variable in FiPy and use grad
). However, we can take it further and use,
and approximate the final explicitly.
Again, we can go even further with,
Again the last term can be solved explicitly. Depending on the form of f
the last them should become more insignificant and thus, the explicitness less of an issue.
QUESTION
Still with my bird migration, I would like to represent the return of the birds in Europe after spending time in Africa.
To achieve that, I need to be able to "reverse" the diffusion of the birds. I tried to put a negative coefficient for diffusion, but it doesn't work of course. So I wonder if it is possible to achieve this with FiPy.
...ANSWER
Answered 2021-Dec-20 at 19:05That won't work. Diffusion is not a reversible operator. Try to define the problem with maths and then we can help to implement the equations in FiPy.
QUESTION
I am trying to develop a model that represent the stork migration from France to middle Africa. I chose to go with FiPy.
I would like to set the time as a full migration time : First, storks diffuse randomly in France, but when the time gets to a limit value, migration begins and an advection coefficient appear.
I tried first with the Diffusion coefficient and it works :
...ANSWER
Answered 2021-Dec-15 at 15:35These:
QUESTION
Clearly an 1D Poisson equation with a constant source has an unique solution even if both Dirichlet and Newmann boundary conditions are on the same side. However I can't think of a way to solve this in FiPy. Please advise. I tried:
...ANSWER
Answered 2021-Dec-06 at 19:26Having both a Dirichlet and a Neumann on the same face in FV turns the nature of the problem from a boundary value problem into an initial value problem. In that sense the problem becomes over-specified as the right hand side boundary condition is still required. There may be ways to handle it with FD/FV with some hacks. However, FiPy certainly isn't set up to handle this type of problem.
QUESTION
Running Manjaro stable with python-3.9 and python-fipy-3.4.2.1-1.
Just got started with FiPy, ultimately interested in writing single and two-phase flow code. Naturally I tried to run examples/flow/stokesCavity.py
(stripped down from all rst text) with: python stokesCavity.py
and it throws the following error:
ANSWER
Answered 2021-Nov-17 at 22:44In this line, change
QUESTION
I have written a code that gets some vertex and rearranged them based on some rules. When the input contains big data, the code runs very slowly e.g. for 60000 loops it will take about 15 hours on google colab TPU runtime. I have found JAX is one of the best libraries to do so and trying to use it, but due to lack of experience in dealing with such big data and its related methods such as parallelization, I have faced to some problems. The following small sample is created to show what does the code doing:
...ANSWER
Answered 2021-Oct-03 at 16:29Writing efficient JAX code is very similar to writing efficient NumPy code: generally if you are using a for
loop over rows of your data, your code will not be very efficient. Instead, you should strive to write your computations in terms of vectorized operations.
In your code, it looks like you are relying on many non-JAX elements (e.g. NumPy masked arrays, operations in FiPy, etc.) so it's unlikely that JAX will be able to improve your runtime. I'd focus instead on rewriting your code to make efficient use of NumPy, replacing the for
-loop logic with NumPy vectorized operations.
Here is an example of expressing your function in terms of vectorized operations:
QUESTION
I have two meshes defined in FiPY as follows:
...ANSWER
Answered 2021-Sep-29 at 11:44FiPy doesn't provide any capability like this and isn't likely to. If your
meshes were simply connected and convex, then you could use
scipy.spatial.tsearch
with the mesh vertices.
Unfortunately, based on your previous questions, this approach
won't work for you.
Many years ago, I did some work with semiconductor heterostructures, where I needed to account for different domain geometries built up during successive lithographic and electrodeposition steps. I used the Shapely package to define abstract geometrical domains and then converted those domains to a FiPy mesh with Gmsh. Shapely can be used to check point containment, even when the domains are concave or disconnected. The specifics were a bit different from what you're doing, but I believe it's still applicable.
This gist illustrates building multiple complex domains, checking point containment in them, and then generating a single FiPy mesh from them (which was my use-case; you could generate separate meshes from separate domains).
QUESTION
I have the following code representing a .geo file for Gmsh that I want to load in FiPy for process simulation. It contains: (i) Oxide, (ii) Silicon and (iii) Gas as physical entities that needs to identified as separate meshes.
...ANSWER
Answered 2021-Aug-12 at 15:47Here is a refinement on the brute-force solution I initially offered:
QUESTION
I am trying to simulate the elementary unit of a 2D system that have a P6mm symmetry in fipy and I would like to define a non-cartesian mesh that describes the system described below. Yet,
...ANSWER
Answered 2021-Sep-15 at 18:21FiPy does not provide a mesh class for what you want. UniformGrid2D could be used as the starting point for an equilateral triangular mesh (or a hexahedral mesh, if really required). StackOverflow isn't the right venue for that, though. Please open an issue if you'd like to pursue that.
Gmsh will produce structured, triangular meshes, but I'm not sure it can be forced to produce regular, equilateral triangles.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fipy
You can use fipy like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page