Replies inline On Mon, Apr 8, 2019 at 7:30 PM Guyer, Jonathan E. Dr. (Fed) via fipy < fipy@nist.gov> wrote:
> > > > On Apr 8, 2019, at 11:30 AM, Dario Panada <dario.pan...@gmail.com> > wrote: > > > I two initial numpy grids (n*n*n) where each value corresponds to a > source/sink. Eg: Given my source grid and coordinates (1,2,3) having value > 5, I want to set such value as a source in FiPy. > > That wasn't my question. When you publish your research, is your paper > going to say "We put a source at array index (1,2,3)"? Why did you put it > there? What physical process would you be modeling by having a source at > index (1,2,3)? Would that physical process be changed by modeling a > 40x40x40 grid? > > DP: That would be diffusion of solubles from blood vessels (endothelial cells). Specifically, glucose or oxygen. It wouldn't change significantly be increasing it to a 40x40x40 grid, you'd just be simulating a larger section of tissue. > > I suppose I could build the entire vector of sources before and then > doing a single assignment to _array, but again you correctly mentioned that > relying on that is bad practice. > > If you assign to _array, I will change the FiPy codebase for the sole, > spiteful purpose of breaking your code. > > DP: English is my first language but I think that's some tough sarcasm to tell me not to do that. In that case, I'll happily take advice on *proper* ways of achieving the same result so as not to cumber the dev team with unnecessary refactoring. So, in essence, I have a 20x20x20 grid of values. I want to somehow input these values into a 20x20x20 structured mesh in the CellVariable object. The fact that the approach might not work in unstructured meshes isn't concerning because I don't require that feature. Setting values in *_array *appears to work but is not an acceptable solution. From the previous exchange with Martin, using the *value* property appears possible, although raveling indexes has also been discouraged. So, any advice? > > You mention: > > > > sourceGrid[..., i] = sourceRate > > > > Can I just please confirm what data type sourceGrid is? In the context > of defining the equation > > sourceGrid is a CellVariable > > > > > eq = TransientTerm() == DiffusionTerm(coeff=D) + sourceGrid - sinkGrid > > > > Can sourceGrid/sinkGrid just be numpy arrays or even simple python > lists? I was under the impression they had to be CellVariable objects but > could be wrong. > > sourceGrid and sinkGrid must be CellVariables. > > > _______________________________________________ > 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 ]