Discussion:
Units within sweeping a system
Kevin Blondino
2018-03-27 09:31:01 UTC
Permalink
Hi,

I apologize if I am asking too many somewhat basic questions, as I would
still consider myself new to using mathematical software to this degree.

I wish to use units in my nonlinear coupled system. So far, I have gotten
the units to work in all my algebraic calculations; however, when I try
solving, FiPy claims it cannot sweep with units, because it can't convert
to "floats." The exact error is the following:

TypeError, Not possible to convert a PhysicalField with dimension to float



One of the equations in the system is as such, with density and diffusivity
having units of m^-3 and m^2/s, respectively.

density.equation = TransientTerm(coeff=1.0, var=density)\
== DiffusionTerm(coeff=Diffusivity, var=density)
If I tack on ".numericValue" on to the end of the coefficient terms, a
different error is raised. It is also important to note that my system is 1
dimensional and without any use of tensors.

IndexError: diffusion coefficient tensor is not an appropriate shape for
this mesh
Do I need to fully-remove any form of units in both the coefficient and/or
the var of the Transient/Diffusion terms before sweeping?


Thanks,
Kevin
Guyer, Jonathan E. Dr. (Fed)
2018-03-27 15:16:56 UTC
Permalink
Units are not as well integrated in FiPy as I would like. The best I can offer is that you declare dimensional parameters and then combine them into dimensionless coefficients before sending them off to the solvers. Not very satisfactory, I'll admin.

Even if they did work, you'll find that your equation is not balanced. Neither TransientTerm nor DiffusionTerm has any intrinsic units unless you assign them. In the case of TransientTerm, you do this with a dimensional coeff. For the DiffusionTerm, you would need to declare a dimensional mesh, e.g., `mesh = fp.Grid1D(nx=..., dx="1 mum")`, but that seems to be broken right now.
Hi,
I apologize if I am asking too many somewhat basic questions, as I would still consider myself new to using mathematical software to this degree.
TypeError, Not possible to convert a PhysicalField with dimension to float
One of the equations in the system is as such, with density and diffusivity having units of m^-3 and m^2/s, respectively.
density.equation = TransientTerm(coeff=1.0, var=density)\
== DiffusionTerm(coeff=Diffusivity, var=density)
If I tack on ".numericValue" on to the end of the coefficient terms, a different error is raised. It is also important to note that my system is 1 dimensional and without any use of tensors.
IndexError: diffusion coefficient tensor is not an appropriate shape for this mesh
Do I need to fully-remove any form of units in both the coefficient and/or the var of the Transient/Diffusion terms before sweeping?
Thanks,
Kevin
_______________________________________________
fipy mailing list
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Loading...