It's a perfectly fine way to check the residual. You just need to evaluate what constitutes "converged" for your problem. I recommend running a very high number of sweeps and printing the residual as you go along to see what range of values it covers.
> On Jul 28, 2016, at 11:27 AM, Daniel DeSantis <desan...@gmail.com> wrote: > > 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 "<ipython-input-1-d209891ef431>", line 1, in <module> > > > 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 <module> > > > 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): > > > File "ConversionModel.py", line 78, in <module> > > > 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> > > > 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 "<ipython-input-22-d209891ef431>", line 1, in <module> > > > > 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 <module> > > > > 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] > > > > > > > > > > > > -- > > > Daniel DeSantis > > > > > > > > > _______________________________________________ > > > fipy mailing list > > > fipy@nist.gov > > > http://www.ctcms.nist.gov/fipy > > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > > > _______________________________________________ > > fipy mailing list > > fipy@nist.gov > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > > > > > -- > > Daniel DeSantis > > > > > > > > > > > > -- > > Daniel DeSantis > > > > > > <FiPy Equations for Conversion > > Model.docx><modConversionModel_v2.py>_______________________________________________ > > fipy mailing list > > fipy@nist.gov > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > _______________________________________________ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > -- > Daniel DeSantis > > > _______________________________________________ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]