.. math:: D_{ijkl} = \mu (\delta_{ik} \delta_{jl}+\delta_{il} \delta_{jk}) + \lambda \ \delta_{ij} \delta_{kl} \;. """ from its2D_1 import * from sfepy.mechanics.matcoefs import stiffness_tensor_youngpoisson def stress_strain(out, pb, state, extend=False): """ Calculate and output strain and stress for given displacements. """ from sfepy.base.base import Struct ev = pb.evaluate strain = ev('de_cauchy_strain.2.Omega(u)', mode='el_avg') stress = ev('de_cauchy_stress.2.Omega(Asphalt.D, u)', mode='el_avg') out['cauchy_strain'] = Struct(name='output_data', mode='cell', data=strain, dofs=None) out['cauchy_stress'] = Struct(name='output_data', mode='cell', data=stress, dofs=None) return out asphalt = materials['Asphalt'][0] asphalt.update({'D' : stiffness_tensor_youngpoisson(2, young, poisson)}) options.update({'post_process_hook' : 'stress_strain',})
dim = 3 region_lbn = (0, 0, 0) region_rtf = (1, 1, 1) #! Regions #! ------- #! Regions, edges, ... regions = { 'Y' : ('all', {}), 'Ym' : ('elements of group 1', {}), 'Yc' : ('elements of group 2', {}), } regions.update( define_box_regions( dim, region_lbn, region_rtf ) ) #! Materials #! --------- materials = { 'matrix' : ({'D' : stiffness_tensor_youngpoisson( dim, 0.7e9, 0.4 ) },), 'reinf' : ({'D' : stiffness_tensor_youngpoisson( dim, 70.0e9, 0.2 ) },), } #! Fields #! ------ #! Scalar field for corrector basis functions. fields = { 'corrector' : ('real', dim, 'Y', 1), } #! Variables #! --------- #! Unknown and corresponding test variables. Parameter fields #! used for evaluation of homogenized coefficients. variables = { 'u' : ('unknown field', 'corrector', 0), 'v' : ('test field', 'corrector', 'u'),
plt.ylabel('Cauchy strain') plt.xlabel('probe %s' % label, fontsize=8) plt.legend(loc='best', prop=fm.FontProperties(size=8)) plt.subplot(313) pars, vals = results['cauchy_stress'] for ic in range(vals.shape[1]): plt.plot(pars, vals[:,ic], label=r'$\sigma_{%s}$' % sym_indices[ic], lw=1, ls='-', marker='+', ms=3) plt.ylabel('Cauchy stress') plt.xlabel('probe %s' % label, fontsize=8) plt.legend(loc='best', prop=fm.FontProperties(size=8)) return plt.gcf(), results materials['Asphalt'][0].update({'D' : stiffness_tensor_youngpoisson(2, young, poisson)}) # Update fields and variables to be able to use probes for tensors. fields.update({ 'sym_tensor': ('real', 3, 'Omega', 0), }) variables.update({ 's' : ('parameter field', 'sym_tensor', None), }) options.update({ 'output_format' : 'h5', # VTK reader cannot read cell data yet for probing 'post_process_hook' : 'stress_strain', 'gen_probes' : 'gen_lines', 'probe_hook' : 'probe_hook',