There is something wrong when I tried to open the dispgelGTF11NCSN.pvd with paraview.
But it failed ,and crashed .
# Create output files
file_p = XDMFFile(comm, "crackgelGTF11NCSN.pvd")
file_u = XDMFFile(comm, "dispgelGTF11NCSN.pvd")
for file in [file_u, file_p]:
file.parameters['rewrite_function_mesh'] = False
file.parameters['flush_output'] = True
# Solve variational problem
cnt = 0;
for x in np.linspace(0.0,dispMax,nSteps):
# Update displacement BC
dispr1.uxr = x
# Print simulation information
if mpiRank == 0: # only prints on processor 0 (parallel runs)
print "\nStep: ", cnt, "/", nSteps - 1
print "Strain: ", 100.0*x/100., "%"
# Solve loop for crack convergence
diff = 1.0; crack_iter = 0
while diff > 1.e-3 and crack_iter <= 199: # check for stationary crack
# Update crack convergence loop counter
crack_iter = crack_iter + 1
# Update the displacements
#(itern, converged) = solver_u.solve(umin, umax)
solver_u.solve()
# Update the crack
solver_alpha_p.solve(problem_alpha, phi.vector(), lbp.vector(), ubp.vector())
# Difference between current and previous PFF solution
diff = norm(phi.vector() - phi0.vector(),'linf')
if mpiRank == 0:
print 'Crack Iteration: ', crack_iter
print 'Crack convergence: ', diff
# Set new crack values to old values
phi0.assign(phi)
if crack_iter == 200:
print 'crack iteration fails'
exit()
# Updating the upper bound to account for the irreversibility
ubp.vector()[:] = phi.vector()
u0.assign(u)
# Update simulation counter
cnt = cnt + 1
bForce = assemble(PK[1,1]*ds(2))
if mpiRank == 0:
print 'Force=',bForce
# Save solution
if cnt % save_cnt == 0:
file_u.write_checkpoint(u0,x)
file_p.write_checkpoint(phi,x)
sa1="%.9f"%(dispr1.uxr) + ', ' + "%.9f"%(bForce)
my_file.write(sa1)
my_file.write('\n')
I’m new to Fenics and Paraview. Are there any errors in the process of generating files?
Or whether there are related tutorials about the question?