def main(): import os import numpy as nm import matplotlib.pyplot as plt from sfepy.discrete.fem import MeshIO import sfepy.linalg as la from sfepy.mechanics.contact_bodies import ContactSphere, plot_points conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bb = io.read_bounding_box() outline = [vv for vv in la.combine(list(zip(*bb)))] ax = plot_points(None, nm.array(outline), 'r*') csc = materials['cs'][0] cs = ContactSphere(csc['.c'], csc['.r']) pps = (bb[1] - bb[0]) * nm.random.rand(5000, 3) + bb[0] mask = cs.mask_points(pps, 0.0) ax = plot_points(ax, cs.centre[None, :], 'b*', ms=30) ax = plot_points(ax, pps[mask], 'kv') ax = plot_points(ax, pps[~mask], 'r.') plt.show()
def main(): import os import numpy as nm import matplotlib.pyplot as plt from sfepy.discrete.fem import MeshIO import sfepy.linalg as la from sfepy.mechanics.contact_bodies import (ContactPlane, plot_polygon, plot_points) conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bb = io.read_bounding_box() outline = [vv for vv in la.combine(zip(*bb))] ax = plot_points(None, nm.array(outline), 'r*') for name in ['cp%d' % ii for ii in range(4)]: cpc = materials[name][0] cp = ContactPlane(cpc['.a'], cpc['.n'], cpc['.bs']) v1, v2 = la.get_perpendiculars(cp.normal) ax = plot_polygon(ax, cp.bounds) ax = plot_polygon( ax, nm.r_[cp.anchor[None, :], cp.anchor[None, :] + cp.normal[None, :]]) ax = plot_polygon(ax, nm.r_[cp.anchor[None, :], cp.anchor[None, :] + v1]) ax = plot_polygon(ax, nm.r_[cp.anchor[None, :], cp.anchor[None, :] + v2]) plt.show()
def main(): import os import numpy as nm import matplotlib.pyplot as plt from sfepy.discrete.fem import MeshIO import sfepy.linalg as la from sfepy.mechanics.contact_bodies import ContactSphere, plot_points conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bb = io.read_bounding_box() outline = [vv for vv in la.combine(zip(*bb))] ax = plot_points(None, nm.array(outline), "r*") csc = materials["cs"][0] cs = ContactSphere(csc[".c"], csc[".r"]) pps = (bb[1] - bb[0]) * nm.random.rand(5000, 3) + bb[0] mask = cs.mask_points(pps, 0.0) ax = plot_points(ax, cs.centre[None, :], "b*", ms=30) ax = plot_points(ax, pps[mask], "kv") ax = plot_points(ax, pps[~mask], "r.") plt.show()
def main(): import os import numpy as nm import matplotlib.pyplot as plt from sfepy.discrete.fem import MeshIO import sfepy.linalg as la from sfepy.mechanics.contact_bodies import (ContactPlane, plot_polygon, plot_points) conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bb = io.read_bounding_box() outline = [vv for vv in la.combine(zip(*bb))] ax = plot_points(None, nm.array(outline), 'r*') for name in ['cp%d' % ii for ii in range(4)]: cpc = materials[name][0] cp = ContactPlane(cpc['.a'], cpc['.n'], cpc['.bs']) v1, v2 = la.get_perpendiculars(cp.normal) ax = plot_polygon(ax, cp.bounds) ax = plot_polygon(ax, nm.r_[cp.anchor[None, :], cp.anchor[None, :] + cp.normal[None, :]]) ax = plot_polygon(ax, nm.r_[cp.anchor[None, :], cp.anchor[None, :] + v1]) ax = plot_polygon(ax, nm.r_[cp.anchor[None, :], cp.anchor[None, :] + v2]) plt.show()
def __init__(self, filename, approx, region_selects, mat_pars, options, evp_options, eigenmomenta_options, band_gaps_options, coefs_save_name='coefs', corrs_save_names=None, incwd=None, output_dir=None, **kwargs): Struct.__init__(self, approx=approx, region_selects=region_selects, mat_pars=mat_pars, options=options, evp_options=evp_options, eigenmomenta_options=eigenmomenta_options, band_gaps_options=band_gaps_options, **kwargs) self.incwd = get_default(incwd, lambda x: x) self.conf = Struct() self.conf.filename_mesh = self.incwd(filename) output_dir = get_default(output_dir, self.incwd('output')) default = {'evp' : 'evp', 'corrs_rs' : 'corrs_rs'} self.corrs_save_names = get_default(corrs_save_names, default) io = MeshIO.any_from_filename(self.conf.filename_mesh) self.bbox, self.dim = io.read_bounding_box(ret_dim=True) rpc_axes = nm.eye(self.dim, dtype=nm.float64) \ * (self.bbox[1] - self.bbox[0]) self.conf.options = options self.conf.options.update({ 'output_dir' : output_dir, 'volume' : { 'value' : get_lattice_volume(rpc_axes), }, 'coefs' : 'coefs', 'requirements' : 'requirements', 'coefs_filename' : coefs_save_name, }) self.conf.mat_pars = mat_pars self.conf.solvers = self.define_solvers() self.conf.regions = self.define_regions() self.conf.materials = self.define_materials() self.conf.fields = self.define_fields() self.conf.variables = self.define_variables() (self.conf.ebcs, self.conf.epbcs, self.conf.lcbcs, self.all_periodic) = self.define_bcs() self.conf.functions = self.define_functions() self.conf.integrals = self.define_integrals() self.equations, self.expr_coefs = self.define_equations() self.conf.coefs = self.define_coefs() self.conf.requirements = self.define_requirements()
def test_read_dimension(self): from sfepy.discrete.fem import MeshIO meshes = {data_dir + '/meshes/various_formats/small2d.mesh' : 2, data_dir + '/meshes/various_formats/small2d.vtk' : 2, data_dir + '/meshes/various_formats/small3d.mesh' : 3} ok = True conf_dir = op.dirname(__file__) for filename, adim in six.iteritems(meshes): self.report('mesh: %s, dimension %d' % (filename, adim)) io = MeshIO.any_from_filename(filename, prefix_dir=conf_dir) dim = io.read_dimension() if dim != adim: self.report('read dimension %d -> failed' % dim) ok = False else: self.report('read dimension %d -> ok' % dim) return ok
def test_read_dimension(self): from sfepy.discrete.fem import MeshIO meshes = {data_dir + '/meshes/various_formats/small2d.mesh' : 2, data_dir + '/meshes/various_formats/small2d.vtk' : 2, data_dir + '/meshes/various_formats/small3d.mesh' : 3} ok = True conf_dir = op.dirname(__file__) for filename, adim in meshes.iteritems(): self.report('mesh: %s, dimension %d' % (filename, adim)) io = MeshIO.any_from_filename(filename, prefix_dir=conf_dir) dim = io.read_dimension() if dim != adim: self.report('read dimension %d -> failed' % dim) ok = False else: self.report('read dimension %d -> ok' % dim) return ok
def define(filename_mesh, pars, approx_order, refinement_level, solver_conf, plane='strain', post_process=False, mesh_eps=1e-8): io = MeshIO.any_from_filename(filename_mesh) bbox = io.read_bounding_box() dim = bbox.shape[1] options = { 'absolute_mesh_path' : True, 'refinement_level' : refinement_level, 'allow_empty_regions' : True, 'post_process_hook' : 'compute_von_mises' if post_process else None, } fields = { 'displacement': ('complex', dim, 'Omega', approx_order), } young1, poisson1, density1, young2, poisson2, density2 = pars materials = { 'm' : ({ 'D' : {'Y1' : stiffness(dim, young=young1, poisson=poisson1, plane=plane), 'Y2' : stiffness(dim, young=young2, poisson=poisson2, plane=plane)}, 'density' : {'Y1' : density1, 'Y2' : density2}, },), 'wave' : 'get_wdir', } variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), } regions = { 'Omega' : 'all', 'Y1': 'cells of group 1', 'Y2': 'cells of group 2', } regions.update(define_box_regions(dim, bbox[0], bbox[1], mesh_eps)) ebcs = { } if dim == 3: epbcs = { 'periodic_x' : (['Left', 'Right'], {'u.all' : 'u.all'}, 'match_x_plane'), 'periodic_y' : (['Near', 'Far'], {'u.all' : 'u.all'}, 'match_y_plane'), 'periodic_z' : (['Top', 'Bottom'], {'u.all' : 'u.all'}, 'match_z_plane'), } else: epbcs = { 'periodic_x' : (['Left', 'Right'], {'u.all' : 'u.all'}, 'match_y_line'), 'periodic_y' : (['Bottom', 'Top'], {'u.all' : 'u.all'}, 'match_x_line'), } per.set_accuracy(mesh_eps) functions = { 'match_x_plane' : (per.match_x_plane,), 'match_y_plane' : (per.match_y_plane,), 'match_z_plane' : (per.match_z_plane,), 'match_x_line' : (per.match_x_line,), 'match_y_line' : (per.match_y_line,), 'get_wdir' : (get_wdir,), } integrals = { 'i' : 2 * approx_order, } equations = { 'K' : 'dw_lin_elastic.i.Omega(m.D, v, u)', 'S' : 'dw_elastic_wave.i.Omega(m.D, wave.vec, v, u)', 'R' : """1j * dw_elastic_wave_cauchy.i.Omega(m.D, wave.vec, u, v) - 1j * dw_elastic_wave_cauchy.i.Omega(m.D, wave.vec, v, u)""", 'M' : 'dw_volume_dot.i.Omega(m.density, v, u)', } solver_0 = solver_conf.copy() solver_0['name'] = 'eig' return locals()
def generate_probes(filename_input, filename_results, options, conf=None, problem=None, probes=None, labels=None, probe_hooks=None): """ Generate probe figures and data files. """ if conf is None: required, other = get_standard_keywords() conf = ProblemConf.from_file(filename_input, required, other) opts = conf.options if options.auto_dir: output_dir = opts.get_('output_dir', '.') filename_results = os.path.join(output_dir, filename_results) output('results in: %s' % filename_results) io = MeshIO.any_from_filename(filename_results) step = options.step if options.step >= 0 else io.read_last_step() all_data = io.read_data(step) output('loaded:', list(all_data.keys())) output('from step:', step) if options.only_names is None: data = all_data else: data = {} for key, val in six.iteritems(all_data): if key in options.only_names: data[key] = val if problem is None: problem = Problem.from_conf(conf, init_equations=False, init_solvers=False) if probes is None: gen_probes = conf.get_function(conf.options.gen_probes) probes, labels = gen_probes(problem) if probe_hooks is None: probe_hooks = {None: conf.get_function(conf.options.probe_hook)} if options.output_filename_trunk is None: options.output_filename_trunk = problem.ofn_trunk filename_template = options.output_filename_trunk \ + ('_%%d.%s' % options.output_format) if options.same_dir: filename_template = os.path.join(os.path.dirname(filename_results), filename_template) output_dir = os.path.dirname(filename_results) for ip, probe in enumerate(probes): output(ip, probe.name) probe.set_options(close_limit=options.close_limit) for key, probe_hook in six.iteritems(probe_hooks): out = probe_hook(data, probe, labels[ip], problem) if out is None: continue if isinstance(out, tuple): fig, results = out else: fig = out if key is not None: filename = filename_template % (key, ip) else: filename = filename_template % ip if fig is not None: if isinstance(fig, dict): for fig_name, fig_fig in six.iteritems(fig): fig_filename = edit_filename(filename, suffix='_' + fig_name) fig_fig.savefig(fig_filename) output('figure ->', os.path.normpath(fig_filename)) else: fig.savefig(filename) output('figure ->', os.path.normpath(filename)) if results is not None: txt_filename = edit_filename(filename, new_ext='.txt') write_results(txt_filename, probe, results) output('data ->', os.path.normpath(txt_filename))
import os import numpy as nm from sfepy import data_dir from sfepy.discrete.fem import MeshIO filename_mesh = data_dir + '/meshes/2d/special/circle_in_square.mesh' ## filename_mesh = data_dir + '/meshes/2d/special/circle_in_square_small.mesh' ## filename_mesh = data_dir + '/meshes/3d/special/cube_sphere.mesh' ## filename_mesh = data_dir + '/meshes/2d/special/cube_cylinder.mesh' omega = 1 omega_squared = omega**2 conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bbox, dim = io.read_bounding_box(ret_dim=True) geom = {3: '3_4', 2: '2_3'}[dim] x_left, x_right = bbox[:, 0] regions = { 'Y': 'all', 'Y1': 'cells of group 1', 'Y2': 'cells of group 2', 'Y2_Surface': ('r.Y1 *v r.Y2', 'facet'), 'Left': ('vertices in (x < %f)' % (x_left + 1e-3), 'facet'), 'Right': ('vertices in (x > %f)' % (x_right - 1e-3), 'facet'), }
import os import numpy as nm from sfepy import data_dir from sfepy.discrete.fem import MeshIO filename_mesh = data_dir + '/meshes/2d/special/circle_in_square.mesh' ## filename_mesh = data_dir + '/meshes/2d/special/circle_in_square_small.mesh' ## filename_mesh = data_dir + '/meshes/3d/special/cube_sphere.mesh' ## filename_mesh = data_dir + '/meshes/2d/special/cube_cylinder.mesh' omega = 1 omega_squared = omega**2 conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bbox, dim = io.read_bounding_box( ret_dim = True ) geom = {3 : '3_4', 2 : '2_3'}[dim] x_left, x_right = bbox[:,0] regions = { 'Y' : 'all', 'Y1' : 'cells of group 1', 'Y2' : 'cells of group 2', 'Y2_Surface': ('r.Y1 *v r.Y2', 'facet'), 'Left' : ('vertices in (x < %f)' % (x_left + 1e-3), 'facet'), 'Right' : ('vertices in (x > %f)' % (x_right - 1e-3), 'facet'), }
def define(plot=False): filename_mesh = data_dir + '/meshes/3d/unit_ball.mesh' conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bbox = io.read_bounding_box() dd = bbox[1] - bbox[0] radius = bbox[1, 0] eps = 1e-8 * dd[0] options = { 'nls': 'newton', 'ls': 'ls', 'ts': 'ts', 'save_steps': -1, 'output_dir': '.', 'output_format': 'h5', } if plot: options['post_process_hook_final'] = plot_radius fields = { 'displacement': (nm.float64, 3, 'Omega', 1), 'pressure': (nm.float64, 1, 'Omega', 0), } materials = { 'solid': ( { 'mu': 50, # shear modulus of neoHookean term 'kappa': 0.0, # shear modulus of Mooney-Rivlin term }, ), 'walls': ( { 'mu': 3e5, # shear modulus of neoHookean term 'kappa': 3e4, # shear modulus of Mooney-Rivlin term 'h0': 1e-2, # initial thickness of wall membrane }, ), } variables = { 'u': ('unknown field', 'displacement', 0), 'v': ('test field', 'displacement', 'u'), 'p': ('unknown field', 'pressure', 1), 'q': ('test field', 'pressure', 'p'), 'omega': ('parameter field', 'pressure', { 'setter': 'get_volume' }), } regions = { 'Omega': 'all', 'Ax1': ('vertices by get_ax1', 'vertex'), 'Ax2': ('vertices by get_ax2', 'vertex'), 'Equator': ('vertices by get_equator', 'vertex'), 'Surface': ('vertices of surface', 'facet'), } ebcs = { 'fix1': ('Ax1', { 'u.all': 0.0 }), 'fix2': ('Ax2', { 'u.[0, 1]': 0.0 }), 'fix3': ('Equator', { 'u.1': 0.0 }), } lcbcs = { 'pressure': ('Omega', { 'p.all': None }, None, 'integral_mean_value'), } equations = { 'balance': """dw_tl_he_neohook.2.Omega(solid.mu, v, u) + dw_tl_he_mooney_rivlin.2.Omega(solid.kappa, v, u) + dw_tl_membrane.2.Surface(walls.mu, walls.kappa, walls.h0, v, u) + dw_tl_bulk_pressure.2.Omega(v, u, p) = 0""", 'volume': """dw_tl_volume.2.Omega(q, u) = dw_volume_dot.2.Omega(q, omega)""", } solvers = { 'ls': ('ls.scipy_direct', {}), 'newton': ('nls.newton', { 'i_max': 15, 'eps_a': 1e-4, 'eps_r': 1e-8, 'macheps': 1e-16, 'lin_red': 1e-2, 'ls_red': 0.5, 'ls_red_warp': 0.1, 'ls_on': 100.0, 'ls_min': 1e-5, 'check': 0, 'delta': 1e-6, 'is_plot': False, 'problem': 'nonlinear', }), 'ts': ( 'ts.simple', { 't0': 0.0, 't1': 6.0, 'dt': None, 'n_step': 31, # has precedence over dt! }), } functions = { 'get_ax1': (lambda coors, domain: get_nodes(coors, radius, eps, 'ax1'), ), 'get_ax2': (lambda coors, domain: get_nodes(coors, radius, eps, 'ax2'), ), 'get_equator': (lambda coors, domain: get_nodes(coors, radius, eps, 'equator'), ), 'get_volume': (get_volume, ), } return locals()
def define(filename_mesh, pars, approx_order, refinement_level, solver_conf, plane='strain', post_process=False): io = MeshIO.any_from_filename(filename_mesh) bbox = io.read_bounding_box() dim = bbox.shape[1] size = (bbox[1] - bbox[0]).max() options = { 'absolute_mesh_path' : True, 'refinement_level' : refinement_level, 'allow_empty_regions' : True, 'post_process_hook' : 'compute_von_mises' if post_process else None, } fields = { 'displacement': ('complex', dim, 'Omega', approx_order), } young1, poisson1, density1, young2, poisson2, density2 = pars materials = { 'm' : ({ 'D' : {'Y1' : stiffness(dim, young=young1, poisson=poisson1, plane=plane), 'Y2' : stiffness(dim, young=young2, poisson=poisson2, plane=plane)}, 'density' : {'Y1' : density1, 'Y2' : density2}, },), 'wave' : 'get_wdir', } variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), } regions = { 'Omega' : 'all', 'Y1': 'cells of group 1', 'Y2': 'cells of group 2', } regions.update(define_box_regions(dim, bbox[0], bbox[1], 1e-8)) ebcs = { } if dim == 3: epbcs = { 'periodic_x' : (['Left', 'Right'], {'u.all' : 'u.all'}, 'match_x_plane'), 'periodic_y' : (['Near', 'Far'], {'u.all' : 'u.all'}, 'match_y_plane'), 'periodic_z' : (['Top', 'Bottom'], {'u.all' : 'u.all'}, 'match_z_plane'), } else: epbcs = { 'periodic_x' : (['Left', 'Right'], {'u.all' : 'u.all'}, 'match_y_line'), 'periodic_y' : (['Bottom', 'Top'], {'u.all' : 'u.all'}, 'match_x_line'), } per.set_accuracy(1e-8 * size) functions = { 'match_x_plane' : (per.match_x_plane,), 'match_y_plane' : (per.match_y_plane,), 'match_z_plane' : (per.match_z_plane,), 'match_x_line' : (per.match_x_line,), 'match_y_line' : (per.match_y_line,), 'get_wdir' : (get_wdir,), } integrals = { 'i' : 2 * approx_order, } equations = { 'K' : 'dw_lin_elastic.i.Omega(m.D, v, u)', 'S' : 'dw_elastic_wave.i.Omega(m.D, wave.vec, v, u)', 'R' : """1j * dw_elastic_wave_cauchy.i.Omega(m.D, wave.vec, u, v) - 1j * dw_elastic_wave_cauchy.i.Omega(m.D, wave.vec, v, u)""", 'M' : 'dw_volume_dot.i.Omega(m.density, v, u)', } solver_0 = solver_conf.copy() solver_0['name'] = 'eig' return locals()
def generate_probes(filename_input, filename_results, options, conf=None, problem=None, probes=None, labels=None, probe_hooks=None): """ Generate probe figures and data files. """ if conf is None: required, other = get_standard_keywords() conf = ProblemConf.from_file(filename_input, required, other) opts = conf.options if options.auto_dir: output_dir = opts.get_('output_dir', '.') filename_results = os.path.join(output_dir, filename_results) output('results in: %s' % filename_results) io = MeshIO.any_from_filename(filename_results) step = options.step if options.step >= 0 else io.read_last_step() all_data = io.read_data(step) output('loaded:', all_data.keys()) output('from step:', step) if options.only_names is None: data = all_data else: data = {} for key, val in all_data.iteritems(): if key in options.only_names: data[key] = val if problem is None: problem = Problem.from_conf(conf, init_equations=False, init_solvers=False) if probes is None: gen_probes = conf.get_function(conf.options.gen_probes) probes, labels = gen_probes(problem) if probe_hooks is None: probe_hooks = {None : conf.get_function(conf.options.probe_hook)} if options.output_filename_trunk is None: options.output_filename_trunk = problem.ofn_trunk filename_template = options.output_filename_trunk \ + ('_%%d.%s' % options.output_format) if options.same_dir: filename_template = os.path.join(os.path.dirname(filename_results), filename_template) output_dir = os.path.dirname(filename_results) for ip, probe in enumerate(probes): output(ip, probe.name) probe.set_options(close_limit=options.close_limit) for key, probe_hook in probe_hooks.iteritems(): out = probe_hook(data, probe, labels[ip], problem) if out is None: continue if isinstance(out, tuple): fig, results = out else: fig = out if key is not None: filename = filename_template % (key, ip) else: filename = filename_template % ip if fig is not None: if isinstance(fig, dict): for fig_name, fig_fig in fig.iteritems(): fig_filename = edit_filename(filename, suffix='_' + fig_name) fig_fig.savefig(fig_filename) output('figure ->', os.path.normpath(fig_filename)) else: fig.savefig(filename) output('figure ->', os.path.normpath(filename)) if results is not None: txt_filename = edit_filename(filename, new_ext='.txt') write_results(txt_filename, probe, results) output('data ->', os.path.normpath(txt_filename))
def define(plot=False): filename_mesh = data_dir + '/meshes/3d/unit_ball.mesh' conf_dir = os.path.dirname(__file__) io = MeshIO.any_from_filename(filename_mesh, prefix_dir=conf_dir) bbox = io.read_bounding_box() dd = bbox[1] - bbox[0] radius = bbox[1, 0] eps = 1e-8 * dd[0] options = { 'nls' : 'newton', 'ls' : 'ls', 'ts' : 'ts', 'save_steps' : -1, 'output_dir' : '.', 'output_format' : 'h5', } if plot: options['post_process_hook_final'] = plot_radius fields = { 'displacement': (nm.float64, 3, 'Omega', 1), 'pressure': (nm.float64, 1, 'Omega', 0), } materials = { 'solid' : ({ 'mu' : 50, # shear modulus of neoHookean term 'kappa' : 0.0, # shear modulus of Mooney-Rivlin term },), 'walls' : ({ 'mu' : 3e5, # shear modulus of neoHookean term 'kappa' : 3e4, # shear modulus of Mooney-Rivlin term 'h0' : 1e-2, # initial thickness of wall membrane },), } variables = { 'u' : ('unknown field', 'displacement', 0), 'v' : ('test field', 'displacement', 'u'), 'p' : ('unknown field', 'pressure', 1), 'q' : ('test field', 'pressure', 'p'), 'omega' : ('parameter field', 'pressure', {'setter' : 'get_volume'}), } regions = { 'Omega' : 'all', 'Ax1' : ('vertices by get_ax1', 'vertex'), 'Ax2' : ('vertices by get_ax2', 'vertex'), 'Equator' : ('vertices by get_equator', 'vertex'), 'Surface' : ('vertices of surface', 'facet'), } ebcs = { 'fix1' : ('Ax1', {'u.all' : 0.0}), 'fix2' : ('Ax2', {'u.[0, 1]' : 0.0}), 'fix3' : ('Equator', {'u.1' : 0.0}), } lcbcs = { 'pressure' : ('Omega', {'p.all' : None}, None, 'integral_mean_value'), } equations = { 'balance' : """dw_tl_he_neohook.2.Omega(solid.mu, v, u) + dw_tl_he_mooney_rivlin.2.Omega(solid.kappa, v, u) + dw_tl_membrane.2.Surface(walls.mu, walls.kappa, walls.h0, v, u) + dw_tl_bulk_pressure.2.Omega(v, u, p) = 0""", 'volume' : """dw_tl_volume.2.Omega(q, u) = dw_volume_dot.2.Omega(q, omega)""", } solvers = { 'ls' : ('ls.scipy_direct', {}), 'newton' : ('nls.newton', { 'i_max' : 15, 'eps_a' : 1e-4, 'eps_r' : 1e-8, 'macheps' : 1e-16, 'lin_red' : 1e-2, 'ls_red' : 0.5, 'ls_red_warp': 0.1, 'ls_on' : 100.0, 'ls_min' : 1e-5, 'check' : 0, 'delta' : 1e-6, 'is_plot' : False, 'problem' : 'nonlinear', }), 'ts' : ('ts.simple', { 't0' : 0.0, 't1' : 6.0, 'dt' : None, 'n_step' : 31, # has precedence over dt! }), } functions = { 'get_ax1' : (lambda coors, domain: get_nodes(coors, radius, eps, 'ax1'),), 'get_ax2' : (lambda coors, domain: get_nodes(coors, radius, eps, 'ax2'),), 'get_equator' : (lambda coors, domain: get_nodes(coors, radius, eps, 'equator'),), 'get_volume' : (get_volume,), } return locals()