Tags: feellgood/FeeLLGood
Tags
Use precomputed volumes for computing averages The per-region and global averaged quantities are computed by integrating both the quantity to be averaged and the volume of the integration region. The latter is either a region volume or the total mesh volume, and all of these are already known. Use the known volumes instead of recomputing them each time.
Fix sign of demagnetizing energy in the right place The previous commit changed the sign of the contribution of the volume charges to the demagnetizing energy. It turns out the sign within the expression was right to begin with. However, it relied on Tet::interpolation(), which had the wrong sign. This error did not affect the magnetization dynamics because that particular overload of Tet::interpolation() is only used to compute the demagnetizing energy. For sanity's sake, use the right sign in both places.
Fix the serialization of multiline functions
As both Bext and initial_magnetization can be defined as JavaScript
function expressions, this encourages the use of YAML multiline strings.
Let `feellgood --verify` properly serialize them as "literal style"
multiline strings, e.g.
Bext: |
function(t) {
// ...
}
Replace exprtk with Duktape
Duktape is a compact, easy to integrate embeddable JavaScript engine.[1]
Use it, instead of exprtk, to reimplement MagnetizationParser and
TimeDepFieldParser, without touching their interface. The expressions of
the initial magnetization provided by the user can be converted into
JavaScript function expressions by this string concatenation:
"function(x,y,z) { return (" + expression + "); }"
Update the documentation files README.md and License.txt accordingly.
Also update install-dependencies.sh in order to install Duktape instead
of exprtk.
Tests show a spectacular reduction in build time and binary size. These
were measured by doing a clean build on an Intel Xeon W-2255 (10 cores,
20 threads), with `make -j 20`, no ccache, and a warm disk cache.
Duktape was linked statically in order to make the size comparison fair:
exprtk duktape
─────────────────────────────────────
build time (s) 52.257 5.316
binary size 12,440,856 1,409,112
There is no measurable difference in feeLLGood's performance.
Note that the set of primitives available for building expressions has
changed: these are now interpreted according to the standard JavaScript
syntax, with the addition that all properties of the `Math` object can
be accessed without the `Math.` prefix. Worth noting:
* π is `PI` (in upper case)
* the exponentiation operator is `**`
* the `random()` function returns a pseudo-random number within [0, 1)
[1] https://duktape.org/
PreviousNext