This page contains the terms Package documentation.
Bases: fipy.terms.term.Term
Attention
This class is abstract. Always create one of its subclasses.
Bases: fipy.terms.convectionTerm.ConvectionTerm
This Term represents
where and is calculated using the central differencing scheme. For further details see Numerical Schemes.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.faceTerm.FaceTerm
Attention
This class is abstract. Always create one of its subclasses.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.term.Term
This term represents a higher order diffusion term. The order of the term is determined by the number of coeffs, such that:
DiffusionTerm(D1)
represents a typical 2nd-order diffusion term of the form
and:
DiffusionTerm((D1,D2))
represents a 4th-order Cahn-Hilliard term of the form
and so on.
Create a DiffusionTerm.
Parameters : |
|
---|
Bases: fipy.terms.diffusionTerm.DiffusionTerm
Create a DiffusionTerm.
Parameters : |
|
---|
Bases: fipy.terms.diffusionTerm.DiffusionTerm
The discretization for the ExplicitDiffusionTerm is given by
where and are the old values of the variable. The term is added to the RHS vector and makes no contribution to the solution matrix.
Create a DiffusionTerm.
Parameters : |
|
---|
Bases: fipy.terms.upwindConvectionTerm.UpwindConvectionTerm
The discretization for this Term is given by
where and is calculated using the upwind scheme. For further details see Numerical Schemes.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.convectionTerm.ConvectionTerm
The discretization for this Term is given by
where and is calculated using the exponential scheme. For further details see Numerical Schemes.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.term.Term
Attention
This class is abstract. Always create one of its subclasses.
Bases: fipy.terms.convectionTerm.ConvectionTerm
The discretization for this Term is given by
where and is calculated using the hybrid scheme. For further details see Numerical Schemes.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.sourceTerm.SourceTerm
The ImplicitSourceTerm represents
where is the coeff value.
Bases: fipy.terms.explicitDiffusionTerm.ExplicitDiffusionTerm
Attention
This class is deprecated. Use ExplicitDiffusionTerm instead.
Bases: fipy.terms.diffusionTerm.DiffusionTerm
Attention
This class is deprecated. Use ImplicitDiffusionTerm instead.
Bases: fipy.terms.convectionTerm.ConvectionTerm
The discretization for this Term is given by
where and is calculated using the power law scheme. For further details see Numerical Schemes.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.cellTerm.CellTerm
Attention
This class is abstract. Always create one of its subclasses.
Attention
This class is abstract. Always create one of its subclasses.
Create a Term.
Parameters : |
|
---|
Informs solve() and sweep() to cache their matrix so that getMatrix() can return the matrix.
Informs solve() and sweep() to cache their right hand side vector so that getRHSvector() can return it.
Return the matrix caculated in solve() or sweep(). The cacheMatrix() method should be called before solve() or sweep() to cache the matrix.
Return the RHS vector caculated in solve() or sweep(). The cacheRHSvector() method should be called before solve() or sweep() to cache the vector.
Builds the Term‘s linear system once. This method also recalculates and returns the residual as well as applying under-relaxation.
Parameters : |
|
---|
Builds the Term‘s linear system once. This method also recalculates and returns the residual as well as applying under-relaxation.
Parameters : |
|
---|
Builds and solves the Term‘s linear system once. This method does not return the residual. It should be used when the residual is not required.
Parameters : |
|
---|
Builds and solves the Term‘s linear system once. This method also recalculates and returns the residual as well as applying under-relaxation.
Parameters : |
|
---|
Bases: fipy.terms.cellTerm.CellTerm
The TransientTerm represents
where is the coeff value.
The following test case verifies that variable coefficients and old coefficient values work correctly. We will solve the following equation
The analytic solution is given by
where is the initial value.
>>> phi0 = 1.
>>> k = 1.
>>> dt = 1.
>>> relaxationFactor = 1.5
>>> steps = 2
>>> sweeps = 8
>>> from fipy.meshes.grid1D import Grid1D
>>> mesh = Grid1D(nx = 1)
>>> from fipy.variables.cellVariable import CellVariable
>>> var = CellVariable(mesh = mesh, value = phi0, hasOld = 1)
>>> from fipy.terms.transientTerm import TransientTerm
>>> from fipy.terms.implicitSourceTerm import ImplicitSourceTerm
Relaxation, given by relaxationFactor, is required for a converged solution.
>>> eq = TransientTerm(var) == ImplicitSourceTerm(-relaxationFactor) \
... + var * relaxationFactor + k
A number of sweeps at each time step are required to let the relaxation take effect.
>>> for step in range(steps):
... var.updateOld()
... for sweep in range(sweeps):
... eq.solve(var, dt = dt)
Compare the final result with the analytical solution.
>>> from fipy.tools import numerix
>>> print var.allclose(numerix.sqrt(k * dt * steps + phi0**2))
1
Bases: fipy.terms.convectionTerm.ConvectionTerm
The discretization for this Term is given by
where and is calculated using the upwind convection scheme. For further details see Numerical Schemes.
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|
Bases: fipy.terms.explicitUpwindConvectionTerm.ExplicitUpwindConvectionTerm
Create a ConvectionTerm object.
>>> from fipy.meshes.grid1D import Grid1D
>>> from fipy.variables.cellVariable import CellVariable
>>> from fipy.variables.faceVariable import FaceVariable
>>> m = Grid1D(nx = 2)
>>> cv = CellVariable(mesh = m)
>>> fv = FaceVariable(mesh = m)
>>> vcv = CellVariable(mesh=m, rank=1)
>>> vfv = FaceVariable(mesh=m, rank=1)
>>> __ConvectionTerm(coeff = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = fv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> __ConvectionTerm(coeff = vcv)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = vfv)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var = cv)
>>> ExplicitUpwindConvectionTerm(coeff = 1).solve(var = cv)
Traceback (most recent call last):
...
TypeError: The coefficient must be a vector value.
>>> from fipy.meshes.grid2D import Grid2D
>>> m2 = Grid2D(nx=2, ny=1)
>>> cv2 = CellVariable(mesh=m2)
>>> vcv2 = CellVariable(mesh=m2, rank=1)
>>> vfv2 = FaceVariable(mesh=m2, rank=1)
>>> __ConvectionTerm(coeff=vcv2)
__ConvectionTerm(coeff=_ArithmeticCellToFaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> __ConvectionTerm(coeff=vfv2)
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0.]]), mesh=UniformGrid2D(dx=1.0, nx=2, dy=1.0, ny=1)))
>>> ExplicitUpwindConvectionTerm(coeff = ((0,),(0,))).solve(var=cv2)
>>> ExplicitUpwindConvectionTerm(coeff = (0,0)).solve(var=cv2)
Parameters : |
|
---|