simudo.io package

Submodules

simudo.io.csv module

class simudo.io.csv.LineCutCsvPlot(filename, function_subspace_registry=None, resolution=5001)[source]

Bases: PlotAddMixin

close()[source]
new(timestamp)[source]
timestamp = 0.0

simudo.io.h5yaml module

class simudo.io.h5yaml.BaseCustomTag[source]

Bases: object

classmethod register_in_dumper(dumper)[source]
classmethod register_in_loader(loader)[source]
yaml_classes = ()
yaml_tag = None
class simudo.io.h5yaml.BaseDolfinMeshFunctionTag(dolfin_h5_manager, key, **kwargs)[source]

Bases: DolfinObjectTag

property yaml_tag
class simudo.io.h5yaml.ClassProperty(fget=None, fset=None, fdel=None, doc=None)[source]

Bases: property

class simudo.io.h5yaml.DolfinFunctionTag(scale=1.0, **kwargs)[source]

Bases: ScaleDolfinObjectTag

yaml_classes = (<class 'dolfin.function.function.Function'>,)
yaml_tag = '!dolfin/function'
class simudo.io.h5yaml.DolfinH5Manager(basepath)[source]

Bases: object

ensure_dir()[source]
filename_from_key(key)[source]
open(comm, key, mode)[source]

returns (key, dolfin.HDF5File)

pass key=None to have a new one randomly generated

class simudo.io.h5yaml.DolfinMeshFunctionBoolTag(dolfin_h5_manager, key, **kwargs)[source]

Bases: BaseDolfinMeshFunctionTag

meshfunction_type_name = 'bool'
yaml_classes = (<class 'dolfin.cpp.mesh.MeshFunctionBool'>,)
class simudo.io.h5yaml.DolfinMeshFunctionDoubleTag(scale=1.0, **kwargs)[source]

Bases: ScaleMixin, BaseDolfinMeshFunctionTag

meshfunction_type_name = 'double'
yaml_classes = (<class 'dolfin.cpp.mesh.MeshFunctionDouble'>,)
class simudo.io.h5yaml.DolfinMeshFunctionIntTag(dolfin_h5_manager, key, **kwargs)[source]

Bases: BaseDolfinMeshFunctionTag

meshfunction_type_name = 'int'
yaml_classes = (<class 'dolfin.cpp.mesh.MeshFunctionInt'>,)
class simudo.io.h5yaml.DolfinMeshFunctionSizetTag(dolfin_h5_manager, key, **kwargs)[source]

Bases: BaseDolfinMeshFunctionTag

meshfunction_type_name = 'size_t'
yaml_classes = (<class 'dolfin.cpp.mesh.MeshFunctionSizet'>,)
class simudo.io.h5yaml.DolfinMeshTag(dolfin_h5_manager, key, **kwargs)[source]

Bases: DolfinObjectTag

load_pass = -10
yaml_classes = (<class 'dolfin.cpp.mesh.Mesh'>,)
yaml_tag = '!dolfin/mesh'
class simudo.io.h5yaml.DolfinObjectTag(dolfin_h5_manager, key, **kwargs)[source]

Bases: BaseCustomTag

classmethod from_yaml(loader, node)[source]
classmethod get_object_mpi_comm(obj)[source]
load_into(obj, comm=None)[source]
load_pass = 0
needs_load_into = True
classmethod to_yaml(dumper, data)[source]
class simudo.io.h5yaml.FrozenSetTag[source]

Bases: BaseCustomTag

classmethod from_yaml(loader, node)[source]
classmethod to_yaml(dumper, data)[source]
yaml_classes = (<class 'frozenset'>,)
yaml_tag = '!frozenset'
class simudo.io.h5yaml.PintQTag[source]

Bases: BaseCustomTag

classmethod from_yaml(loader, node)[source]
classmethod to_yaml(dumper, data)[source]
yaml_classes = (<class 'pint.quantity.Quantity'>,)
yaml_tag = '!pintq'
class simudo.io.h5yaml.ScaleDolfinObjectTag(scale=1.0, **kwargs)[source]

