Re: Query on AdsorbingSurfactantEquation.py consumptionCoeff
Feel free to add any relevant comments to the issue, https://github.com/usnistgov/fipy/issues/690. On Mon, Jan 13, 2020 at 1:36 PM Daniel Wheeler wrote: > > Hi Chaitanya, > > I think you're correct. It seems that term should be multiplied by the > time step. The tests all pass with your change. Would you like to > submit a pull-request for that change? > > The way time stepping works is a bit weird in that equation so it > wasn't clear to me what my intention was when I wrote that code. > Anyway, I'll add it as an issue in FiPy. > > Thanks! > > On Thu, Jan 9, 2020 at 9:13 PM Chaitanya Joshi > wrote: > > > > Hi, > > > > I am working with the leveler.py script in the level set examples. The > > script chooses dt value for solving the equations based on the maximum > > velocity of the interface at any given instant and the CFL number. > > > > Script: leveler.py > > dt = cflNumber * cellSize / extOnInt.max() > > > > I changed that to a user specified fixed dt. To test the changes I made, I > > ran the script for a flat interface and plotted acceleratorVar.interfaceVar > > as a function of time for different dt values. Unfortunately, I was unable > > to get dt convergence. By trial and error, I found out that if I call > > AdsorbingSurfactantEquation with consumptionCoeff=None, > > I get dt convergence. I then went through the > > AdsorbingSurfactantEquation.py to see if I can find something. I think > > there is a dt term missing in the AdsorbingSurfactantEquation.py. > > > > Script: AdsorbingSurfactantEquation.py > > self.eq = TransientTerm(coeff = 1) - > > ExplicitUpwindConvectionTerm(SurfactantConvectionVariable(distanceVar)) > > self.dt = Variable(0.) > > mesh = distanceVar.mesh > > adsorptionCoeff = self.dt * bulkVar * rateConstant #dt > > multiplication > >spCoeff = adsorptionCoeff * distanceVar._cellInterfaceFlag > > scCoeff = adsorptionCoeff * distanceVar.cellInterfaceAreas / > > mesh.cellVolumes > > self.eq += ImplicitSourceTerm(spCoeff) - scCoeff > > if otherVar is not None: > > otherSpCoeff = self.dt * otherBulkVar * otherRateConstant * > > distanceVar._cellInterfaceFlag #dt multiplication > > otherScCoeff = -otherVar.interfaceVar * scCoeff > > self.eq += ImplicitSourceTerm(otherSpCoeff) - otherScCoeff > > > > if consumptionCoeff is not None: > > self.eq += ImplicitSourceTerm(consumptionCoeff) #This is > > where I think a dt term is missing > > > > I believe the line should be > > if consumptionCoeff is not None: > > self.eq += ImplicitSourceTerm(consumptionCoeff*self.dt) > > > > Please let me know if I am thinking on the right lines. > > > > Regards, > > Chaitanya > > > > > > > > ___ > > fipy mailing list > > fipy@nist.gov > > http://www.ctcms.nist.gov/fipy > > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > > > -- > Daniel Wheeler -- Daniel Wheeler ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Re: Query on AdsorbingSurfactantEquation.py consumptionCoeff
Hi Chaitanya, I think you're correct. It seems that term should be multiplied by the time step. The tests all pass with your change. Would you like to submit a pull-request for that change? The way time stepping works is a bit weird in that equation so it wasn't clear to me what my intention was when I wrote that code. Anyway, I'll add it as an issue in FiPy. Thanks! On Thu, Jan 9, 2020 at 9:13 PM Chaitanya Joshi wrote: > > Hi, > > I am working with the leveler.py script in the level set examples. The script > chooses dt value for solving the equations based on the maximum velocity of > the interface at any given instant and the CFL number. > > Script: leveler.py > dt = cflNumber * cellSize / extOnInt.max() > > I changed that to a user specified fixed dt. To test the changes I made, I > ran the script for a flat interface and plotted acceleratorVar.interfaceVar > as a function of time for different dt values. Unfortunately, I was unable to > get dt convergence. By trial and error, I found out that if I call > AdsorbingSurfactantEquation with consumptionCoeff=None, > I get dt convergence. I then went through the AdsorbingSurfactantEquation.py > to see if I can find something. I think there is a dt term missing in the > AdsorbingSurfactantEquation.py. > > Script: AdsorbingSurfactantEquation.py > self.eq = TransientTerm(coeff = 1) - > ExplicitUpwindConvectionTerm(SurfactantConvectionVariable(distanceVar)) > self.dt = Variable(0.) > mesh = distanceVar.mesh > adsorptionCoeff = self.dt * bulkVar * rateConstant #dt multiplication >spCoeff = adsorptionCoeff * distanceVar._cellInterfaceFlag > scCoeff = adsorptionCoeff * distanceVar.cellInterfaceAreas / > mesh.cellVolumes > self.eq += ImplicitSourceTerm(spCoeff) - scCoeff > if otherVar is not None: > otherSpCoeff = self.dt * otherBulkVar * otherRateConstant * > distanceVar._cellInterfaceFlag #dt multiplication > otherScCoeff = -otherVar.interfaceVar * scCoeff > self.eq += ImplicitSourceTerm(otherSpCoeff) - otherScCoeff > > if consumptionCoeff is not None: > self.eq += ImplicitSourceTerm(consumptionCoeff) #This is where > I think a dt term is missing > > I believe the line should be > if consumptionCoeff is not None: > self.eq += ImplicitSourceTerm(consumptionCoeff*self.dt) > > Please let me know if I am thinking on the right lines. > > Regards, > Chaitanya > > > > ___ > 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 ]
Query on AdsorbingSurfactantEquation.py consumptionCoeff
Hi, I am working with the leveler.py script in the level set examples. The script chooses dt value for solving the equations based on the maximum velocity of the interface at any given instant and the CFL number. Script: leveler.py dt = cflNumber * cellSize / extOnInt.max() I changed that to a user specified fixed dt. To test the changes I made, I ran the script for a flat interface and plotted acceleratorVar.interfaceVar as a function of time for different dt values. Unfortunately, I was unable to get dt convergence. By trial and error, I found out that if I call AdsorbingSurfactantEquation with consumptionCoeff=None, I get dt convergence. I then went through the AdsorbingSurfactantEquation.py to see if I can find something. I think there is a dt term missing in the AdsorbingSurfactantEquation.py. Script: AdsorbingSurfactantEquation.py self.eq = TransientTerm(coeff = 1) - ExplicitUpwindConvectionTerm(SurfactantConvectionVariable(distanceVar)) *self.dt* = Variable(0.) mesh = distanceVar.mesh adsorptionCoeff = *self.dt* * bulkVar * rateConstant *#dt multiplication * spCoeff = adsorptionCoeff * distanceVar._cellInterfaceFlag scCoeff = adsorptionCoeff * distanceVar.cellInterfaceAreas / mesh.cellVolumes self.eq += ImplicitSourceTerm(spCoeff) - scCoeff if otherVar is not None: otherSpCoeff = *self.dt* * otherBulkVar * otherRateConstant * distanceVar._cellInterfaceFlag *#dt multiplication* otherScCoeff = -otherVar.interfaceVar * scCoeff self.eq += ImplicitSourceTerm(otherSpCoeff) - otherScCoeff if consumptionCoeff is not None: self.eq += ImplicitSourceTerm(consumptionCoeff) * #This is where I think a dt term is missing* I believe the line should be if consumptionCoeff is not None: self.eq += ImplicitSourceTerm(consumptionCoeff**self.dt*) Please let me know if I am thinking on the right lines. Regards, Chaitanya ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]