Esempio n. 1
0
 def write_mesh(self):
     """
     """
     outputfnam = self.filename.replace(".msh", "") + '-val.msh'
     self.outfile = open(outputfnam, 'w')
     # print("Writing mesh into " + str(outputfnam))
     gmsh.gmshOutput_mesh(self.outfile, self.mesh)
Esempio n. 2
0
 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)
Esempio n. 3
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()
Esempio n. 4
0
 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()
Esempio n. 5
0
#################################
#          GSMH OUTPUT          #
#################################

mesh_name = basemesh.split('-')[0]
# 'tri_coarse' = element type + mesh refinement
mesh_type = basemesh.split('-')[1][:-4]
# subdirectory for output files
new_folder_name = mesh_type

dirout = os.path.join(msh_folder + matmodel, new_folder_name)
mkdir_p(dirout)  # create directory for output files if not already existing
outputfile = mesh_name + '-results_Nsteps-' + str(int(nSteps)) + ".msh"
outputfile = os.path.join(dirout, outputfile)
gmsh_out = open(outputfile, 'w')
gmsh.gmshOutput_mesh(gmsh_out, mesh)

plot.plot_mesh(mesh, label="Before", color="b")

#################################
#         PREPROSSESING         #
#################################

#--- boundary conditions
#
# On the left side of the quarter-cylinder (X=0), the displacements in the x-direction are fixed (u_x =0)
# At the bottom of the quarter-cylinder (Y=0), the displacements in the y-direction are fixed (u_y=0)
# We apply a radial displacement "disp" on the interior of the cylinder, in the r-direction (u_r=rdisp)

nNodes = mesh.nNodes()
nDofs = dim * nNodes