Developer Guide

This section purports to document the phononic internals.

band_gaps module

band_gaps.clip(data, plot_range)
band_gaps.clip_sqrt(data, plot_range)
band_gaps.incwd(filename)
band_gaps.normalize(data, plot_range)
band_gaps.select_in_plane(vec, shape, normal_direction, eps)

band_gaps_liquid module

band_gaps_liquid.get_pars(lam, mu, dim, full=False)
band_gaps_liquid.incwd(*filename)
band_gaps_liquid.select_y3_circ(x, y, z, diameter)
band_gaps_liquid.vary_eta(problem)
Vary viscosity.

band_gaps_piezo module

band_gaps_piezo.get_inclusion_pars(ts, coor, region, ig, mode='inclusion')
band_gaps_piezo.get_iw_dir(dim)
band_gaps_piezo.get_pars_BaTiOx3()
Material Ba Ti O_3, Tetragonal, type 4mm.
band_gaps_piezo.get_pars_PZT5A()
Material PZT5A.
band_gaps_piezo.piezo_transfrom_3to2(C3=None, D3=None, B3=None, iplane=None)

Transforms all coefficients of the piezoelectric constitutive law from 3D to plane stress problem in 2D: strain/stress ordering/ 11 22 33 12 13 23 –> if no arguments passed, demo example returns 2D restriction of a piezoelectric material obtained by get_pars_BaTiOx3().

Example: C2, D2, B2 = piezo_transfrom_3to2( C3, D3, B3, iplane )

band_gaps_rigid module

band_gaps_rigid.define_elastic_problem(filename_mesh, dim, y3_diameter=None)
band_gaps_rigid.extend_cell_data(data, pb, rname, val=None)
band_gaps_rigid.incwd(filename)
band_gaps_rigid.post_process(out, problem, mtx_phi)
band_gaps_rigid.prepare_shift(problem, y3_diameter=None)
band_gaps_rigid.save_log(filename, bg, log_item)
Saves band gaps, valid flags, eigenfrequencies.
band_gaps_rigid.select_rigid(x, y, z)
band_gaps_rigid.select_y3_circ(x, y, z, diameter)
band_gaps_rigid.shift_y3(problem)
band_gaps_rigid.solve_shift(epb, ebcs, shift)
band_gaps_rigid.vary_teps(problem)
Vary eigenmomentum threshold.
band_gaps_rigid.vary_y3_size(problem)
Vary size of Y3 inclusion.

coef_conf_elastic module

coef_conf_elastic.define_input(filename, region, dim, geom, define_regions=True)
Uses materials, fe of master file, merges regions.
coef_conf_elastic.expand_regions(eqs, expand)

coef_conf_piezo module

coef_conf_piezo.define_input(filename, region, bbox, dim, geom)
Uses materials, fe of master file, merges regions.
coef_conf_piezo.expand_regions(eqs, expand)

gen_mesh module

gen_mesh.gen_concentric(filename, a, el_size_out, el_size_in, r0, r1, n_circ)

macro_piezo module

parametric module

Various parametric hooks.

parametric.save_log(filename, bg, log_item, save_eigs=False, save_angles=False)
Saves band gaps, valid flags, eigenfrequencies, and polarization angles, if present.
parametric.vary_iw_dir_dispersion(problem)

Vary incident wave direction for dispersion computation. The x-y plane is used in 3D.

Assumes –dispersion option!

parametric.vary_iw_dir_phase_velocity(problem)

Vary incident wave direction for phase velocity computation. The x-y plane is used in 3D.

Assumes –phase-velocity option!

phase_velocity module

plot_gaps script

plot_gaps.main()
Log file format:
par_name: par squared: <bool> header header f0 f1 flag_min f_min v_min flag_max f_max v_max kind desc

postproc_evp script

postproc_evp.add_glyphs(obj, position, color=(0, 0, 0))
postproc_evp.add_scalar_cut_plane(obj, position, normal, opacity=0.5)
postproc_evp.add_surf(obj, position, opacity=0.5)
postproc_evp.add_text(obj, position, text, color=(0, 0, 0))
postproc_evp.cycle(bounds)

Cycles through all combinations of bounds, returns a generator.

More specifically, let bounds=[a, b, c, ...], so cycle returns all combinations of lists [0<=i<a, 0<=j<b, 0<=k<c, ...] for all i,j,k,...

Examples: In [9]: list(cycle([3, 2])) Out[9]: [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]

In [14]: list(cycle([3, 4])) [[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3]]

postproc_evp.main()

utils module

utils.clip(data, plot_range)
utils.clip_sqrt(data, plot_range)
utils.get_pars(lam, mu, dim, full=False)
utils.normalize(data, plot_range)
utils.select_in_plane(vec, shape, normal_direction, eps)
utils.to_degrees(data)