Clarifying doc on svector for many models, resetting svector values in granular model

This commit is contained in:
jtclemm
2025-01-17 11:56:26 -07:00
parent e6a84d5f2a
commit 769b0b9211
2 changed files with 9 additions and 2 deletions

View File

@ -941,7 +941,11 @@ calculate the amount of heat exchanged), these quantities are appended
to the end of this list. First, any extra values from the normal submodel
are appended followed by the damping, tangential, rolling, twisting, then
heat models. See the descriptions of specific granular submodels above
for information on any extra quantities.
for information on any extra quantities. If two or more models are
defined by pair coefficients, the size of the array is set by the
maximum number of extra quantities in a model but the order of quantities
is determined by each model's specific set of submodels. Any unused
quantities are zeroed.
These extra quantities can be accessed by the :doc:`compute pair/local <compute_pair_local>` command, as *p1*, *p2*, ...,
*p12*\ .

View File

@ -305,6 +305,7 @@ void GranularModel::init()
for (int i = 0; i < NSUBMODELS; i++) sub_models[i]->init();
nsvector = 0;
int index_svector = 0;
for (int i = 0; i < NSUBMODELS; i++) {
if (sub_models[i]->nsvector != 0) {
@ -314,8 +315,10 @@ void GranularModel::init()
}
}
if (nsvector != 0)
if (nsvector != 0) {
delete[] svector;
svector = new double[nsvector];
}
}
/* ---------------------------------------------------------------------- */