Re: Diffusion-Convection-Reactive Chemisty

2016-07-28 Thread Daniel DeSantis
I'll check through the units again.

Honestly, I'm not sure about convergence and the res > 1e-2. Frankly, I'm
still fairly new to FiPy and I saw a similar use of this method and tried
it out. I'll play with it and see if it changes my value.

Thanks

On Wed, Jul 27, 2016 at 10:37 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> I recommend you work through and check your units in all equations. I
> don't have any intuition for what's a big value and what's small when we're
> talking kmol. There aren't any units at all specified for D, k, etc.
>
> Is your solution converged when it finishes `while res > 1.e-2`? How did
> you pick that value for the residual?
>
>
> > On Jul 21, 2016, at 2:12 PM, Daniel DeSantis <desan...@gmail.com> wrote:
> >
> > So, these changes all helped a lot, both in getting results and my
> general understanding. Sorry to come back with more questions but I have
> been trying to extend the model a bit. I've added a second, competing
> reaction and have tried to incorporate a temperature profile. So far, I can
> get answers that seem to match what I expect but I have to use strange
> values to do so...
> >
> > The two problems I have are:
> > 1) The temperature profile requires a k_eff of 5e6 or 5e7 to not
> increase ridiculously high.
> >
> > 2) The diffusion coefficient has to be relatively high (D=100) in order
> to get a decent concentration profile. In most models with a reaction that
> has a decent velocity, you can ignore diffusion all together. That does not
> seem to be the case here. Perhaps my understanding of how to code these
> systems is incorrect? In this particular case, is there something I should
> be doing to make the diffusion term second order?
> >
> > I've included codes and an equation sheet to try and clarify things. As
> it stands, the coefficients (D, k1, k2, keff) in the code give me a
> concentration profile I expect but not a temperature one.
> >
> > Thank you,
> >
> > Daniel DeSantis
> >
> > On Thu, Jul 14, 2016 at 10:36 AM, Daniel DeSantis <desan...@gmail.com
> >wrote:
> > Thank you everyone. This helps a lot!
> >
> > On Wed, Jul 13, 2016 at 5:04 PM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
> > 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) <
> trevor.kel...@nist.gov> wrote:
> > >
> > > 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 <fipy-boun...@nist.gov> on behalf of
> Daniel DeSantis <desan...@gmail.com>
> > > Sent: Wednesday, July 13, 2016 4:08:50 PM
> > > To: FIPY
> > > Subject: Re: Diffusion-Convection-Reactive Chemisty
> > >
> > > 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 
> > > runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> Models/ConversionModel.py',
> wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
> > >
> > >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 699, in runfile
> > > execfile(filename, namespace)
> > >
> > >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 74, in execfile
> > > exec(compile(scripttext, filename, 'exec'), glob, loc)
> > >
> > >   File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> Models/ConversionModel.py", line 110, in 
> > > res = Eq.sweep(dt=dt, solver=solver)
> > >
> > >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> line 236, in sweep
> > > solver = self._prepareLinearSystem(var=var, solver=solver,
> boundaryConditions=boundaryConditions, dt=dt)
> > >
> > >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\l

Re: Diffusion-Convection-Reactive Chemisty

2016-07-27 Thread Guyer, Jonathan E. Dr. (Fed)
I recommend you work through and check your units in all equations. I don't 
have any intuition for what's a big value and what's small when we're talking 
kmol. There aren't any units at all specified for D, k, etc.

Is your solution converged when it finishes `while res > 1.e-2`? How did you 
pick that value for the residual?


