<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=Fipy%2FSurface_Adsorption_Equation%2FEmail</id>
	<title>Fipy/Surface Adsorption Equation/Email - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://charlesreid1.com/w/index.php?action=history&amp;feed=atom&amp;title=Fipy%2FSurface_Adsorption_Equation%2FEmail"/>
	<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Fipy/Surface_Adsorption_Equation/Email&amp;action=history"/>
	<updated>2026-06-20T05:27:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.12</generator>
	<entry>
		<id>https://charlesreid1.com/w/index.php?title=Fipy/Surface_Adsorption_Equation/Email&amp;diff=4592&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;&lt;pre&gt; bug in adsorbingSurfactantEquation.py? 5 messages Charles Reid &lt;charlesreid1@gmail.com&gt;	 Thu, Dec 12, 2013 at 4:26 PM To: fipy@nist.gov Hi there,  While using the Adsorbing...&quot;</title>
		<link rel="alternate" type="text/html" href="https://charlesreid1.com/w/index.php?title=Fipy/Surface_Adsorption_Equation/Email&amp;diff=4592&amp;oldid=prev"/>
		<updated>2013-12-17T20:26:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; bug in adsorbingSurfactantEquation.py? 5 messages Charles Reid &amp;lt;charlesreid1@gmail.com&amp;gt;	 Thu, Dec 12, 2013 at 4:26 PM To: fipy@nist.gov Hi there,  While using the Adsorbing...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
bug in adsorbingSurfactantEquation.py?&lt;br /&gt;
5 messages&lt;br /&gt;
Charles Reid &amp;lt;charlesreid1@gmail.com&amp;gt;	 Thu, Dec 12, 2013 at 4:26 PM&lt;br /&gt;
To: fipy@nist.gov&lt;br /&gt;
Hi there,&lt;br /&gt;
&lt;br /&gt;
While using the AdsorbingSurfactantEquation class, defined in the electroChem example, located in:&lt;br /&gt;
&lt;br /&gt;
fipy/examples/levelSet/electroChem/adsorbingSurfactantEquation.py&lt;br /&gt;
&lt;br /&gt;
I noticed two lines that seem erroneous, both related to the timestep used for the solution. On line 331, the following code:&lt;br /&gt;
&lt;br /&gt;
        self.eq.solve(var,&lt;br /&gt;
                      boundaryConditions=boundaryConditions,&lt;br /&gt;
                      solver = solver,&lt;br /&gt;
                      dt=1.)&lt;br /&gt;
&lt;br /&gt;
should, I think, be:&lt;br /&gt;
&lt;br /&gt;
        self.eq.solve(var,&lt;br /&gt;
                      boundaryConditions=boundaryConditions,&lt;br /&gt;
                      solver = solver,&lt;br /&gt;
                      dt=self.dt)&lt;br /&gt;
&lt;br /&gt;
and likewise, line 358, the following code:&lt;br /&gt;
&lt;br /&gt;
        return self.eq.sweep(var, solver=solver, boundaryConditions=boundaryConditions, underRelaxation=underRelaxation, residualFn=residualFn, dt=1.)&lt;br /&gt;
&lt;br /&gt;
should be:&lt;br /&gt;
&lt;br /&gt;
        return self.eq.sweep(var, solver=solver, boundaryConditions=boundaryConditions, underRelaxation=underRelaxation, residualFn=residualFn, dt=self.dt)&lt;br /&gt;
&lt;br /&gt;
so that the timestep information set by the user is not ignored. Attached is a patch (created with git diff --no-prefix) that fixes this. If it passes the muster, would someone mind checking the change into the git repository?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Charles&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
		adsorbingSurfactantEquation_dt_fix.patch&lt;br /&gt;
