TDycores-Project / TDycore

BSD 2-Clause "Simplified" License
4 stars 0 forks source link

Make material property, boundary condition functions vectorizable #196

Closed jeff-cohere closed 2 years ago

jeff-cohere commented 3 years ago

@jedbrown has suggested in #195 that we modify the signature of the functions we have been using for material properties and boundary conditions to accept an array of input positions and populate an array of outputs. Specifically, we want to change from a "single-point evaluation" approach, e.g.

f(tdy, x, v, ctx)

to a multi-point evaluation approach:

f(tdy, n, X, V, ctx)

In the single-point approach,

The multi-point approach replaces x and v with

This is a pretty easy thing to do and will probably buy us some performance.

jedbrown commented 3 years ago

Note that this is consistent with the formulation we use in libCEED. Usually one does this in batches that fit conveniently in cache. I don't know if it's a bottleneck at present, but if the material models become expensive, we'll want them to vectorize. Note that some special functions (log1p in our hyperelasticity work) are not vectorized by default with gcc/clang. (For log1p in libCEED, we implemented a series expansion that delivers the necessary accuracy over reasonable input range, though one can also use libraries like SVML.)