> On Jul 21, 2016, at 2:12 PM, Daniel DeSantis <desan...@gmail.com> wrote:
> 
> So, these changes all helped a lot, both in getting results and my general 
> understanding. Sorry to come back with more questions but I have been trying 
> to extend the model a bit. I've added a second, competing reaction and have 
> tried to incorporate a temperature profile. So far, I can get answers that 
> seem to match what I expect but I have to use strange values to do so...
> 
> The two problems I have are:
> 1) The temperature profile requires a k_eff of 5e6 or 5e7 to not increase 
> ridiculously high. 
> 
> 2) The diffusion coefficient has to be relatively high (D=100) in order to 
> get a decent concentration profile. In most models with a reaction that has a 
> decent velocity, you can ignore diffusion all together. That does not seem to 
> be the case here. Perhaps my understanding of how to code these systems is 
> incorrect? In this particular case, is there something I should be doing to 
> make the diffusion term second order?
> 
> I've included codes and an equation sheet to try and clarify things. As it 
> stands, the coefficients (D, k1, k2, keff) in the code give me a 
> concentration profile I expect but not a temperature one.
> 
> Thank you,
> 
> Daniel DeSantis
> 
> On Thu, Jul 14, 2016 at 10:36 AM, Daniel DeSantis <desan...@gmail.com>wrote:
> Thank you everyone. This helps a lot! 
> 
> On Wed, Jul 13, 2016 at 5:04 PM, Guyer, Jonathan E. Dr. (Fed) 
> <jonathan.gu...@nist.gov> wrote:
> 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) <trevor.kel...@nist.gov> 
> > wrote:
> >
> > 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 <fipy-boun...@nist.gov> on behalf of Daniel 
> > DeSantis <desan...@gmail.com>
> > Sent: Wednesday, July 13, 2016 4:08:50 PM
> > To: FIPY
> > Subject: Re: Diffusion-Convection-Reactive Chemisty
> >
> > 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 
> > runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
> > Models/ConversionModel.py', 
> > wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
> >
> >   File 
> > "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> >  line 699, in runfile
> > execfile(filename, namespace)
> >
> >   File 
> > "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> >  line 74, in execfile
> > exec(compile(scripttext, filename, 'exec'), glob, loc)
> >
> >   File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
> > Models/ConversionModel.py", line 110, in 
> > res = Eq.sweep(dt=dt, solver=solver)
> >
> >   File 
> > "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> >  line 236, in sweep
> > solver = self._prepareLinearSystem(var=var, solver=solver, 
> > boundaryConditions=boundaryConditions, dt=dt)
> >
> >   File 
> > "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> >  line 170, in _prepareLinearSystem
> > buildExplicitIfOther=self._buildExplcitIfOther)
> >
> >   File 
> > "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
> >  line 122, in _buildAndAddMatrices
> > buildExplicitIfOther=buildExplicitIfOther)
> >
> >   File 
> > "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> >  

Re: Diffusion-Convection-Reactive Chemisty

2016-07-21 Thread Daniel DeSantis
So, these changes all helped a lot, both in getting results and my general
understanding. Sorry to come back with more questions but I have been
trying to extend the model a bit. I've added a second, competing reaction
and have tried to incorporate a temperature profile. So far, I can get
answers that seem to match what I expect but I have to use strange values
to do so...

The two problems I have are:
1) The temperature profile requires a k_eff of 5e6 or 5e7 to not increase
ridiculously high.

2) The diffusion coefficient has to be relatively high (D=100) in order to
get a decent concentration profile. In most models with a reaction that has
a decent velocity, you can ignore diffusion all together. That does not
seem to be the case here. Perhaps my understanding of how to code these
systems is incorrect? In this particular case, is there something I should
be doing to make the diffusion term second order?

I've included codes and an equation sheet to try and clarify things. As it
stands, the coefficients (D, k1, k2, keff) in the code give me a
concentration profile I expect but not a temperature one.

Thank you,

Daniel DeSantis

On Thu, Jul 14, 2016 at 10:36 AM, Daniel DeSantis <desan...@gmail.com>
wrote:

> Thank you everyone. This helps a lot!
>
> On Wed, Jul 13, 2016 at 5:04 PM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
>
>> 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) <
>> trevor.kel...@nist.gov> wrote:
>> >
>> > 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 <fipy-boun...@nist.gov> on behalf of
>> Daniel DeSantis <desan...@gmail.com>
>> > Sent: Wednesday, July 13, 2016 4:08:50 PM
>> > To: FIPY
>> > Subject: Re: Diffusion-Convection-Reactive Chemisty
>> >
>> > 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 
>> > runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD
>> Models/ConversionModel.py',
>> wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
>> line 699, in runfile
>> > execfile(filename, namespace)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
>> line 74, in execfile
>> > exec(compile(scripttext, filename, 'exec'), glob, loc)
>> >
>> >   File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD
>> Models/ConversionModel.py", line 110, in 
>> > res = Eq.sweep(dt=dt, solver=solver)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
>> line 236, in sweep
>> > solver = self._prepareLinearSystem(var=var, solver=solver,
>> boundaryConditions=boundaryConditions, dt=dt)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
>> line 170, in _prepareLinearSystem
>> > buildExplicitIfOther=self._buildExplcitIfOther)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
>> line 122, in _buildAndAddMatrices
>> > buildExplicitIfOther=buildExplicitIfOther)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
>> line 68, in _buildAndAddMatrices
>> > buildExplicitIfOther=buildExplicitIfOther)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
>> line 68, in _buildAndAddMatrices
>> > buildExplicitIfOther=buildExplicitIfOther)
>> >
>> >   File
>> "C:\Users\ddesantis\AppData\Local

Re: Diffusion-Convection-Reactive Chemisty

2016-07-14 Thread Daniel DeSantis
Thank you everyone. This helps a lot!

