def flux_matrix(self, mesh, element, nodeiterator, flux, point, time, fluxdata): twoD = config.dimension() == 2 sf = nodeiterator.shapefunction(point) dsf0 = nodeiterator.dshapefunction(0, point) dsf1 = nodeiterator.dshapefunction(1, point) if not twoD: dsf2 = nodeiterator.dshapefunction(2, point) cond = symmmatrix.SymmMatrix3(1., 1., 1., 0., 0., 0.) fluxiterator = problem.Heat_Flux.iterator(planarity.ALL_INDICES) while not fluxiterator.end(): val = -(cond.get(fluxiterator.integer(), 0) * dsf0 + cond.get(fluxiterator.integer(), 1) * dsf1) if not twoD: val -= cond.get(fluxiterator.integer(), 2) *dsf2 fluxdata.add_stiffness_matrix_element( fluxiterator, problem.Temperature, problem.Temperature.getIndex(""), # scalar field dummy 'index' nodeiterator, val) if (twoD and not problem.Temperature.in_plane(mesh)): fluxdata.add_stiffness_matrix_element( fluxiterator, problem.Temperature.out_of_plane(), # also a scalar problem.Temperature.getIndex(""), # also a dummy nodeiterator, cond.get(fluxiterator.integer(), 2) * sf) fluxiterator.next()
def flux_offset(self, mesh, element, flux, masterpos, time, smallsystem): # Retrieve the plastic strain field and evaluate it at this # masterposition. ep_val = symmmatrix.SymmMatrix3() ep = field.getField('Plastic') efi = element.funcnode_iterator() while not efi.end(): coef = efi.shapefunction(masterpos) ep_output = ep.output(mesh, efi.funcnode()) ep_val += ep_output.valuePtr() * coef efi += 1 # Now ep_val contains the plastic strain at this gausspoint. # We can do the arithmetic. Note that this assumes the same # gausspoint set from one iteration to the next, which will in # general be a bad assumption. modulus = self.elasticity.cijkl(mesh, element, masterpos) ij = fieldindex.SymTensorIterator() while (not ij.end()): offset = 0.0 kl = ep_val.getIterator() while (not kl.end()): idx = kl.integer() cijkl = modulus[ij.integer(), kl.integer()] if idx < 3: offset += cijkl * ep_val[kl] else: offset += 2.0 * cijkl * ep_val[kl] kl.next() smallsystem.add_offset_element(ij, offset) ij.next()
def output(self, mesh, element, propertyoutput, position): if propertyoutput.name() == "Energy": return outputval.ScalarOutputVal(3.14) * position.mastercoord()[0] if propertyoutput.name() == "Strain": stype = propertyoutput.getRegisteredParamName("type") if stype == "Geometric": return symmmatrix.SymmMatrix3(0, 1, 2, 3, 4, 5)
def new_value(self, gtk, event): result = self.value try: result = symmmatrix.SymmMatrix3( *[self.floats[i].get_value() for i in \ symmmatrix.voigtIndices] ) finally: self.set_values(result)
def flux_offset(self, mesh, element, flux, point, time, fluxdata): cijkl = self.elasticity.cijkl(mesh, element, point) strain0 = symmmatrix.SymmMatrix3(0.1, 0.1, 0.1, 0, 0, 0) ij = problem.Stress.iterator(planarity.ALL_INDICES) while not ij.end(): kl = fieldindex.SymTensorIterator() while not kl.end(): strain_kl = strain0.get(kl.row(), kl.col()) # TODO: too ugly if kl.diagonal(): fluxdata.add_offset_vector_element( ij, cijkl[ij.integer(), kl.integer()] * strain_kl) else: fluxdata.add_offset_vector_element( ij, 2.0 * cijkl[ij.integer(), kl.integer()] * strain_kl) kl.next() ij.next()
def zeroVal(self, output): return symmmatrix.SymmMatrix3(0., 0., 0., 0., 0., 0.)