use of org.vcell.solver.comsol.service.ComsolServiceFactory in project vcell by virtualcell.
the class ComsolSolver method initialize.
@Override
protected void initialize() throws SolverException {
try {
this.vccModel = ComsolModelBuilder.getVCCModel(getSimulationJob());
// write mesh file
File meshFile = new File(getSaveDirectory(), simTask.getSimulationJob().getSimulationJobID() + SimDataConstants.MESHFILE_EXTENSION);
try (FileOutputStream fos = new FileOutputStream(meshFile)) {
simTask.getSimulation().getMathDescription().getGeometry().getGeometrySurfaceDescription().updateAll();
CartesianMesh mesh = CartesianMesh.createSimpleCartesianMesh(simTask.getSimulation().getMathDescription().getGeometry());
mesh.write(new PrintStream(new BufferedOutputStream(fos)));
} catch (Exception e) {
e.printStackTrace(System.out);
throw new SolverException(e.getMessage());
}
ComsolServiceFactory factory = ComsolServiceFactory.instance;
if (factory == null) {
throw new RuntimeException("no Comsol Service available");
}
this.comsolService = factory.newComsolService();
} catch (ExpressionException e) {
e.printStackTrace();
throw new SolverException("failed to generate VCell Comsol Model in ComsolSolver: " + e.getMessage(), e);
}
}
Aggregations