2K&lt;br /&gt;
Daniel Wheeler &amp;lt;daniel.wheeler2@gmail.com&amp;gt;	 Fri, Dec 13, 2013 at 8:51 AM&lt;br /&gt;
Reply-To: fipy@nist.gov&lt;br /&gt;
To: Multiple recipients of list &amp;lt;fipy@nist.gov&amp;gt;&lt;br /&gt;
On Thu, Dec 12, 2013 at 7:26 PM, Charles Reid &amp;lt;charlesreid1@gmail.com&amp;gt; wrote:&lt;br /&gt;
&amp;gt; Hi there,&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt; While using the AdsorbingSurfactantEquation class, defined in the&lt;br /&gt;
&amp;gt; electroChem example, located in:&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt; fipy/examples/levelSet/electroChem/adsorbingSurfactantEquation.py&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt; I noticed two lines that seem erroneous, both related to the timestep used&lt;br /&gt;
&amp;gt; for the solution. On line 331, the following code:&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt;         self.eq.solve(var,&lt;br /&gt;
&amp;gt;                       boundaryConditions=boundaryConditions,&lt;br /&gt;
&amp;gt;                       solver = solver,&lt;br /&gt;
&amp;gt;                       dt=1.)&lt;br /&gt;
&lt;br /&gt;
Hi Charles,&lt;br /&gt;
&lt;br /&gt;
This isn&amp;#039;t a mistake. I know it is very confusing. It should probably&lt;br /&gt;
not take a time step at all. The equation in question is not&lt;br /&gt;
controlled by the time step. It evolves with the zero level set. It&lt;br /&gt;
stores values at cells that are close to the zero level set and when&lt;br /&gt;
the zero level set moves the material is &amp;quot;pushed&amp;quot; by the zero level&lt;br /&gt;
set from cell to cell. The main benefit of this method is that it is&lt;br /&gt;
entirely conservative, but it is only first order accurate. Hope this&lt;br /&gt;
helps to explain what&amp;#039;&amp;#039;s happening a little bit. I can field more&lt;br /&gt;
questions if you need to use it for a problem.&lt;br /&gt;
&lt;br /&gt;
Thanks for the patch and don&amp;#039;t be shy about submitting more patches.&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Daniel&lt;br /&gt;
&lt;br /&gt;
--&lt;br /&gt;
Daniel Wheeler&lt;br /&gt;
_______________________________________________&lt;br /&gt;
fipy mailing list&lt;br /&gt;
fipy@nist.gov&lt;br /&gt;
http://www.ctcms.nist.gov/fipy&lt;br /&gt;
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]&lt;br /&gt;
Charles Reid &amp;lt;charlesreid1@gmail.com&amp;gt;	 Mon, Dec 16, 2013 at 11:40 AM&lt;br /&gt;
To: fipy@nist.gov&lt;br /&gt;
Hi Daniel,&lt;br /&gt;
&lt;br /&gt;
Thanks very much for your response. I am interested in using the class for solving a catalysis problem, where surface species coverages evolve with time. From the documentation, I&amp;#039;ve gathered that the class solves the same equations I&amp;#039;m using to model my system (&amp;amp; I&amp;#039;m interested in extending the class to three or more surface variables). I follow what you mean about zero level set approach (some trial-and-error helped me make sense of this), but I&amp;#039;m having trouble understanding why the timestep doesn&amp;#039;t come into play, so I have a few questions to help clarify.&lt;br /&gt;
&lt;br /&gt;
Is the time-evolution tied to the interface&amp;#039;s/zero-level-set&amp;#039;s time-evolution, such that for each change in location of the interface, a steady-state equation is solved, and the time-evolution of the equation is kind of &amp;quot;implicit&amp;quot; with the interface&amp;#039;s time-evolution (which is how I interpret your comment about material being pushed by the zero level set)? If this is the case, why would there be a transient term in the equation defined in the AdsorbingSurfactantEquation class, instead of solving a steady-state equation and calling solve() when the interface moves?&lt;br /&gt;
&lt;br /&gt;
More numerical experiments have raised more questions. I tried varying the timestep, to see what effect it had, and it ended up changing the solution. I&amp;#039;ve attached a simple example (ASE.py contains the AdsorbingSurfactantEquation class, same as in the git repository but with the patch applied so that dt can be changed, and simpleExample.py contains a simple 1D example with a 10-cell one-dimensional domain, and a zero-level at the middle of the domain) and its output (output.png). The simple example plots the interface variable value with time; it increases, but at a decreasing rate, which makes sense physically, since as the surface coverage increases, the rate at which the surface species is adsorbed decreases. I&amp;#039;ve run it for several values of timesteps, and the timestep apparently affects the solution. I&amp;#039;m confused as to what makes a value of dt=1.0 (the hard-coded dt value in AdsorbingSurfactantEquation in the git repository) special? And why do you think it shouldn&amp;#039;t take a timestep at all?&lt;br /&gt;
&lt;br /&gt;
Thanks for the help!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Charles&lt;br /&gt;
[Quoted text hidden]&lt;br /&gt;
&lt;br /&gt;
3 attachments&lt;br /&gt;
		output.png&lt;br /&gt;
81K&lt;br /&gt;
		ASE.py&lt;br /&gt;
7K&lt;br /&gt;
		simpleExample.py&lt;br /&gt;
