Search in sources :

Example 21 with MemVariable

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;
}
Also used : Variable(cbit.vcell.math.Variable) VolVariable(cbit.vcell.math.VolVariable) MemVariable(cbit.vcell.math.MemVariable) Simulation(cbit.vcell.solver.Simulation) MemVariable(cbit.vcell.math.MemVariable) MathDescription(cbit.vcell.math.MathDescription) VolVariable(cbit.vcell.math.VolVariable) ISize(org.vcell.util.ISize) SimulationSymbolTable(cbit.vcell.solver.SimulationSymbolTable)

Aggregations

MemVariable (cbit.vcell.math.MemVariable)21 VolVariable (cbit.vcell.math.VolVariable)19 Variable (cbit.vcell.math.Variable)15 MembraneRegionVariable (cbit.vcell.math.MembraneRegionVariable)14 VolumeRegionVariable (cbit.vcell.math.VolumeRegionVariable)13 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)10 ReservedVariable (cbit.vcell.math.ReservedVariable)10 Expression (cbit.vcell.parser.Expression)10 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)9 FilamentVariable (cbit.vcell.math.FilamentVariable)9 FilamentRegionVariable (cbit.vcell.math.FilamentRegionVariable)8 MathDescription (cbit.vcell.math.MathDescription)8 Constant (cbit.vcell.math.Constant)7 InsideVariable (cbit.vcell.math.InsideVariable)7 OutsideVariable (cbit.vcell.math.OutsideVariable)7 SubDomain (cbit.vcell.math.SubDomain)7 MathException (cbit.vcell.math.MathException)6 SubVolume (cbit.vcell.geometry.SubVolume)4 Equation (cbit.vcell.math.Equation)4 FastInvariant (cbit.vcell.math.FastInvariant)4