In the example from the fipy documentation the following code is used to "create a Viewer to see the mesh":
viewer = None
if __name__ == '__main__':
try:
viewer = Viewer(vars=phi, datamin=-1, datamax=1.)
viewer.plotMesh()
input("Irregular circular mesh. Press <return> to proceed...") # doctest: +GMSH
except:
print("Unable to create a viewer for an irregular mesh (try Matplotlib2DViewer or MayaviViewer)"
Could someone explain to me why this way is chosen over the simplified version of:
viewer = Viewer(vars=T, datamin=T0, datamax=Tu)
viewer.plotMesh()
input("Irregular circular mesh. Press <return> to proceed")
I guess it links to the question if the code is in the main program or if things got imported but i do not quite understand the advantage/disadvantage yet and would appreciate to clarify someone helping me:)