use of cbit.vcell.math.MemVariable in project vcell by virtualcell.
the class SimulationTask method getEstimatedMemorySizeMB.
public double getEstimatedMemorySizeMB() {
//
// calculate number of PDE variables and total number of spatial variables
//
SimulationSymbolTable simSymbolTable = getSimulationJob().getSimulationSymbolTable();
Simulation simulation = simSymbolTable.getSimulation();
MathDescription mathDescription = simulation.getMathDescription();
int pdeVarCount = 0;
int odeVarCount = 0;
Variable[] variables = simSymbolTable.getVariables();
for (int i = 0; i < variables.length; i++) {
if (variables[i] instanceof VolVariable) {
if (mathDescription.isPDE((VolVariable) variables[i])) {
pdeVarCount++;
} else {
odeVarCount++;
}
} else if (variables[i] instanceof MemVariable) {
if (mathDescription.isPDE((MemVariable) variables[i])) {
pdeVarCount++;
} else {
odeVarCount++;
}
}
}
long numMeshPoints = 1;
if (simulation.isSpatial()) {
ISize samplingSize = simulation.getMeshSpecification().getSamplingSize();
numMeshPoints = samplingSize.getX() * samplingSize.getY() * samplingSize.getZ();
}
// 180 bytes per pde variable plus ode per mesh point + 15M overhead
// there is 70M PBS overhead which will be added when submitted to pbs
double est = ((180 * pdeVarCount + 16 * odeVarCount) * numMeshPoints / 1e6 + 15);
if (simulation.getSolverTaskDescription().getSolverDescription().equals(SolverDescription.SundialsPDE)) {
est *= 2;
}
return est;
}
Aggregations