As a comment, if S is the whole source, you don't want to use
ImplicitSourceTerm, because that assumes that the source is linear in the
variable with coefficient as given. This is apparently usually the
recommended way to do it if there is a way to write your source that way.
However, if you have a source that can't be written that way, you can just
type the source term into the equation directly: documentation
<http://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#source-term>
(and an example here
<http://www.ctcms.nist.gov/fipy/examples/convection/generated/examples.convection.exponential1DSource.mesh1D.html#module-examples.convection.exponential1DSource.mesh1D>
)

Ray

On Thu, Jan 8, 2015 at 10:30 AM, Christopher Jones <[email protected]>
wrote:

> Hello,
>
> I am modelling nonlinear heat conduction using time steps and sweeps.
>
> Basic equation is:
>
> du/dt = A(u) * d2u/dx2 + S(x, t)
>
> where u(x, t)
>
> I have functions written for A(u), the DiffusionTerm coefficient, and S(x,
> t), the ImplicitSourceTerm. I implement them with the following snippet:
>
> eq = TransientTerm() == DiffusionTerm(coeff=A) +
> ImplicitSourceTerm(coeff=S)
>
> S is really the whole source term, not the coefficient, so have I coded
> this correctly?
>
> I have declared A as a FaceVariable (because diffusion happens from cell
> to cell, and S as a CellVariable, is this correct?
>
> Since S depends on t as well, I created a Variable t. I then created a
> small function and included it with S with this snippet:
>
> B = 50 * numerix.exp(-t)
>
> S.setValue(B)
>
> After sweeping, I increment the elapsed time and then t, with
>
> t.setValue(elapsedTime)
>
> I can print B's value to see that it does decay.
>
>
> I provide an initial distribution: u(x, 0). For simplicity, I will choose
> no boundary conditions. The first set of sweeps causes u to zero out.
>
> What is happening? Have I not set this up correctly? What examples could I
> use to iron this out?
>
> Thanks,
> Chris
>
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to