simultaneous time dependant problems in fenics

Asked by Souvik Roy

Dear Sir,
               I am solving a time dependant optimization problem. It consists of solving 2 parabolic equations:- one forward in time in variable y and another backward in time in variable p. The p equation uses y and so after solving equation y by discretizing y_t by Crank Nicholson scheme and then using spatial finite elements, I need to store the data of y at all instants of time in an array structure so that I can use data backwards for the p equation as it is backward in time. How do I store in an array and then use it for the backward time equation? Thanking you.
                                                                                      Souvik Roy.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Anders Logg
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Best Anders Logg (logg) said :
#1

On Tue, Apr 24, 2012 at 08:25:42PM -0000, Souvik Roy wrote:
> New question #194624 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/194624
>
> Dear Sir, I am solving a time dependant optimization problem. It
> consists of solving 2 parabolic equations:- one
> forward in time in variable y and another backward in
> time in variable p. The p equation uses y and so
> after solving equation y by discretizing y_t by Crank
> Nicholson scheme and then using spatial finite
> elements, I need to store the data of y at all
> instants of time in an array structure so that I can
> use data backwards for the p equation as it is
> backward in time. How do I store in an array and then
> use it for the backward time equation? Thanking you.
> Souvik Roy.

Use the TimeSeries class.

This module might also be useful:

https://launchpad.net/dolfin-adjoint

--
Anders

Revision history for this message
Patrick Farrell (pefarrell) said :
#2

Hi Souvik,

We've just released the dolfin-adjoint project, whose aim is to automate the derivation of the adjoint equation from the forward model. There are a few advantages to doing it that way: doflin-adjoint manages the storage of all of the dependencies of the adjoint equations on the forward solutions, and can automatically use checkpointing schemes to balance your storage and computation costs.

The documentation is currently sparse (I plan to write a tutorial this week, actually), but if you're interested, send me an email with the Python code for your forward model.

Cheerio,

Patrick

Revision history for this message
Souvik Roy (1roysouvik) said :
#3

Thanks Anders Logg, that solved my question.

Revision history for this message
Souvik Roy (1roysouvik) said :
#4

Hi Patrick,
               Thanks for your reply. I am really interested in your project. Looks good. I would be sending you the python code for my forward model . Thanks
                                Souvik.

Revision history for this message
Souvik Roy (1roysouvik) said :
#5

Hi Patrick,
                 I had send you a message before. Can you send me your email id so that I can send you the Python code for the forward model?

Revision history for this message
Souvik Roy (1roysouvik) said :
#6

Thanks Anders Logg, that solved my question.

Revision history for this message
Patrick Farrell (pefarrell) said :
#7

Hey Souvik,

I did reply, to 1roysouvik at gmail dot com, at 1258 UTC yesterday. My email address is patrick dot farrell 06 at imperial dot ac dot uk. (You can also see it at http://www3.imperial.ac.uk/people/patrick.farrell06). Here's what I wrote:

Feel free to send a small script on to me. If your script is very big (more than
a few megabytes), upload it to http://fileexchange.imperial.ac.uk .

By the way, I can't remember if I mentioned it before --
dolfin-adjoint only works for the Python interface to dolfin,
not the C++ interface. Is your script written in Python?

Cheerio,

Patrick