Initial condition

Asked by Yapi Donatien Achou

How can I specify initial condition without doing it through the boundary condition?
What I have read so far about initial condition in fenics, is that it is available through the boundary condition as long as t=0.?!
For example: I want to specify the initial condition u_initial = c1, where c1 is constant on the entire mesh. The boundary condition u0=c2 is also a constant. Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

If you by boundary condition mean DirichletBC, you are not only setting the
initial condition for this boundary, but you fix the value for the whole
simulation.

If u_initial is a Function, you can be apply use the slice interface for the
dof vector:

  u_initial.vector()[:] = c1

If u_initial is a constant:

  u_initial = Constant(c1)

Johan

On Wednesday December 14 2011 13:30:58 Yapi Donatien Achou wrote:
> New question #181872 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/181872
>
> How can I specify initial condition without doing it through the boundary
> condition? What I have read so far about initial condition in fenics, is
> that it is available through the boundary condition as long as t=0.?! For
> example: I want to specify the initial condition u_initial = c1, where c1
> is constant on the entire mesh. The boundary condition u0=c2 is also a
> constant. Thanks.

Revision history for this message
Yapi Donatien Achou (ruben123x) said :
#2

Thank you.