Bases: ScaleMixin, DolfinObjectTag

class simudo.io.h5yaml.ScaleMixin(scale=1.0, **kwargs)[source]

Bases: object

class simudo.io.h5yaml.SolutionIOTest(methodName='runTest')[source]

Bases: TestCase

helper_test_roundtrip(dedup)[source]
test_roundtrip()[source]
test_roundtrip_with_dedup()[source]
class simudo.io.h5yaml.XDumper(*args, **kwargs)[source]

Bases: Dumper

ignore_aliases(data)[source]
yaml_multi_representers = {<class 'dolfin.cpp.mesh.Mesh'>: <bound method DolfinObjectTag.to_yaml of <class 'simudo.io.h5yaml.DolfinMeshTag'>>, <class 'dolfin.cpp.mesh.MeshFunctionBool'>: <bound method DolfinObjectTag.to_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionBoolTag'>>, <class 'dolfin.cpp.mesh.MeshFunctionDouble'>: <bound method DolfinObjectTag.to_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionDoubleTag'>>, <class 'dolfin.cpp.mesh.MeshFunctionInt'>: <bound method DolfinObjectTag.to_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionIntTag'>>, <class 'dolfin.cpp.mesh.MeshFunctionSizet'>: <bound method DolfinObjectTag.to_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionSizetTag'>>, <class 'dolfin.function.function.Function'>: <bound method DolfinObjectTag.to_yaml of <class 'simudo.io.h5yaml.DolfinFunctionTag'>>, <class 'frozenset'>: <bound method FrozenSetTag.to_yaml of <class 'simudo.io.h5yaml.FrozenSetTag'>>, <class 'object'>: <function Representer.represent_object>, <class 'pint.quantity.Quantity'>: <bound method PintQTag.to_yaml of <class 'simudo.io.h5yaml.PintQTag'>>, <class 'type'>: <function Representer.represent_name>}
class simudo.io.h5yaml.XLoader(*args, **kwargs)[source]

Bases: Loader

yaml_constructors = {'!dolfin/function': <bound method DolfinObjectTag.from_yaml of <class 'simudo.io.h5yaml.DolfinFunctionTag'>>, '!dolfin/mesh': <bound method DolfinObjectTag.from_yaml of <class 'simudo.io.h5yaml.DolfinMeshTag'>>, '!dolfin/meshfunction/bool': <bound method DolfinObjectTag.from_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionBoolTag'>>, '!dolfin/meshfunction/double': <bound method DolfinObjectTag.from_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionDoubleTag'>>, '!dolfin/meshfunction/int': <bound method DolfinObjectTag.from_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionIntTag'>>, '!dolfin/meshfunction/size_t': <bound method DolfinObjectTag.from_yaml of <class 'simudo.io.h5yaml.DolfinMeshFunctionSizetTag'>>, '!frozenset': <bound method FrozenSetTag.from_yaml of <class 'simudo.io.h5yaml.FrozenSetTag'>>, '!pintq': <bound method PintQTag.from_yaml of <class 'simudo.io.h5yaml.PintQTag'>>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:python/bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:python/bytes': <function FullConstructor.construct_python_bytes>, 'tag:yaml.org,2002:python/complex': <function FullConstructor.construct_python_complex>, 'tag:yaml.org,2002:python/dict': <function SafeConstructor.construct_yaml_map>, 'tag:yaml.org,2002:python/float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:python/int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:python/list': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:python/long': <function FullConstructor.construct_python_long>, 'tag:yaml.org,2002:python/none': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:python/str': <function FullConstructor.construct_python_str>, 'tag:yaml.org,2002:python/tuple': <function FullConstructor.construct_python_tuple>, 'tag:yaml.org,2002:python/unicode': <function FullConstructor.construct_python_unicode>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, None: <function SafeConstructor.construct_undefined>}
simudo.io.h5yaml.delete_attached(filename)[source]
simudo.io.h5yaml.dump(data, stream=None, Dumper=None, x_attr_dict=None, pint_unit_registry=None, **kwargs)[source]
simudo.io.h5yaml.kl