On Wed, Jul 13, 2016 at 5:04 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> 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) <
> trevor.kel...@nist.gov> wrote:
> >
> > 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 <fipy-boun...@nist.gov> on behalf of Daniel
> DeSantis <desan...@gmail.com>
> > Sent: Wednesday, July 13, 2016 4:08:50 PM
> > To: FIPY
> > Subject: Re: Diffusion-Convection-Reactive Chemisty
> >
> > 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 
> > runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> Models/ConversionModel.py',
> wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 699, in runfile
> > execfile(filename, namespace)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 74, in execfile
> > exec(compile(scripttext, filename, 'exec'), glob, loc)
> >
> >   File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> Models/ConversionModel.py", line 110, in 
> > res = Eq.sweep(dt=dt, solver=solver)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> line 236, in sweep
> > solver = self._prepareLinearSystem(var=var, solver=solver,
> boundaryConditions=boundaryConditions, dt=dt)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> line 170, in _prepareLinearSystem
> > buildExplicitIfOther=self._buildExplcitIfOther)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
> line 122, in _buildAndAddMatrices
> > buildExplicitIfOther=buildExplicitIfOther)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> line 68, in _buildAndAddMatrices
> > buildExplicitIfOther=buildExplicitIfOther)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> line 68, in _buildAndAddMatrices
> > buildExplicitIfOther=buildExplicitIfOther)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> line 68, in _buildAndAddMatrices
> > buildExplicitIfOther=buildExplicitIfOther)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\unaryTerm.py",
> line 99, in _buildAndAddMatrices
> > diffusionGeomCoeff=diffusionGeomCoeff)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\abstractConvectionTerm.py",
> line 211, in _buildMatrix
> > self.constraintB =  -((1 - alpha) * var.arithmeticFaceValue *
> constraintMask * exteriorCoeff).divergence * mesh.cellVolumes
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 1151, in __mul__
> > return self._BinaryOperatorVariable(lambda a,b: a*b, other)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 1116, in _BinaryOperatorVariable
> > if not v.unit.isDimensionless() or len(v.shape) > 3:
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 255, in _getUnit
> > return self._extractUnit(self.value)
> >
> >   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fip

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) <trevor.kel...@nist.gov> 
> wrote:
> 
> 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 <fipy-boun...@nist.gov> on behalf of Daniel 
> DeSantis <desan...@gmail.com>
> Sent: Wednesday, July 13, 2016 4:08:50 PM
> To: FIPY
> Subject: Re: Diffusion-Convection-Reactive Chemisty
>  
> 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 
> runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
> Models/ConversionModel.py', 
> wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
>  line 699, in runfile
> execfile(filename, namespace)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
>  line 74, in execfile
> exec(compile(scripttext, filename, 'exec'), glob, loc)
> 
>   File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
> Models/ConversionModel.py", line 110, in 
> res = Eq.sweep(dt=dt, solver=solver)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
>  line 236, in sweep
> solver = self._prepareLinearSystem(var=var, solver=solver, 
> boundaryConditions=boundaryConditions, dt=dt)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
>  line 170, in _prepareLinearSystem
> buildExplicitIfOther=self._buildExplcitIfOther)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
>  line 122, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
>  line 68, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
>  line 68, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
>  line 68, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\unaryTerm.py",
>  line 99, in _buildAndAddMatrices
> diffusionGeomCoeff=diffusionGeomCoeff)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\abstractConvectionTerm.py",
>  line 211, in _buildMatrix
> self.constraintB =  -((1 - alpha) * var.arithmeticFaceValue * 
> constraintMask * exteriorCoeff).divergence * mesh.cellVolumes
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
>  line 1151, in __mul__
> return self._BinaryOperatorVariable(lambda a,b: a*b, other)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
>  line 1116, in _BinaryOperatorVariable
> if not v.unit.isDimensionless() or len(v.shape) > 3:
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
>  line 255, in _getUnit
> return self._extractUnit(self.value)
> 
>   File 
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
>  line 561, in _getValue
> value[..., mask] = numerix.array(constraint.value)[..., mask]
> 
> IndexError: index 100 is out of bounds for axis 0 with size 100
> 
> On Wed, Jul 13, 2016 at 3:59 PM, Daniel Wheeler <daniel.wheel...@gmail.com> 
> wrote:
> Hi Daniel,
> 
> It is giving a different error for me
> 
> Traceback (most recent call last

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 = 409.5183981003883 #V_flow/A_crossSection #m/hr

#%% - VARIABLES
C_a= CellVariable(name="Concentration of A", mesh=mesh, hasOld=True)
C_b= CellVariable(name="Concentration of B", mesh=mesh, hasOld=True)
C_c= CellVariable(name="Concentration of C", mesh=mesh, hasOld=True)
C_d= CellVariable(name="Concentration of D", mesh=mesh, hasOld=True)
V  = CellVariable(name="Velocity", mesh=mesh, hasOld=True)

C_a.setValue(C_a_0)
C_b.setValue(C_b_0)
C_c.setValue(C_c_0)
C_d.setValue(C_d_0)
V.setValue(V0)

But this still gives errors relating to division by zero and singular matrices. 
I think this is because the last term in each of your equations (factor*r_a) 
needs to be an appropriate SourceTerm, since
r_a = -k1 * C_a
and you're solving for C_a. I substituted

#%% - DEFINE EQUATIONS
EqC_a = 
(TransientTerm(var=C_a)==-ExponentialConvectionTerm(coeff=V_vec,var=C_a) + 
DiffusionTerm(var=C_b,coeff=Da) + ImplicitSourceTerm(var=C_a,coeff=1))
EqC_b = 
(TransientTerm(var=C_b)==-ExponentialConvectionTerm(coeff=V_vec,var=C_b) + 
DiffusionTerm(var=C_b,coeff=Da) + ImplicitSourceTerm(var=C_a,coeff=11))
EqC_c = 
(TransientTerm(var=C_c)==-ExponentialConvectionTerm(coeff=V_vec,var=C_c) + 
DiffusionTerm(var=C_c,coeff=Da) + ImplicitSourceTerm(var=C_a,coeff=-17))
EqC_d = 
(TransientTerm(var=C_d)==-ExponentialConvectionTerm(coeff=V_vec,var=C_d) + 
DiffusionTerm(var=C_d,coeff=Da) + ImplicitSourceTerm(var=C_a,coeff=-8))

Eq = EqC_a & EqC_b & EqC_c & EqC_d

This still returns an error,

/users/tnk10/Downloads/fipy/fipy/tools/numerix.py:966: RuntimeWarning: overflow 
encountered in square
  return sqrt(add.reduce(arr**2))
/users/tnk10/Downloads/fipy/fipy/solvers/pysparse/linearLUSolver.py:93: 
RuntimeWarning: overflow encountered in square
  error0 = numerix.sqrt(numerix.sum((L * x - b)**2))
/users/tnk10/Downloads/fipy/fipy/solvers/pysparse/linearLUSolver.py:98: 
RuntimeWarning: overflow encountered in square
  if (numerix.sqrt(numerix.sum(errorVector**2)) / error0)  <= self.tolerance:
/users/tnk10/Downloads/fipy/fipy/solvers/pysparse/linearLUSolver.py:98: 
RuntimeWarning: invalid value encountered in double_scalars
  if (numerix.sqrt(numerix.sum(errorVector**2)) / error0)  <= self.tolerance:
/users/tnk10/Downloads/fipy/fipy/variables/faceGradVariable.py:158: 
RuntimeWarning: overflow encountered in divide
  N = (N2 - numerix.take(self.var,id1, axis=-1)) / dAP
/users/tnk10/Downloads/fipy/fipy/variables/variable.py:1105: RuntimeWarning: 
invalid value encountered in multiply
  return self._BinaryOperatorVariable(lambda a,b: a*b, other)

Assuming (perhaps incorrectly) that component A should be diffusing, I changed 
the DiffusionTerm
EqC_a = 
(TransientTerm(var=C_a)==-ExponentialConvectionTerm(coeff=V_vec,var=C_a) + 
DiffusionTerm(var=C_a,coeff=Da) + ImplicitSourceTerm(var=C_a,coeff=1))

That seems to work. The modified script is attached.

Trevor


From: fipy-boun...@nist.gov <fipy-boun...@nist.gov> on behalf of Keller, Trevor 
(Fed) <trevor.kel...@nist.gov>
Sent: Wednesday, July 13, 2016 4:26:38 PM
To: FIPY
Subject: Re: Diffusion-Convection-Reactive Chemisty


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 <fipy-boun...@nist.gov> on behalf of Daniel 
DeSantis <desan...@gmail.com>
Sent: Wednesday, July 13, 2016 4:08:50 PM
To: FIPY
Subject: Re: Diffusion-Convection-Reactive Chemisty

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 
runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
Models/ConversionModel.py', wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
Models')

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
 line 699, in runfile
execfile(filename, namespace)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
 line 74, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
Models/ConversionModel.py", line 110, in 
res = Eq.sweep(d

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 <fipy-boun...@nist.gov> on behalf of Daniel 
DeSantis <desan...@gmail.com>
Sent: Wednesday, July 13, 2016 4:08:50 PM
To: FIPY
Subject: Re: Diffusion-Convection-Reactive Chemisty

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 
runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
Models/ConversionModel.py', wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
Models')

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
 line 699, in runfile
execfile(filename, namespace)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
 line 74, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD 
Models/ConversionModel.py", line 110, in 
res = Eq.sweep(dt=dt, solver=solver)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
 line 236, in sweep
solver = self._prepareLinearSystem(var=var, solver=solver, 
boundaryConditions=boundaryConditions, dt=dt)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
 line 170, in _prepareLinearSystem
buildExplicitIfOther=self._buildExplcitIfOther)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
 line 122, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
 line 68, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
 line 68, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
 line 68, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\unaryTerm.py",
 line 99, in _buildAndAddMatrices
diffusionGeomCoeff=diffusionGeomCoeff)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\abstractConvectionTerm.py",
 line 211, in _buildMatrix
