Tutorial: Complex Geometries¶
This tutorial covers multi-compartment geometries, importing geometries from existing models, and analytic geometry primitives.
See also the Complex Geometries reference guide.
Define a multi-compartment model¶
In [1]:
Copied!
import pyvcell.vcml as vc
antimony_str = """
compartment ec = 10000;
compartment cell = 5000;
compartment pm = 100;
compartment nuc = 300;
compartment nuc_env = 40;
species A in cell;
species B in cell;
J0: A -> B; cell * (k1*A - k2*B)
J0 in cell;
k1 = 5.0; k2 = 2.0
A = 10
"""
biomodel = vc.load_antimony_str(antimony_str)
model = biomodel.model
model.get_compartment("pm").dim = 2
model.get_compartment("nuc_env").dim = 2
print(model)
import pyvcell.vcml as vc
antimony_str = """
compartment ec = 10000;
compartment cell = 5000;
compartment pm = 100;
compartment nuc = 300;
compartment nuc_env = 40;
species A in cell;
species B in cell;
J0: A -> B; cell * (k1*A - k2*B)
J0 in cell;
k1 = 5.0; k2 = 2.0
A = 10
"""
biomodel = vc.load_antimony_str(antimony_str)
model = biomodel.model
model.get_compartment("pm").dim = 2
model.get_compartment("nuc_env").dim = 2
print(model)
2026-03-08T03:59:10.139202Z main WARN The use of package scanning to locate Log4j plugins is deprecated.
Please remove the `packages` attribute from your configuration file.
See https://logging.apache.org/log4j/2.x/faq.html#package-scanning for details.
2026-03-07 22:59:10,142 ERROR (SBMLDocument.java:573) - There was an error accessing the sbml online validator!
2026-03-08T03:59:10.146960Z main WARN The Logger cbit.vcell.model.Kinetics was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@32499e7a and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-08T03:59:10.149649Z main WARN The Logger cbit.vcell.mapping.AbstractMathMapping was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@32499e7a and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-07 22:59:10,150 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:10,150 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:10,150 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:10,150 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:10,150 INFO (Entrypoints.java:172) - Returning from sbmlToVcell: {"success":true,"message":"Success"}
name='unnamed' species=[Species(name='A', compartment_name='cell'), Species(name='B', compartment_name='cell')] compartments=[Compartment(name='ec', dim=3), Compartment(name='cell', dim=3), Compartment(name='pm', dim=2), Compartment(name='nuc', dim=3), Compartment(name='nuc_env', dim=2)] reactions=[Reaction(name='J0', compartment_name='cell', reversible=True, is_flux=False, kinetics=Kinetics(kinetics_type='GeneralKinetics', kinetics_parameters=[KineticsParameter(name='J', value='((A * k1) - (B * k2))', role='reaction rate', unit='s-1', reaction_name='J0')]), reactants=[SpeciesReference(name='A', stoichiometry=1, species_ref_type=<SpeciesRefType.reactant: 'reactant'>)], products=[SpeciesReference(name='B', stoichiometry=1, species_ref_type=<SpeciesRefType.product: 'product'>)])] model_parameters=[ModelParameter(name='k1', value=5.0, role='user defined', unit='tbd'), ModelParameter(name='k2', value=2.0, role='user defined', unit='tbd')]
Load geometry from an existing model¶
In [2]:
Copied!
tutorial_biomodel = vc.load_vcml_url(
"https://raw.githubusercontent.com/virtualcell/pyvcell/refs/heads/main/"
"examples/models/Tutorial_MultiApp_PDE.vcml"
)
tutorial_geometry = tutorial_biomodel.applications[0].geometry
print("Subvolumes:", tutorial_geometry.subvolume_names)
print("Surfaces:", tutorial_geometry.surface_class_names)
tutorial_biomodel = vc.load_vcml_url(
"https://raw.githubusercontent.com/virtualcell/pyvcell/refs/heads/main/"
"examples/models/Tutorial_MultiApp_PDE.vcml"
)
tutorial_geometry = tutorial_biomodel.applications[0].geometry
print("Subvolumes:", tutorial_geometry.subvolume_names)
print("Surfaces:", tutorial_geometry.surface_class_names)
Subvolumes: ['ec', 'cytosol', 'Nucleus'] Surfaces: ['cytosol_ec_membrane', 'Nucleus_cytosol_membrane']
Visualize the imported geometry¶
In [3]:
Copied!
tutorial_geometry.plot(save_path="../images/complex-geometry.png")
tutorial_geometry.plot(save_path="../images/complex-geometry.png")
/Users/jimschaff/Documents/workspace/pyvcell/pyvcell/_internal/geometry/segmented_image_geometry.py:94: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown plt.show()
Map compartments and simulate¶
In [4]:
Copied!
app = biomodel.add_application("app1", geometry=tutorial_geometry)
app.map_compartment("cell", "cytosol")
app.map_compartment("ec", "ec")
app.map_compartment("nuc", "Nucleus")
app.map_compartment("nuc_env", "Nucleus_cytosol_membrane")
app.map_compartment("pm", "cytosol_ec_membrane")
app.map_species("A", init_conc="3+sin(0.2*x)", diff_coef=1.0)
app.map_species("B", init_conc="2+cos(0.2*(x+y+z))", diff_coef=1.0)
sim = app.add_sim(name="sim1", duration=2.0, output_time_step=0.05, mesh_size=(50, 50, 50))
results = vc.simulate(biomodel=biomodel, simulation="sim1")
app = biomodel.add_application("app1", geometry=tutorial_geometry)
app.map_compartment("cell", "cytosol")
app.map_compartment("ec", "ec")
app.map_compartment("nuc", "Nucleus")
app.map_compartment("nuc_env", "Nucleus_cytosol_membrane")
app.map_compartment("pm", "cytosol_ec_membrane")
app.map_species("A", init_conc="3+sin(0.2*x)", diff_coef=1.0)
app.map_species("B", init_conc="2+cos(0.2*(x+y+z))", diff_coef=1.0)
sim = app.add_sim(name="sim1", duration=2.0, output_time_step=0.05, mesh_size=(50, 50, 50))
results = vc.simulate(biomodel=biomodel, simulation="sim1")
2026-03-08T03:59:11.262197Z main WARN The use of package scanning to locate Log4j plugins is deprecated. Please remove the `packages` attribute from your configuration file. See https://logging.apache.org/log4j/2.x/faq.html#package-scanning for details. 2026-03-08T03:59:11.265816Z main WARN The Logger cbit.vcell.model.Kinetics was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@4d4cbc68 and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-08T03:59:11.572163Z main WARN The Logger cbit.vcell.mapping.AbstractMathMapping was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@4d4cbc68 and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-07 22:59:11,573 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:11,573 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:11,579 INFO (Entrypoints.java:200) - Returning from vcellToVcml: {"success":true,"message":"Success"}
2026-03-08T03:59:11.595128Z main WARN The use of package scanning to locate Log4j plugins is deprecated.
Please remove the `packages` attribute from your configuration file.
See https://logging.apache.org/log4j/2.x/faq.html#package-scanning for details.
2026-03-08T03:59:11.596187Z main WARN The Logger org.vcell.libvcell.Entrypoints was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@4095eb3c and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-08T03:59:11.600203Z main WARN The Logger cbit.vcell.model.Kinetics was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@4095eb3c and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-08T03:59:11.616877Z main WARN The Logger cbit.vcell.mapping.AbstractMathMapping was created with the message factory org.apache.logging.log4j.message.ReusableMessageFactory@4095eb3c and is now requested with a null message factory (defaults to org.apache.logging.log4j.message.ParameterizedMessageFactory), which may create log events with unexpected formatting.
2026-03-07 22:59:11,625 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:11,625 INFO (DiffEquMathMapping.java:1457) - WARNING:::: MathMapping.refreshMathDescription() ... assigning boundary condition types not unique
2026-03-07 22:59:11,685 INFO (Entrypoints.java:83) - Returning from vcmlToFiniteVolumeInput: {"success":true,"message":"Success"}
Setting Base file name to: `"/Users/jimschaff/Documents/workspace/pyvcell/docs/guides/notebooks/workspace/out_dir_16af6tl4/SimID_600541721_0_"`
Simulation Complete in Main() ...
initializing mesh numVolume=125000 CartesianMesh::computeNormalsFromNeighbors(), compute normals from neighbors Membrane Elements -> N=8306 ============================================== qhull precision warning: 859 has 0 neighbors ! 6830 has 0 neighbors ! --------Num of points that have zero neighbors 2 --------Num Neighbors before symmetrize 48504 --------Num Neighbors after symmetrize 53758 Total volume=5921.705897 Total FluxArea =50.44805177 Total FluxAreaXM =0 Total FluxAreaXP =0 Total FluxAreaYM =34.01199592 Total FluxAreaYP =16.43605585 Total FluxAreaZM =0 Total FluxAreaZP =0 mesh initialized preprocessing finished pdeCount=2, odeCount=0 No log-file found at constructed path `/Users/jimschaff/Documents/workspace/pyvcell/docs/guides/notebooks/workspace/out_dir_16af6tl4/SimID_600541721_0_.log`.simulation [SimID_600541721_0_] started temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0000.sim **This is a little endian machine.** [[[data:0]]] numVolRegions=8 Region 0: size=109830, offset=0 Region 1: size=12164, offset=109830 Region 2: size=1, offset=121994 Region 3: size=5, offset=121995 Region 4: size=7, offset=122000 Region 5: size=2, offset=122007 Region 6: size=2989, offset=122009 Region 7: size=2, offset=124998 # of active points = 125000 Constant diffusion/advection in region cytosol1 Constant diffusion/advection in region cytosol2 Constant diffusion/advection in region cytosol3 Constant diffusion/advection in region cytosol4 Constant diffusion/advection in region cytosol5 Constant diffusion/advection in region cytosol7 numUnknowns = 24362 ****** using Sundials CVode with PREC_LEFT, relTol=1e-07, absTol=1e-09, maxStep=0.1 ---------------------------------- sundials pde solver is starting from time 0 ---------------------------------- temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0001.sim [[[data:0.05]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0002.sim [[[data:0.1]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0003.sim [[[data:0.15]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0004.sim [[[data:0.2]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0005.sim [[[data:0.25]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0006.sim [[[data:0.3]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0007.sim [[[data:0.35]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0008.sim [[[data:0.4]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0009.sim [[[data:0.45]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0010.sim [[[data:0.5]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0011.sim [[[data:0.55]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0012.sim [[[data:0.6]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0013.sim [[[data:0.65]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0014.sim [[[data:0.7]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0015.sim [[[data:0.75]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0016.sim [[[data:0.8]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0017.sim [[[data:0.85]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0018.sim [[[data:0.9]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0019.sim [[[data:0.95]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0020.sim [[[data:1]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0021.sim [[[data:1.05]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0022.sim [[[data:1.1]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0023.sim [[[data:1.15]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0024.sim [[[data:1.2]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0025.sim [[[data:1.25]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0026.sim [[[data:1.3]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0027.sim [[[data:1.35]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0028.sim [[[data:1.4]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0029.sim [[[data:1.45]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0030.sim [[[data:1.5]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0031.sim [[[data:1.55]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0032.sim [[[data:1.6]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0033.sim [[[data:1.65]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0034.sim [[[data:1.7]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0035.sim [[[data:1.75]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0036.sim [[[data:1.8]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0037.sim [[[data:1.85]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0038.sim [[[data:1.9]]]temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0039.sim [[[data:1.95]]] Final Statistics.. lenrw = 243709 leniw = 50 lenrwLS = 243666 leniwLS = 10 nst = 174 nfe = 222 nfeLS = 150 nni = 218 nli = 150 nsetups = 95 netf = 5 npe = 4 nps = 298 ncfn = 0 ncfl = 0 last step = 0.050000 temporary directory used is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/ sim file name is /var/folders/zz/gcfcvgtd5v1cdgj2sw4bjzdr0000gr/T/SimID_600541721_0_0040.sim [[[data:2]]][[[progress:100%]]]
In [5]:
Copied!
results.plotter.plot_concentrations(save_path="../images/complex-concentrations.png")
results.plotter.plot_concentrations(save_path="../images/complex-concentrations.png")
/Users/jimschaff/Documents/workspace/pyvcell/pyvcell/sim_results/plotter.py:71: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown return plt.show()
In [6]:
Copied!
results.plotter.plot_slice_3d(time_index=0, channel_id="A", save_path="../images/complex-slice3d-A.png")
results.plotter.plot_slice_3d(time_index=0, channel_id="A", save_path="../images/complex-slice3d-A.png")
/Users/jimschaff/Documents/workspace/pyvcell/pyvcell/sim_results/plotter.py:138: UserWarning: FigureCanvasAgg is non-interactive, and thus cannot be shown return plt.show()
Analytic geometry primitives¶
You can also build geometries from scratch using analytic helpers.
In [7]:
Copied!
geo = vc.Geometry(name="geo", origin=(0, 0, 0), extent=(10, 10, 10), dim=3)
geo.add_sphere(name="cell_domain", radius=4, center=(5, 5, 5))
geo.add_background(name="ec_domain")
geo.add_surface(name="pm_domain", sub_volume_1="cell_domain", sub_volume_2="ec_domain")
geo.plot(save_path="../images/complex-analytic-geometry.png")
geo = vc.Geometry(name="geo", origin=(0, 0, 0), extent=(10, 10, 10), dim=3)
geo.add_sphere(name="cell_domain", radius=4, center=(5, 5, 5))
geo.add_background(name="ec_domain")
geo.add_surface(name="pm_domain", sub_volume_1="cell_domain", sub_volume_2="ec_domain")
geo.plot(save_path="../images/complex-analytic-geometry.png")
Clean up¶
In [8]:
Copied!
results.cleanup()
results.cleanup()