Giter Club home page Giter Club logo

Comments (4)

marijanbeg avatar marijanbeg commented on June 15, 2024

The question is whether Quantity class should be separate class, or it can simply be a Field class to which unit is assigned. It is maybe not a smart solution to have a constant scalar field object just to represent A=8.87e-12 for example, but we should somehow take into account spatially varying parameters, which can be easily represented with scalar fields.

from ubermag.

fangohr avatar fangohr commented on June 15, 2024

The Field class could have a units attribute which is the Quantity object. We could then assume that the values in the field class need to be multiplied by the quantity object to get the actual field values. (It is not clear whether we want to allow the number in the Quantitity to be different from one - if we do, then lots of code will have to multiply the number with the actual Field (numpy array or scalar, say), which is both a repeated extra operation (performance) and might be forgotten (correctness). So in practice, we could use the units attributed just to store the physical dimensions, such as A/m.

For the latex representation, we can get the units from units, and we can get the number from the Field. If the Field is spatially varying, we could compute the average value, or some other statistical measure for the latex representation.

from ubermag.

fangohr avatar fangohr commented on June 15, 2024

A related question is whether we should use the Field class to represent objects that are often just a scalar, but could vary, such as the exchange constant A. I suppose we could do that; either by just accepting that we waste some memory if a scalar A is stored once for every cell. Or by having specialist Field classes for constants (which store the constants only once but provide the same interface). There may be a performance penalty though; this needs a little bit more thought / experimentation.

from ubermag.

marijanbeg avatar marijanbeg commented on June 15, 2024

This idea has been abandoned for simplicity. We assume everything is in SI units.

from ubermag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.