fipy

FIPY: problem with Grid2D cellToFaceDistanceVectors gives error 'UniformGrid2D' object has no attribute '_cellToFaceDistanceVectors'

半腔热情 提交于 2021-02-11 18:16:07
问题 I create a mesh using Grid2D as follows L = 2. N = 50 dL = L/N mesh = Grid2D(nx=N, ny=N, dx=dL, dy=dL) but when I try to get the cell to face distance vector: mesh.cellToFaceDistanceVectors the following error appears: AttributeError Traceback (most recent call last) <ipython-input-7-9ab623a3d90d> in <module>() ----> 1 mesh.cellToFaceDistanceVectors /usr/local/lib/python3.6/dist-packages/fipy/meshes/abstractMesh.py in <lambda>(s) 96 rank=1) 97 ---> 98 cellToFaceDistanceVectors = property

How to set the parameter 'underRelaxation' to a coupled equation?

纵然是瞬间 提交于 2021-02-11 13:27:23
问题 I know that we can set the parameter 'underRelaxation' if we use 'sweep' to solve the equation. eg: xVelocity_eq.sweep(dt=dt, underRelaxation = 0.5) But how to set this parameter to coupled equation. eg: coupled_eq = xVelocity_eq & yVelocity_eq & zVelocity coupled_eq.sweep(dt=dt,underRelaxation = ?) I have tried set underRelaxtion = 0.5 and set underRelaxation as a array like following code: relaxation = np.zeros(len(self.yVelocity) + len(self.zVelocity) + len(self.xVelocity)) relaxation[:] =

How to set the parameter 'underRelaxation' to a coupled equation?

让人想犯罪 __ 提交于 2021-02-11 13:25:04
问题 I know that we can set the parameter 'underRelaxation' if we use 'sweep' to solve the equation. eg: xVelocity_eq.sweep(dt=dt, underRelaxation = 0.5) But how to set this parameter to coupled equation. eg: coupled_eq = xVelocity_eq & yVelocity_eq & zVelocity coupled_eq.sweep(dt=dt,underRelaxation = ?) I have tried set underRelaxtion = 0.5 and set underRelaxation as a array like following code: relaxation = np.zeros(len(self.yVelocity) + len(self.zVelocity) + len(self.xVelocity)) relaxation[:] =

datamin and datamax in Viewer() did not work

风流意气都作罢 提交于 2021-02-08 10:20:22
问题 I used the above code in the fipy, but the range of color bar is always not changed( always showed [-1,1]). My version is Python 3.6.7 and matlablib 3.1.1. #create a viewer to see the results if __name__ == '__main__': viewer = Viewer(vars=psi, datamin=-0.01, datamax=0) viewer.plot() I tried the following: 1, I changed the code in "C:\Users\Lenovo\fipy\examples\diffusion", for example, changed "datamin=-0.01, datamax=0". is not work. 2, directly used "MatplotlibViewer". is not work. 3, used

Coupling pdes across various domains using fipy

旧城冷巷雨未停 提交于 2021-01-29 19:21:43
问题 I am completely new to fipy. I am trying to solve the following set of pdes across two different domains using fipy. The variables are p,n and ψ and q,Dn,Dp,un,up,e and N are all constants. N and e change values from domain 1 to domain 2. Domain 2 is a rectangular domain stacked above a similar rectangular domain 1. The variables p and n are to be solved for in domain 1 and ψ is to be solved for in both the domains- domain1 and domain 2. qDn∇2n − qun∇.(n∇ψ) = q(n-10**11)/10**(-6), in Domain 1

Coupled non-linear equations in FyPi

不羁岁月 提交于 2021-01-29 08:47:49
问题 I'm trying to set up a system for solving these 5 coupled PDEs in FyPi to study the dynamics of electrons and holes in semiconductors The system of coupled PDEs I'm struggling with defining the terms highligted in blue as they're products of one variable with gradient of another. For example, I'm able to define the third equation like this without error messages: eq3 = ImplicitSourceTerm(coeff=1, var=J_n) == ImplicitSourceTerm(coeff=e*mu_n*PowerLawConvectionTerm(var=phi), var=n) +

Solver tolerance and residual error when using sweep function in FiPy

别说谁变了你拦得住时间么 提交于 2019-12-24 11:54:00
问题 I was trying to use FiPy to solve a set of PDEs when I realized the command sweep was not working the way I thought it would. Here goes a sample with part of my code: from pylab import * import sys from fipy import * viscosity = 5.55555555556e-06 Pe =5. pfi=100. lfi=0.01 Ly=1. Nx =200 Ny=100 Lx=Ly*Nx/Ny dL=Ly/Ny mesh = PeriodicGrid2DTopBottom(nx=Nx, ny=Ny, dx=dL, dy=dL) x, y = mesh.cellCenters xVelocity = CellVariable(mesh=mesh, hasOld=True, name='X velocity') xVelocity.constrain(Pe, mesh

EnvironmentError: Gmsh version must be >= 2.0

孤街醉人 提交于 2019-12-24 00:58:31
问题 I am new to fipy, so excuse my ignorance if I ask something that should be obvious. But I fail to run an already existing (and working - on other machines) script, getting the EnvironmentError: Gmsh version must be >= 2.0. I may have missed something during the installation? Fipy manual is a bit vague about implementation of gmsh. It only provides the link to download file and that meshes can be generated by it, but it doesn't say WHERE gmsh should be installed (so I have my gmsh-3.0.3

Gmsh mesh parallel execution in fipy

偶尔善良 提交于 2019-12-23 01:05:56
问题 I am trying to solve parallel on a gmsh mesh. While loading the .geo file, an error occurs, "raise EnvironmentError("Gmsh version must be >= 2.0.")" My installed gmsh version is 2.8.3, (I have also tried 2.13, 2.10, nothing works) The parallel.py file in the example is executing properly and the meshes are properly parallelized. But when I try to load a .geo file using Gmsh3D in the same parallel.py file, I get the above error however executing in serial seems fine. Any help is greatly

General boundary conditions

烂漫一生 提交于 2019-12-12 04:23:39
问题 I’d appreciate help on setting general boundary conditions, -grad(y) + g(y) = 0 where g is some function of the unknown y . Here’s a simple 1D example that I can’t get to work: N=3 h=1./(float(N)-1.) mesh = Grid1D(nx=N, dx=h) c=CellVariable(mesh=mesh,value=0.5) ## Dirichlet boundary conditions #c.constrain(2., mesh.facesLeft) #c.constrain(1., mesh.facesRight) ## Neumann boundary conditions c.faceGrad.constrain(-1, where=mesh.facesLeft) c.faceGrad.constrain( -c.faceValue , where=mesh