### Import static solution to a time-dependent problem

285

views

0

Hello everybody.

I am trying to solve a reaction-difussion equation which has as an input the result of another reaction-difussion equation.

I was trying to save the solution by using TimeSeries, but I guess this does not make much sense, since the problem is not time-dependent. Also I tried creating a HDF5 file to write and then read the solution, but it is not working either. Can anybody help me? I have very little knowledge about FEniCS.

Here are the two things I have tried.

--- Option #1: TimeSeries ---

To write the solution of the static problem:

timeseries_u = TimeSeries ('solution')

timeseries_u.store(u.vector(),0)

To read the solution in the time-dependent problem:

timeseries_w = TimeSeries('solution')

timeseries_w.retrieve(w.vector(),0)

--- Option #2: HDF5 file ---

To write the solution of the static problem:

outputfile = HDF5(mesh.mpi_comm(), "u.h5", "w")

outputfile.write(u, "solution")

outputfile.close()

To read the solution in the time-dependent problem:

inputfile = HDF5(mesh.mpi_comm(), "u.h5", "r")

inputfile.read(w, "solution")

inputfile.close()

Thanks in advance!

Best,

Isabela

I am trying to solve a reaction-difussion equation which has as an input the result of another reaction-difussion equation.

I was trying to save the solution by using TimeSeries, but I guess this does not make much sense, since the problem is not time-dependent. Also I tried creating a HDF5 file to write and then read the solution, but it is not working either. Can anybody help me? I have very little knowledge about FEniCS.

Here are the two things I have tried.

--- Option #1: TimeSeries ---

To write the solution of the static problem:

timeseries_u = TimeSeries ('solution')

timeseries_u.store(u.vector(),0)

To read the solution in the time-dependent problem:

timeseries_w = TimeSeries('solution')

timeseries_w.retrieve(w.vector(),0)

--- Option #2: HDF5 file ---

To write the solution of the static problem:

outputfile = HDF5(mesh.mpi_comm(), "u.h5", "w")

outputfile.write(u, "solution")

outputfile.close()

To read the solution in the time-dependent problem:

inputfile = HDF5(mesh.mpi_comm(), "u.h5", "r")

inputfile.read(w, "solution")

inputfile.close()

Thanks in advance!

Best,

Isabela

Community: FEniCS Project

### 1 Answer

0

I realised the problem is not in writing or reading the file. Thank you for answering anyway!!!

Please login to add an answer/comment or follow this question.

Calling FFC just-in-time (JIT) compiler, this may take some time.

*** Warning: Krylov solver did not converge in 0 iterations (PETSc reason DIVERGED_NANORINF, residual norm ||r|| = 0.000000e+00).

It seems everything is zero.

Using the HDF5 I have no problem to write it but when I try to use it it says the same as before:

*** Warning: Krylov solver did not converge in 0 iterations (PETSc reason DIVERGED_NANORINF, residual norm ||r|| = 0.000000e+00).

Sorry, what is a MWE?

Best,

Isabela