On Fri, Jan 10, 2014 at 10:27 AM, Benjamin Hepp
<[email protected]> wrote:
> Hello,
>
> I have a diffusion problem: u_t = D * u_{xx}
> Is there any way to extract the mass and stiffness matrices from FiPy
> after everything has been setup?
I'm not sure what the mass and stiffness matrices are in the Finite
Volume method. Just from intuition, would it be,
M u_t + K u = 0
in discretized form? The mass matrix is the transient operator and the
stiffness matrix is the diffusion operator.
I guess that in the FVM, the mass matrix is just the volume of the
cells, which isn't very interesting. To get the matrix for
L u = f
then you need to tell the equation to cache it's matrix.
import fipy as fp
D = 3.
m = fp.Grid1D(nx=4, dx=0.1)
v = fp.CellVariable(mesh=m)
eqn = fp.TransientTerm() == fp.DiffusionTerm(D)
eqn.cacheMatrix()
eqn.solve(v, dt=0.4)
print eqn.matrix
This is a mixture of both the stiffness and mass matrices.
--
Daniel Wheeler
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]