Hello

    I am am using FiPy with  Python 3.4 - I think the conversion went
    well enough but I do have some questions.

    I have successfully implemented a 1-dim concentration dependent
    diffusion problem in fipy, where success was defined by reproducing
    what other researchers had produced  in a publication.

    My diffusion coefficient looks like

    Dx=Dpe_x*(a_x+((1.-a_x)/(b_x*C+g_x)))

    where C is a CellVariable on a 1 dim grid and the other terms are
    constants.

    As mentioned this all worked well. However when I went to extend to
    2 Dimension and include second diffusion coeff, Dz (C) , for
    anisotropic  diffusion, I am running into some issues.

    first for constant diffusion coeff of Dx =1, Dz = 5 on 2 dim
    rectangular grid (Grid2D)

    When written as

     TransientTerm() ==DiffusionTerm([[[1.,0],[0,5.]]])

    the results behave like I would expect ( on a 2dim rectangular mesh)

    But when written like

     TransientTerm() == DiffusionTerm([[1.,5.]]), which I think the
    manual said was equivalent ( under freq asked questions)

    I get an assertion error, which I can post but before posting should
    these two diffusion terms be equivalent?

    Sticking with the complete matrix form of the diffusion Coefficient
    for Dx and Dz ( both similar functions of the cellVariable C)

    when I use this form

     TransientTerm() == DiffusionTerm([[[Dx,0],[0,Dz]]])

    I get the following traceback error

---------------------------------------------------------------------------
ValueError                                 Traceback (most recent call last)
<ipython-input-101-745650bc0cee>  in<module>() 24 
Dz=Dpe_z*(a_z+((1.-a_z)/(b_z*C+g_z)))
25 ---> 26eqX = TransientTerm() == DiffusionTerm([[[Dx,0],[0,Dz]]])C:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\terms\abstractDiffusionTerm.py in __init__(self, coeff, var) 62 from fipy.variables.variable import Variable63 if not isinstance(self.nthCoeff, Variable):---> 64self.nthCoeff = Variable(value = self.nthCoeff)65 66 from fipy.variables.cellVariable import CellVariableC:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\variables\variable.py in __init__(self, value, unit, array, name, cached) 109 unit = None110 --> 111self._setValueInternal(value=value, unit=unit, array=array)112 113 self._name = nameC:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\variables\variable.py in _setValueInternal(self, value, unit, array) 638 639 def _setValueInternal(self, value, unit=None, array=None):--> 640self._value = self._makeValue(value=value, unit=unit, array=array)641 642 def _makeValue(self, value, unit=None, array=None):C:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\variables\variable.py in _makeValue(self, value, unit, array) 668 669 if unit is not None or type(value) in [type(''), type(()), type([])]:--> 670value = PF(value=value, unit=unit, array=array)671 elif array is not None:672 array[:] = valueC:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\tools\dimensions\physicalField.py in __init__(self, value, unit, array) 203 204 if type(value) in [type([]),type< span class="ansiyellow" style="box-sizing: border-box; color: rgb(196, 160, 0);">(())]:--> 205value = [PhysicalField(item,unit) for item in value]206 if unit is None:207 unit = value[0].unitC:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\tools\dimensions\physicalField.py in <listcomp>(.0) 203 204 if type(value) in [type([]),type< span class="ansiyellow" style="box-sizing: border-box; color: rgb(196, 160, 0);">(())]:--> 205value = [PhysicalField(item,unit) for item in value]206 if unit is None:207 unit = value[0].unitC:\Users\PhilB\Anaconda3\lib\site-packages\fipy-unknown-py3.4.egg\fipy\tools\dimensions\physicalField.py in __init__(self, value, unit, array) 212 else:213 normalized += [item.inUnitsOf(unit).value]--> 214value = numerix.array(normalized)215 216 if unit is None:ValueError: setting an array element with a sequence.


Is there a more appropriate way of writing the 2Dim anisotropic concentration dependent diff coeff?

Note if I use isotropic 2 dim concentration dependent diffusion the results look correct ( in 2D)
 TransientTerm() == DiffusionTerm(Dx)



Let me know if this challenge makes sense and if there is a solution
thanks
Phil
ps

I see questions posted on this list, Gist and stack overflow - is there a preference for posting ?
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to