alias of PintQTag

simudo.io.h5yaml.load(stream, Loader=None, x_attr_dict=None, pint_unit_registry=None, **kwargs)[source]
simudo.io.h5yaml.xattr(loader_or_dumper)[source]

simudo.io.output_writer module

class simudo.io.output_writer.MetaCSVWriter(filename, meta)[source]

Bases: SetattrInitMixin

add_row(meta)[source]
class simudo.io.output_writer.MetaExtractorBandInfo(**kwargs)[source]

Bases: SetattrInitMixin

call()[source]
prefix = 'band_info:'
class simudo.io.output_writer.MetaExtractorIntegrals(**kwargs)[source]

Bases: SetattrInitMixin

Variables:
  • prefix (str) – String to add to quantites.

  • facets (dict) – Facet regions where to extract quantities.

  • cells (dict) – Cell regions where to extract quantities.

  • solution – Solution object.

  • parameter_value – Parameter value.

  • meta – Metadata dictionary to write to.

add_quantity(name, location_name, value, units)[source]
add_surface_flux(k, expr, **kwargs)[source]
add_surface_total(k, expr_ds, expr_dS, internal=True, external=True, average=False, units=None)[source]
add_volume_total(k, expr, average=False, units=None)[source]
call()[source]
pdd
prefix = ''
class simudo.io.output_writer.OutputWriter(**kwargs)[source]

Bases: SetattrInitMixin

Write output data extracted from a solution object.

The output can be any of a plot on a mesh, on a 1D linecut, or in a csv file containing data from multiple solutions during a parameter sweep.

parameter_name: label for the parameter being swept

filename_prefix: a prefix to any filenames that will be saved.

plot_mesh – Save data on the original mesh. (default: False)

plot_1d – Extract data along a 1D line cut and save to a csv file. (default: False)

plot_iv – Save a csv file with terminal voltages, currents and other extracted data. (default: True)

stepper – (optional) give access to the stepper. Allows plotting quantities related to solution such as error metric (du).

plot_du – Plot du (only if stepper is also given, default: False)

clip_finite_extent = True
format_parameter(solution, parameter_value)[source]
get_iv_prefix(solution, parameter_value)[source]
get_meta_csv_file(filename, meta)[source]
get_plot_prefix(solution, parameter_value)[source]
hj_condition_filename = None
hj_interface_condition = False
hj_position = None
hj_test_eps = 1e-10
hj_test_y = 0.5
line_cut_resolution = 5001
meta_extractors
parameter_name = 'parameter'
plot_1d = False
plot_du = False
plot_iv = True
plot_mesh = False
plot_mesh_full = False
stepper = None
vs_filename = 'vs_quantities'
vs_output_x = None
vs_output_y = None
vs_write_quantities = False
write_output(solution, parameter_value)[source]
exception simudo.io.output_writer.ZeroAreaWarning[source]

Bases: RuntimeWarning

simudo.io.output_writer.solution_plot(plotter, s, timestep, solver=None, stepper=None, plot_du=True, clip_finite_extent=True)[source]
simudo.io.output_writer.vs_plot(plotter, s, timestep, stepper)[source]
simudo.io.output_writer.write_heterojunction_boundary_condition(solution, hj_position, filename_prefix, parameter_name, parameter, y_position, eps)[source]

Write boundary condition for heterojunction interfaces, defined by hj_position

simudo.io.xdmf module

class simudo.io.xdmf.PlotAddMixin[source]

Bases: object

add(name, units, expr, space=None, subdomain=None)[source]
class simudo.io.xdmf.XdmfPlot(filename, function_subspace_registry=None, checkpoint=False)[source]

Bases: PlotAddMixin

close()[source]
new(timestamp)[source]
timestamp = 0.0
simudo.io.xdmf.magnitude(x)[source]

Module contents