Thanks to both of you, I will try it!
Regards, Anders ________________________________ From: fipy-boun...@nist.gov <fipy-boun...@nist.gov> on behalf of Guyer, Jonathan E. Dr. (Fed) <jonathan.gu...@nist.gov> Sent: Thursday, January 4, 2018 6:01:05 PM To: FIPY Subject: Re: Compute total free energy of a system I believe (...).cellVolumeAverage * mesh.cellVolumes.sum() is what you want. > On Jan 4, 2018, at 10:49 AM, Daniel Wheeler <daniel.wheel...@gmail.com> wrote: > > You might want to multiply by the cell volumes, "mesh.cellVolumes". > > On Thu, Jan 4, 2018 at 10:22 AM, Anders Ericsson > <anders.erics...@solid.lth.se> wrote: >> Hi, >> >> >> I wonder if there is a simple way to compute the total free energy of a >> system (Phase-field modeling) in FiPy? >> >> >> That is e.g.: >> >> >> \begin{equation} >> F = \int_V f(\phi, c, T) + \frac{\epsilon_{\phi}^2}{2}\nabla \phi^2 dV >> \end{equation} >> >> I figured that it would be something in accordance with: >> >> def freeEnergyVolume(phi_, c_, T, epsSq): >> return (0.5 * epsSq * (phi_.grad.mag)**2 + >> f(phi_,c_,T)).cellVolumeAverage >> >> But cellVolumeAverage wouldn't give me the full energy of the domain if I'm >> not mistaken? > > > -- > Daniel Wheeler > _______________________________________________ > 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 ]
_______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]