Re: Compute total free energy of a system

2018-01-04 Thread Guyer, Jonathan E. Dr. (Fed)
I believe (...).cellVolumeAverage * mesh.cellVolumes.sum() is what you want.


> On Jan 4, 2018, at 10:49 AM, Daniel Wheeler  wrote:
> 
> You might want to multiply by the cell volumes, "mesh.cellVolumes".
> 
> On Thu, Jan 4, 2018 at 10:22 AM, Anders Ericsson
>  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 ]


Re: Compute total free energy of a system

2018-01-04 Thread Daniel Wheeler
You might want to multiply by the cell volumes, "mesh.cellVolumes".

On Thu, Jan 4, 2018 at 10:22 AM, Anders Ericsson
 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 ]


Compute total free energy of a system

2018-01-04 Thread Anders Ericsson
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?


Thank you and best regards,

Anders



---
Anders Ericsson
Ph.D. Student
Division of Solid Mechanics
Lund University/LTH
Box 118
S-221 00 Lund, Sweden
Phone: +46 (0)46 222 1684
Email: 
anders.erics...@solid.lth.se

___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]