On Jul 10, 2008, at 11:22 AM, Daniel Wheeler wrote:


On Wed, Jul 9, 2008 at 6:45 PM, Tony S Yu <[EMAIL PROTECTED]> wrote:

This is probably a bad idea, but I want to set a boundary condition on an interior cell. Alternatively, I would just have a rectangular mesh with some of the nodes masked off (kind of like a step on one of the rectangle's sides). The problem with changing the mesh in this manner is that this
boundary condition needs to move in time.

As you may have noticed the boundary condition objects do not work on
internal faces. However this does not seem to be your issue. You
should be able to set the value of a cell internally, either by
continually resetting the value or by having a source in the equation.
Looking at the script below, the value is reset and then the equation
is solved. There us no reason that the value should still be zero
after solve(). Resetting at every sweep or time step has its
limitations, bu the values are decreasing as you would expect.

In general, if one has an internal moving boundary condition, it is
probably best to use a secondary variable that defines the position of
the interface and then make any internal boundary conditions dependent
on this variable. This is basically what happens in phase field and
level set problems.

Yeah, I'm actually planning to take a phase field approach to my problem,
but I'm using this naive approach as a simple sanity check.


My first thought was to force a cell to a given value by repeatedly
resetting its value inside the solution loop. But, since the diffusion terms use the face values (not cell values) in the solution, I'm not getting the value back. The next (bad) idea I had was to set the face values, but I
didn't see a way of doing this.

Is there a way of setting a boundary condition on an interior cell?

The best way is to have an implicit source term that fixes the value.
Try something like this.

    large_value = CellVariable(mesh=mesh, value=1e+10 * ((x == 1.5) &
(y == 0.5)))
    eq = TransientTerm() == ImplicitDiffusionTerm(coeff=D) -
ImplicitSourceTerm(large_value) + c_sink * large_value

Thanks, this solution works as you suggest. However, I don't understand the math. It looks like the last term is what I would normally consider to be a source/sink, with the magnitude of the term being proportional to the flux into/out-of the system. But, I don't understand how ImplicitSourceTerm works (I looked at the docstring, but I'm still confused).

I don't want to waste your time, but if you could point me to a good reference on this type of source term, I would be very grateful.

Thanks for your help,
-Tony


Cheers

--
Daniel Wheeler



Reply via email to