Dear Daniel,  
thanks for reply  
  > 1.I have a dependent variable phi(x,y,t). Is it possible to solve the below 
 
> type of equation for this variable:  
>  
> TransientTerm == DiffusionTerm_x + ConvectionTerm_x + DiffusionTerm_y +  
> ConvectionTerm_y,  
  
Use "DiffusionTerm( [ (a, 0), (0, b) ] )" and "ConvectionTerm((c,  
d))". There is FAQ in the manual that addresses this.    
Sorry, it's not very clear to me. So, the diffusion term turns to be  
DiffusionTerm([[[D, 0], [0, 0]]]) OR DiffusionTerm([[D,0]]) if i want d/dx D 
d/dx phi in 2D mesh  
and convection term  
<Some>ConvectionTerm([[U,0],[0,0]]) OR <Some>ConvectionTerm([U,0]) if i want 
d/dx U phi in 2D mesh?  
      
    
    
  > 4.Is it possible to supply the "Terms"(i.e. Diffusion) with exterior  
> coefficients so that nabla operator was not applied to them?  
  
Yes. Just do "cellVar * DiffusionTerm(coeff)". cellVar must be a  
cellVar. Generally, you can reformulate equations so that everything  
is inside the derivatives and this is often preferable.  I tried:  
  
    dr=0.01  
    mesh = Grid1D(dx = dr, nx = nsteps)  
    r = mesh.getCellCenters()  
    phi = CellVariable(mesh=mesh, name = "none1", value=1.0)  
    xi = CellVariable(mesh=mesh, name = "none2", value=r)  
    ...  
    convTerm = PowerLawConvectionTerm(coeff = convCoeff)  
    diffTerm = xi * DiffusionTerm(coeff = diffCoeff)  
     
And it seems it doesn't work. The output writes:  
..  
File 
"/usr/local/Python26/lib/python2.6/site-packages/fipy/variables/variable.py", 
line 936, in <lambda>  
    return self._BinaryOperatorVariable(lambda a,b: a*b, other)  
TypeError: unsupported operand type(s) for *: 'float' and 'instance'  
  
Do you have any ideas why?  

Reply via email to