Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_FixedBCFaceGradVariable mangles FaceGrad, even with no boundary conditions #220

Closed
guyer opened this issue Sep 19, 2014 · 3 comments
Closed

Comments

@guyer
Copy link
Member

guyer commented Sep 19, 2014

It seems like all face gradient components are made orthogonal to the faces?

>>> from fipy import *
>>> mesh = Grid2D(nx=3, ny=3)
>>> x, y = mesh.getCellCenters()
>>> var = CellVariable(mesh=mesh, value=sin(x) * cos(y))
>>> print var.getFaceGrad()
--> print(var.getFaceGrad())
--> print(var.getFaceGrad())
[[ 0.22732436  0.05223661 -0.17508774  0.12282387  0.02822356 -0.09460031
  -0.09460031 -0.0217381   0.07286221 -0.20752402 -0.04768671  0.1598373
   0.          0.45464871 -0.35017549  0.          0.          0.03664678
  -0.02822576  0.          0.         -0.41504803  0.3196746   0.        ]
 [ 0.          0.         -0.         -0.38682227 -0.8048242  -0.48287447
  -0.41800193 -0.86969674 -0.52179638  0.          0.          0.
  -0.19341114 -0.29791162 -0.32192467 -0.24143724 -0.4024121  -0.61983629
  -0.66979795 -0.50233543 -0.20900097 -0.32192467 -0.34787328 -0.26089819]]

but

>>> var2 = CellVariable(mesh=mesh, value=sin(x) * cos(y))
>>> from fipy.variables.fixedBCFaceGradVariable import _FixedBCFaceGradVariable
>>> var2.faceGrad = _FixedBCFaceGradVariable(var2, boundaryConditions=())
>>> print var2.getFaceGrad()
--> print(var2.getFaceGrad())
[[ 0.22732436  0.05223661 -0.17508774  0.          0.          0.          0.
   0.          0.         -0.20752402 -0.04768671  0.1598373   0.
   0.45464871 -0.35017549  0.          0.          0.03664678 -0.02822576
   0.          0.         -0.41504803  0.3196746   0.        ]
 [ 0.          0.          0.         -0.38682227 -0.8048242  -0.48287447
  -0.41800193 -0.86969674 -0.52179638  0.          0.          0.
  -0.19341114  0.          0.         -0.24143724 -0.4024121   0.          0.
  -0.50233543 -0.20900097  0.          0.         -0.26089819]]

Perhaps more readily seen as

>>> from fipy import *
>>> mesh = Grid2D(nx=10, ny=10)
>>> x, y = mesh.getCellCenters()
>>> var = CellVariable(mesh=mesh, value=sin(x) * cos(y))
>>> Viewer(vars=var.getFaceGrad()).plot(filename="normal.png")

normal.png

vs.

>>> var2 = CellVariable(mesh=mesh, value=sin(x) * cos(y))
>>> from fipy.variables.fixedBCFaceGradVariable import _FixedBCFaceGradVariable
>>> var2.faceGrad = _FixedBCFaceGradVariable(var2, boundaryConditions=())
>>> Viewer(vars=var2.getFaceGrad()).plot(filename="FixedBC.png")

FixedBC.png

Imported from trac ticket #316, created by guyer on 11-30-2010 at 14:05, last modified: 12-08-2011 at 10:15

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

guyer attached FixedBC.png on 11-30-2010 at 14:20

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

guyer attached normal.png on 11-30-2010 at 14:20

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

_FixedBCFaceGradVariable is obsolete (and was removed in r4526). Use .constrain().

Trac comment by guyer on 12-08-2011 at 10:15

@guyer guyer closed this as completed Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants