1. Fenics/Dolfin version and Installation
I am running the code in google colab environment using DOLFIN version: 2019.2.0.dev0. I install Fenics via Packages — FEM on Colab.
2. I encountered the error in this section of the code:
# SOLUTION MECHANICAL VENTILATION ##########################
#for i, mult in enumerate(steps):
for i in np.arange(len(times)):
# messages
if dolfin.MPI.rank(dolfin.MPI.comm_world) == 0:
print('Solving step '+str(i)+' ...')
t = times[i]
dtt = dts[i]
presion = ps[i]
dt.beta = dtt
p_value.presiones=presion
print('PRESSURE',presion,'TIME',t)
# run fenics solver
w0.assign(w)
it, conv = solver.solve(NLproblem, w.vector())
# Extract solution components
u, p = w.split()
u.rename("u", "displacement")
p.rename("p", "pressure")
if dolfin.MPI.rank(dolfin.MPI.comm_world) == 0:
file_info.write('Step '+str(i)+ ' has converged in '+str(it)+' iterations \n')
file_info.flush()
# get volume, volume and flux
Vi = dolfin.assemble(J*dx)
Jacob.append(Vi/1000000)
deltavol = dolfin.assemble(((J-J0)/dt)*dx)
fluxes.append(deltavol*10**-6)
presionestodas.append(presion)
3. Here is the error Message:
RuntimeError Traceback (most recent call last)
in <cell line: 8>()
222 # run fenics solver
223 w0.assign(w)
→ 224 it, conv = solver.solve(NLproblem, w.vector())
225 # Extract solution components
226 u, p = w.split()
/content/modelfunctions.py in solve(self, myproblem, x)
347 # iterations
348 if not self.dx.empty(): self.dx.zero()
→ 349 self.krylov_iterations += self.solver.solve(self.dx, self.b);
350
351 # Update solution