self.constraintB =  -((1 - alpha) * var.arithmeticFaceValue * 
constraintMask * exteriorCoeff).divergence * mesh.cellVolumes

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
 line 1151, in __mul__
return self._BinaryOperatorVariable(lambda a,b: a*b, other)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
 line 1116, in _BinaryOperatorVariable
if not v.unit.isDimensionless() or len(v.shape) > 3:

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
 line 255, in _getUnit
return self._extractUnit(self.value)

  File 
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
 line 561, in _getValue
value[..., mask] = numerix.array(constraint.value)[..., mask]

IndexError: index 100 is out of bounds for axis 0 with size 100

On Wed, Jul 13, 2016 at 3:59 PM, Daniel Wheeler 
<daniel.wheel...@gmail.com<mailto:daniel.wheel...@gmail.com>> wrote:
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 
<desan...@gmail.com<mailto:desan...@gmail.com>> wrote:
> 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 must
> be a vector. Now I seem to be getting an error that says the 

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 
runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD
Models/ConversionModel.py',
wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
line 699, in runfile
execfile(filename, namespace)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
line 74, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD
Models/ConversionModel.py", line 110, in 
res = Eq.sweep(dt=dt, solver=solver)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
line 236, in sweep
solver = self._prepareLinearSystem(var=var, solver=solver,
boundaryConditions=boundaryConditions, dt=dt)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
line 170, in _prepareLinearSystem
buildExplicitIfOther=self._buildExplcitIfOther)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
line 122, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
line 68, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
line 68, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
line 68, in _buildAndAddMatrices
buildExplicitIfOther=buildExplicitIfOther)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\unaryTerm.py",
line 99, in _buildAndAddMatrices
diffusionGeomCoeff=diffusionGeomCoeff)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\abstractConvectionTerm.py",
line 211, in _buildMatrix
self.constraintB =  -((1 - alpha) * var.arithmeticFaceValue *
constraintMask * exteriorCoeff).divergence * mesh.cellVolumes

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
line 1151, in __mul__
return self._BinaryOperatorVariable(lambda a,b: a*b, other)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
line 1116, in _BinaryOperatorVariable
if not v.unit.isDimensionless() or len(v.shape) > 3:

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
line 255, in _getUnit
return self._extractUnit(self.value)

  File
