I am solving the poisson's equation in 2D in the absence of charge. Thus, It is written in the form $∇.\epsilon_0 ∇ϕ = ∇.\vec{P}$ which I call the voltage equation. where, \phi is the electric potential or the voltage and \vec{p} is the polarization vector. I am trying to solve this equation in fipy, thus it translates to DiffusionTerm(coeff=epsilon_0,var=\phi)==divergence of \vec{p} I have defined \vec{p} as a cell variable. How, do I find the divergence using the fipy functions? Looking at the fipy manpage, I couldnot exactly find how to do it. It suggests using var.faceGrad.divergence, but var.faceGrad again is shown to be a way of finding the gradient of a scalar field. I tried using u.divergence, but this doesn't work.
I am solving the poisson's equation in 2D in the absence of charge. Thus, It is written in the form $∇.\epsilon_0 ∇ϕ = ∇.\vec{P}$ which I call the voltage equation. where, \phi is the electric potential or the voltage and \vec{p} is the polarization vector. I am trying to solve this equation in fipy, thus it translates to DiffusionTerm(coeff=epsilon_0,var=\phi)==divergence of \vec{p} I have defined \vec{p} as a cell variable. How, do I find the divergence using the fipy functions? Looking at the fipy manpage, I couldnot exactly find how to do it. It suggests using var.faceGrad.divergence, but var.faceGrad again is shown to be a way of finding the gradient of a scalar field. I tried using u.divergence, but this doesn't work.
Share Improve this question asked Mar 26 at 23:47 Kritika KhanalKritika Khanal 111 bronze badge1 Answer
Reset to default 0FiPy has no mechanism to take the divergence of a rank-1 CellVariable
. In situations like this, the polarization should be defined as a rank-1 FaceVariable
. If you have some other equation to solve for the polarization on cell centers, then you will need to manually transcribe those values to the face centers after each solve, e.g.,
for step in steps:
polarizationEq.solve(var=pCell, ...)
p.value = pCell.arithmeticFaceValue
voltageEq.solve(var=phi, ...)
See our Stokes flow example for an illustration of this.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744120096a4559358.html
评论列表(0条)