2K&lt;br /&gt;
Daniel Wheeler &amp;lt;daniel.wheeler2@gmail.com&amp;gt;	 Tue, Dec 17, 2013 at 9:35 AM&lt;br /&gt;
Reply-To: fipy@nist.gov&lt;br /&gt;
To: Multiple recipients of list &amp;lt;fipy@nist.gov&amp;gt;&lt;br /&gt;
On Mon, Dec 16, 2013 at 2:40 PM, Charles Reid &amp;lt;charlesreid1@gmail.com&amp;gt; wrote:&lt;br /&gt;
&amp;gt; Hi Daniel,&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt; Thanks very much for your response. I am interested in using the class for&lt;br /&gt;
&amp;gt; solving a catalysis problem, where surface species coverages evolve with&lt;br /&gt;
&amp;gt; time. From the documentation, I&amp;#039;ve gathered that the class solves the same&lt;br /&gt;
&amp;gt; equations I&amp;#039;m using to model my system (&amp;amp; I&amp;#039;m interested in extending the&lt;br /&gt;
&amp;gt; class to three or more surface variables).&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;ve solved for three surface variable in some of my electrochemistry&lt;br /&gt;
work. Getting the interactions right can be quite difficult.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Is the time-evolution tied to the interface&amp;#039;s/zero-level-set&amp;#039;s&lt;br /&gt;
&amp;gt; time-evolution, such that for each change in location of the interface, a&lt;br /&gt;
&amp;gt; steady-state equation is solved, and the time-evolution of the equation is&lt;br /&gt;
&amp;gt; kind of &amp;quot;implicit&amp;quot; with the interface&amp;#039;s time-evolution (which is how I&lt;br /&gt;
&amp;gt; interpret your comment about material being pushed by the zero level set)?&lt;br /&gt;
&lt;br /&gt;
Yes. That is exactly how it works.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; If this is the case, why would there be a transient term in the equation&lt;br /&gt;
&amp;gt; defined in the AdsorbingSurfactantEquation class, instead of solving a&lt;br /&gt;
&amp;gt; steady-state equation and calling solve() when the interface moves?&lt;br /&gt;
&lt;br /&gt;
Basically, the equation is multiplied through by &amp;quot;dt&amp;quot; so the transient&lt;br /&gt;
term is just a sort of update term. Take a look at the following&lt;br /&gt;
&lt;br /&gt;
    https://docs.google.com/file/d/0B4101gT3tHveVUhZZHRwXzlCSDg/edit&lt;br /&gt;
&lt;br /&gt;
Equation 26 does not have a time step associated with it. The time is&lt;br /&gt;
only needed in the adsorption term.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; More numerical experiments have raised more questions. I tried varying the&lt;br /&gt;
&amp;gt; timestep, to see what effect it had, and it ended up changing the solution.&lt;br /&gt;
&lt;br /&gt;
It will, but it isn&amp;#039;t doing anything sensible if the time step is&lt;br /&gt;
anything other than 1. It should probably use source terms instead of&lt;br /&gt;
a transient term. It would make this a lot less confusing.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; I&amp;#039;ve attached a simple example (ASE.py contains the&lt;br /&gt;
&amp;gt; AdsorbingSurfactantEquation class, same as in the git repository but with&lt;br /&gt;
&amp;gt; the patch applied so that dt can be changed, and simpleExample.py contains a&lt;br /&gt;
&amp;gt; simple 1D example with a 10-cell one-dimensional domain, and a zero-level at&lt;br /&gt;
&amp;gt; the middle of the domain) and its output (output.png). The simple example&lt;br /&gt;
&amp;gt; plots the interface variable value with time; it increases, but at a&lt;br /&gt;
&amp;gt; decreasing rate, which makes sense physically, since as the surface coverage&lt;br /&gt;
&amp;gt; increases, the rate at which the surface species is adsorbed decreases. I&amp;#039;ve&lt;br /&gt;
&amp;gt; run it for several values of timesteps, and the timestep apparently affects&lt;br /&gt;
&amp;gt; the solution. I&amp;#039;m confused as to what makes a value of dt=1.0 (the&lt;br /&gt;
&amp;gt; hard-coded dt value in AdsorbingSurfactantEquation in the git repository)&lt;br /&gt;
&amp;gt; special?&lt;br /&gt;
&lt;br /&gt;
It is totally confusing. Hopefully reading the above link will help&lt;br /&gt;
explain. Adding the time step as you have done essentially means that&lt;br /&gt;
your time step is &amp;#039;dt**2&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; And why do you think it shouldn&amp;#039;t take a timestep at all?&lt;br /&gt;
&lt;br /&gt;
It needs a time step for the rate of adsorption. No time step is&lt;br /&gt;
needed simply for evolving a fixed surfactant quantity, which is&lt;br /&gt;
neither desorbing or adsorbing. The problem is that the equation&lt;br /&gt;
doesn&amp;#039;t really fit neatly into the FiPy framework very well. It&lt;br /&gt;
probably belongs more with the level set module.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Thanks for the help!&lt;br /&gt;
&lt;br /&gt;
I hope it does help.&lt;br /&gt;
[Quoted text hidden]&lt;br /&gt;
Charles Reid &amp;lt;charlesreid1@gmail.com&amp;gt;	 Tue, Dec 17, 2013 at 12:19 PM&lt;br /&gt;
To: fipy@nist.gov&lt;br /&gt;
Ah! This makes a lot more sense now. With your explanation and the document, it makes sense - particularly, thinking about the transient term as a source term instead of a transient term. Thanks for sending the link; the document is very clear and thorough.&lt;br /&gt;
&lt;br /&gt;
I also saw several references to Harry Moffat&amp;#039;s work - I know of Harry&amp;#039;s work through my use of Cantera, for which Harry is a primary developer. His approach is (presumably) the same as, or similar to, what&amp;#039;s in Cantera, which is the tool I&amp;#039;m currently using to solve coverage equations for catalysts. So making that connection was very helpful too!&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>