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 ]
Re: Problem in dump.write for vector variables
Thank you for the feedback. I'm inclined to agree. - Jon > On Jan 9, 2020, at 3:47 AM, Marcel UJI (IMAP) wrote: > > Hi Jonathan > > Sorry by my late reply > > I think that the second one would be enough as I only need to read this data > later for further processing. Actually this is not much an issue, as I can > simply save phi and later recompute phi.faceGrad, which is also much more > economic in terms of storage. > > Thank you anyway for spending some time on this > > Marcel > > > > El 20/12/19 a les 16:27, Guyer, Jonathan E. Dr. (Fed) via fipy ha escrit: >> Glad you found a solution, Marcel. >> >> The issue is that a FaceGradVariable doesn't pickle itself properly. It >> stores the state for a generic FaceVariable, but then it doesn't know how to >> rebuild itself from that. >> >> It either should >> - pickle the correct information, which would also involve pickling phi >> OR >> - pickle itself as a plain FaceVariable, losing connection to phi on >> unpickling (which is what your solution does) >> >> Do you have an opinion on which behavior you'd like? >> >> >>> On Dec 20, 2019, at 2:35 AM, Marcel UJI (IMAP) >>> wrote: >>> >>> Thank you Trevor, >>> >>> This works, but it saves the array values only. >>> >>> I found an alternative solution with: >>> >>> dump.write({'E' : >>> FaceVariable(mesh=mesh,value=phi.faceGrad,rank=1)},filename='prova.gz',extension='.gz') >>> >>> which preserves the FaceVariable character. >>> >>> Merry Christmas! >>> >>> Marcel >>> >>> >>> >>> El 19/12/19 a les 19:04, Keller, Trevor (Fed) via fipy ha escrit: >>> The error message indicates that `dump.read` got something unexpected -- namely, a `value` field -- and threw. Naïvely, dumping `phi.faceGrad.value` instea dof `phi.faceGrad` appears to do the trick. >>> -- >>> Dr. Marcel Aguilella-Arzo >>> Professor Titular d'Universitat, Física Aplicada >>> Coordinador de la Subespecialitat de CCEETT del Màster en Professor >>> d'Educació Secundària >>> Departament de Física >>> Escola Superior de Tecnologia i Ciències Experimentals >>> Universitat Jaume I >>> Av. Sos Baynat, s/n >>> 12071 Castelló de la Plana (Spain) >>> +34 964 728 046 >>> >>> >>> a...@uji.es >>> >>> ___ >>> 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 >> ] >> > -- > Dr. Marcel Aguilella-Arzo > Professor Titular d'Universitat, Física Aplicada > Coordinador de la Subespecialitat de CCEETT del Màster en Professor > d'Educació Secundària > Departament de Física > Escola Superior de Tecnologia i Ciències Experimentals > Universitat Jaume I > Av. Sos Baynat, s/n > 12071 Castelló de la Plana (Spain) > +34 964 728 046 > > a...@uji.es > ___ > 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 ]
Re: Problem in dump.write for vector variables
Hi Jonathan Sorry by my late reply I think that the second one would be enough as I only need to read this data later for further processing. Actually this is not much an issue, as I can simply save phi and later recompute phi.faceGrad, which is also much more economic in terms of storage. Thank you anyway for spending some time on this Marcel El 20/12/19 a les 16:27, Guyer, Jonathan E. Dr. (Fed) via fipy ha escrit: Glad you found a solution, Marcel. The issue is that a FaceGradVariable doesn't pickle itself properly. It stores the state for a generic FaceVariable, but then it doesn't know how to rebuild itself from that. It either should - pickle the correct information, which would also involve pickling phi OR - pickle itself as a plain FaceVariable, losing connection to phi on unpickling (which is what your solution does) Do you have an opinion on which behavior you'd like? On Dec 20, 2019, at 2:35 AM, Marcel UJI (IMAP) wrote: Thank you Trevor, This works, but it saves the array values only. I found an alternative solution with: dump.write({'E' : FaceVariable(mesh=mesh,value=phi.faceGrad,rank=1)},filename='prova.gz',extension='.gz') which preserves the FaceVariable character. Merry Christmas! Marcel El 19/12/19 a les 19:04, Keller, Trevor (Fed) via fipy ha escrit: The error message indicates that `dump.read` got something unexpected -- namely, a `value` field -- and threw. Naïvely, dumping `phi.faceGrad.value` instea dof `phi.faceGrad` appears to do the trick. -- Dr. Marcel Aguilella-Arzo Professor Titular d'Universitat, Física Aplicada Coordinador de la Subespecialitat de CCEETT del Màster en Professor d'Educació Secundària Departament de Física Escola Superior de Tecnologia i Ciències Experimentals Universitat Jaume I Av. Sos Baynat, s/n 12071 Castelló de la Plana (Spain) +34 964 728 046 a...@uji.es ___ 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 ] -- Dr. Marcel Aguilella-Arzo Professor Titular d'Universitat, Física Aplicada Coordinador de la Subespecialitat de CCEETT del Màster en Professor d'Educació Secundària Departament de Física Escola Superior de Tecnologia i Ciències Experimentals Universitat Jaume I Av. Sos Baynat, s/n 12071 Castelló de la Plana (Spain) +34 964 728 046 a...@uji.es ___ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]