def write_scalarfunction(self): # print("Writing scalar field into " + str(outputfnam)) gmsh.gmshOutput_nodal(self.outfile, "scalar field", self.V, it=0, t=0.0) # write nodal field 'V'
def write_scalarfields(self): # --- write displacement field # write mesh to the file (only do this once!) outputfilename = self.filename.replace(".msh", "") + '-val.msh' self.outfile = open(outputfilename, 'w') # open new meshfile gmsh.gmshOutput_mesh(self.outfile, self.mesh) gmsh.gmshOutput_nodal(self.outfile, "U: displacement field", self.U, 0, 0.0)
def write_fields(self): outputfnam = self.filename.replace(".msh", "") + '-val.msh' outfile = open(outputfnam, 'w') gmsh.gmshOutput_mesh(outfile, self.mesh) gmsh.gmshOutput_nodal(outfile, "displacement", self.U, 0, 0.0) gmsh.gmshOutput_nodal(outfile, "residual", self.R, 0, 0.0) gmsh.gmshOutput_element(outfile, "deformation gradient", self.F, 0, 0.0) gmsh.gmshOutput_element(outfile, "engineering stress", self.P, 0, 0.0) outfile.close()
def write_fields(self): # #--- write fields # # filename of the new meshfile outputfnam = self.filename[:-4] + '-val.msh' outfile = open(outputfnam, 'w') gmsh.gmshOutput_mesh(outfile, self.mesh) # creates a view in gmsh, vector field gmsh.gmshOutput_nodal(outfile, "displacement U", self.U, 0, 0.0) # creates a view in gmsh, tensor field gmsh.gmshOutput_element( outfile, "deformation gradient F", self.F, 0, 0.0) # creates a view in gmsh, tensor field gmsh.gmshOutput_element( outfile, "engineering stress P", self.P, 0, 0.0) outfile.close()
def write_vectorfield(self): # print("Writing vector field in " + str(outputfnam)) gmsh.gmshOutput_nodal(self.outfile, "VectorField", self.U, it=0, t=0) self.outfile.close()
# E = [] P = [] hencky = [] euler = [] sigma = [] for n in range(model.nElements()): E.append(model.getStrainGreenLagrange(n).flatten()) P.append(model.getStressPK1(n).flatten()) hencky.append(model.getStrainHencky(n).flatten()) euler.append(model.getStrainEulerAlmansi(n).flatten()) sigma.append(model.getStressCauchy(n).flatten()) # #--- gmsh output for current time step # gmsh.gmshOutput_nodal(gmsh_out, "Residual", R.reshape(nNodes, dim), iStep, time) gmsh.gmshOutput_nodal(gmsh_out, "Displacements", U.reshape((nNodes, dim)), iStep, time) gmsh.gmshOutput_element(gmsh_out, "Green-Lagrange strain", E, iStep, time) gmsh.gmshOutput_element(gmsh_out, "Piola Kirchhoff I stress", P, iStep, time) gmsh.gmshOutput_element(gmsh_out, "Euler-Almansi strain", euler, iStep, time) gmsh.gmshOutput_element(gmsh_out, "Hencky strain", hencky, iStep, time) gmsh.gmshOutput_element(gmsh_out, "Cauchy stress", sigma, iStep, time) # break # print("U[nDofs]") scale = 100