dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #20564
Re: [Question #139887]: how can I change boundaryconditions asfunction oftime?
Question #139887 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/139887
Johan Hake proposed the following answer:
On Sunday January 2 2011 02:25:13 Sungick Kim wrote:
> Question #139887 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/139887
>
> Status: Answered => Open
>
> Sungick Kim is still having a problem:
> Initially, I wanted to change the actual boundary domain.
> After checking your answer out,
> I think that changing the value of Dirichlet boundary condition for a fixed
> boundary would be correct. So I tried this code below. However, the value
> is not changing.
> Could you give me a hand again?
>
> ---------------------------------------------------------------------------
> ----------------- boundary = compile_subdomains("on_boundary")
>
> # approximated step function whose value is 1 for x[0] < t
> g = Expression("0.0 + 1.0/(1+exp(10*(x[0]-t)))")
>
> BC = DirichletBC(Q1, g1, boundary)
>
> # Parameters for time stepping
> T = 10.0
> dt = 0.1
> t = 0.0
>
> while t < T:
>
> t += dt
> # solve problem
> ---------------------------------------------------------------------------
> -----------------
You need to update t in your expression:
...
while t < T:
t += dt
g.t = t #!!!
# solve problem
Johan
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.