Casting non-linear source terms in FiPy

2016-07-13 Thread Gopalakrishnan, Krishnakumar
Hello, I have an equation of the form: nabla.(D grad (phi)) = exp(a*phi - K) - exp(-(b*phi - K)) The diffusion coefficient is simply 'D'. But how do I cast the non-linear source term? i.e. what is the syntax to use in the code? In the examples, I did not notice any non-linear source term.

Diffusion-Convection-Reactive Chemisty

2016-07-13 Thread Daniel DeSantis
Hello, I am having some trouble getting a workable convection coefficient on a reactive chemistry model with a vector velocity. I have reviewed several examples from the FiPy mailing list and tried several of the variations listed there. Originally, I was receiving the error that a coefficient

Re: Diffusion-Convection-Reactive Chemisty

2016-07-13 Thread Daniel Wheeler
Hi Daniel, It is giving a different error for me Traceback (most recent call last): File "ConversionModel.py", line 78, in V.constrain(V0,mesh.facesLeft) NameError: name 'V' is not defined Is this the correct script? On Wed, Jul 13, 2016 at 3:27 PM, Daniel DeSantis

Re: Casting non-linear source terms in FiPy

2016-07-13 Thread Guyer, Jonathan E. Dr. (Fed)
The way you've written it is correct. There's no way to make such a term implicit, so just write it as it appears. > On Jul 13, 2016, at 12:26 PM, Gopalakrishnan, Krishnakumar > wrote: > > > Hello, > > I have an equation of the form: > > nabla.(D grad (phi))

Re: Diffusion-Convection-Reactive Chemisty

2016-07-13 Thread Daniel DeSantis
I'm sorry. I was trying to fix the problem, and forgot to put a line back in, which was masked by me not clearing a variable value for V. My apologies. Please try this code instead. It has the traceback I mentioned before. Traceback (most recent call last): File "", line 1, in

Re: Diffusion-Convection-Reactive Chemisty

2016-07-13 Thread Keller, Trevor (Fed)
Staring at the code, it looks like you're defining initial values (C_a_0, C_b_0, ..., V0) as CellVariables instead of scalars (or Variables), which is probably not what you meant. Substituting the following seems to work better: #%% - INITIATION VALUES C_a_0 = 0 C_b_0 = 0 C_c_0 = 0 C_d_0 = 0 V0

Re: Diffusion-Convection-Reactive Chemisty

2016-07-13 Thread Keller, Trevor (Fed)
Is the definition of C_a_BC correct? For a 1D grid, is the behavior of C_a.constrain(C_a_BC, where=mesh.facesRight) with a CellVariable instead of a scalar value C_a_BC= C_a_0*(1-X) meaningful? Trevor From: fipy-boun...@nist.gov

Re: Diffusion-Convection-Reactive Chemisty

2016-07-13 Thread Guyer, Jonathan E. Dr. (Fed)
That should be OK. FiPy automatically maps the constraint onto the faceValue of a CellVariable. > On Jul 13, 2016, at 3:26 PM, Keller, Trevor (Fed) > wrote: > > Is the definition of C_a_BC correct? For a 1D grid, is the behavior of > C_a.constrain(C_a_BC,

Possibility of setting NaN constraints for CellVariable ?

2016-07-13 Thread Gopalakrishnan, Krishnakumar
Hello, I have a regular 2D Cartesian uniformly spaced mesh. Due to some peculiarities of the physical system that I am currently working with, the variable of interest in one of my PDEs, (fiPy CellVariable), is undefined in certain interior node locations, i.e. we need to constrain them to a

Re: Possibility of setting NaN constraints for CellVariable ?

2016-07-13 Thread Raymond Smith
Hi, Krishna. This strikes me as a strange way to go about implementing something, so it might be helpful to have a bit more physical details about the system in order to see if the list has proposals for alternative ways to address the problem. The worry about 0's propagating into the rest of the

Re: Possibility of setting NaN constraints for CellVariable ?

2016-07-13 Thread Guyer, Jonathan E. Dr. (Fed)
You can't do this. NaNs immediately propagate and will break your whole solution. If I had to do this, I would decouple this region from the other equations by zeroing out the coefficients of those other equations in the appropriate region. > On Jul 13, 2016, at 8:49 AM, Gopalakrishnan,

RE: Possibility of setting NaN constraints for CellVariable ?

2016-07-13 Thread Gopalakrishnan, Krishnakumar
Dear Raymond, Jonathan and Dan, Thanks a lot for all your replies. Indeed this works ! Setting the diffusion coefficient to all interior faces helps a lot. Thanks for your help once again. Krishna -Original Message- From: fipy-boun...@nist.gov [mailto:fipy-boun...@nist.gov] On