"C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
line 561, in _getValue
value[..., mask] = numerix.array(constraint.value)[..., mask]

IndexError: index 100 is out of bounds for axis 0 with size 100

On Wed, Jul 13, 2016 at 3:59 PM, Daniel Wheeler 
wrote:

> 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 
> wrote:
> > 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
> must
> > be a vector. Now I seem to be getting an error that says the index is
> out of
> > bounds. Specific traceback is shown below, along with the code
> attachment.
> >
> > Could anyone suggest what I am doing wrong and how to fix it?
> >
> > I'm relatively new to Python and FiPy, specifically, so please bear with
> me
> > as I am learning.
> >
> > Thank you all!
> >
> > --
> > Daniel DeSantis
> >
> > Traceback (most recent call last):
> >
> >   File "", line 1, in 
> > runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> > Models/ConversionModel.py',
> > wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
> >
> >   File
> >
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> > line 699, in runfile
> > 

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  wrote:
> 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 must
> be a vector. Now I seem to be getting an error that says the index is out of
> bounds. Specific traceback is shown below, along with the code attachment.
>
> Could anyone suggest what I am doing wrong and how to fix it?
>
> I'm relatively new to Python and FiPy, specifically, so please bear with me
> as I am learning.
>
> Thank you all!
>
> --
> Daniel DeSantis
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
> runfile('C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> Models/ConversionModel.py',
> wdir='C:/Users/ddesantis/Dropbox/PythonScripts/CFD Models')
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 699, in runfile
> execfile(filename, namespace)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 74, in execfile
> exec(compile(scripttext, filename, 'exec'), glob, loc)
>
>   File "C:/Users/ddesantis/Dropbox/PythonScripts/CFD
> Models/ConversionModel.py", line 107, in 
> res = Eq.sweep(dt=dt, solver=solver)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> line 236, in sweep
> solver = self._prepareLinearSystem(var=var, solver=solver,
> boundaryConditions=boundaryConditions, dt=dt)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\term.py",
> line 170, in _prepareLinearSystem
> buildExplicitIfOther=self._buildExplcitIfOther)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\coupledBinaryTerm.py",
> line 122, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> line 68, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> line 68, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\binaryTerm.py",
> line 68, in _buildAndAddMatrices
> buildExplicitIfOther=buildExplicitIfOther)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\unaryTerm.py",
> line 99, in _buildAndAddMatrices
> diffusionGeomCoeff=diffusionGeomCoeff)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\terms\abstractConvectionTerm.py",
> line 211, in _buildMatrix
> self.constraintB =  -((1 - alpha) * var.arithmeticFaceValue *
> constraintMask * exteriorCoeff).divergence * mesh.cellVolumes
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 1151, in __mul__
> return self._BinaryOperatorVariable(lambda a,b: a*b, other)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 1116, in _BinaryOperatorVariable
> if not v.unit.isDimensionless() or len(v.shape) > 3:
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 255, in _getUnit
> return self._extractUnit(self.value)
>
>   File
> "C:\Users\ddesantis\AppData\Local\Continuum\Anaconda2\lib\site-packages\fipy\variables\variable.py",
> line 561, in _getValue
> value[..., mask] = numerix.array(constraint.value)[..., mask]
>
> IndexError: index 100 is out of bounds for axis 0 with size 100
>
> ___
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



-- 
Daniel Wheeler
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]