Hello Jonathon,

Thanks for the clarification on the notation. I would like to go back to
the earlier emails and ask some questions about the coefficient of the
convection term.

The original PDE is dC/dt + alpha*d/dx(1/C) = d^2C/dx^2 where C is the
dependent variable and alpha is a constant. You suggested that:

You can try running the chain rule on it:
>
> \alpha\frac{\partial}{\partial x}\frac{1}{C}
> = -\frac{\alpha}{C^2}\frac{\
> partial C}{\partial x}
>
> so you get a "normal" convection term with a velocity of -alpha/C**2.
>

Assigning the coefficient of the convection term as -alpha/C**2 seems
incorrect because the coefficient of the convection term should be that of
whatever multiplies the dependent variable inside the divergence operator;
-alpha/C**2 here, however, is outside and not inside the d/dx operator.

Also, I am not very clear on how the rank of a Variable (cellVariable or
faceVariable) relates to the number of paired square brackets. Could you
please provide some examples that may elucidate how to properly use the
square brackets that denote the appropriate rank (including rank 2, since I
suppose a lot of people may need to use diffusivity tensors)?

Lastly, I also provide the actual PDEs (
https://dl.dropboxusercontent.com/u/972246/FiPy%20PDE.pdf) and Python code (
http://pastebin.com/JUJzaPtN) that I am using to provide some context to
the questions I asked. As before, I would love to get some ideas on how to
express the convection term correctly and run the code faster (the current
time step is pretty small).

Best,
Edwin


On Tue, Mar 26, 2013 at 1:59 PM, Jonathan Guyer <[email protected]> wrote:

>
> On Mar 22, 2013, at 12:38 AM, Edwin Sze Lun Khoo wrote:
>
> > It turns out that my spatial discretization was too fine, so Python ran
> out of memory. After decreasing my spatial discretization and trying the
> PowerLawConvectionTerm that you suggested, I still get the "IndexError: id1
> does not have the same size as b" error.
>
> You still have it wrapped in a tuple.
>
> [[-alpha]]/C**2 is a rank-1 CellVariable
>
> [[-alpha]]/C.faceValue**2 is a rank-1 FaceVariable
>
> ([[-alpha]]/C.faceValue**2, ) is a tuple of rank-1 FaceVariables (of
> length 1) and FiPy doesn't know what to do with it.
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
_______________________________________________
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