Hi Daniel,

I changed the boundary conditions and attached is my code for the 1-D Equation:
$$\frac{\partial T}{\partial t} = \frac{\partial}{\partial z}([km + K(z,t)] 
\frac{\partial T}{\partial z}) 
+ \frac{1}{C} \frac{\partial Phi}{\partial z}$$

Thank you for your help,
Tara
________________________________________
From: [email protected] [[email protected]] on behalf of Daniel Wheeler 
[[email protected]]
Sent: Thursday, December 05, 2013 7:53 AM
To: Multiple recipients of list
Subject: Re: Lake Temperature Modelling with FiPy

On Wed, Dec 4, 2013 at 2:21 PM, Larrue, Tara T. (ARC-TI)[UNIVERSITIES
SPACE RESEARCH ASSOCIATION] <[email protected]> wrote:
>
> I am trying to represent this Hostetler 1-D Lake Equation:
> $$
> \frac{\partial T}{\partial t} = \nabla ([km + K(z,t)] \nabla T ) +
> \frac{1}{C}\nabla \Phi
> $$

I assume you mean $\frac{1}{C}\nabla \cdot \Phi$ for the last term in
that equation.

> with these boundary conditions (first is for the surface [z=0], seconds is
> for the bottom of the lake):
>
> $$[km + K(z,t)] \nabla T = EnergyBalanceEquation $$
>
> $$[km + K(z,t)] \nabla T = 0 $$
>
>
> Here is my representation:
>
> (D[0]*temp).grad.constrain([fluxLeft],mesh.facesLeft)
> (D[0]*temp).grad.constrain([fluxRight],mesh.facesRight)

I don't think the above will work at all. It won't do anything. See
http://www.ctcms.nist.gov/fipy/documentation/USAGE.html#applying-fixed-flux-boundary-conditions.
It is a much safer way to work with FiPy. Basically, just add in an
extra term to the equation to account for the boundary conditions.

> eqX = TransientTerm() == (DiffusionTerm(coeff=D) +
> (1./C))*Phi.arithmeticFaceValue.divergence)
>
> where D is the diffusion coefficient calculated from  km + K(z,t) .
> Throughout the iterations, I reset the surface boundary with the following
> lines:
> fluxLeft = heatEnergy*(1./C)
> (D[0]*temp).grad.constrain([fluxLeft],mesh.facesLeft)

You shouldn't need to reset anything inside the loop using the method suggested.

> I am not sure if I represented the heat source term correctly. With this
> current representation, the temperature is is being inversely affected by
> the heat source (energy goes up, temperature drops.) There is also a major
> scaling issue, as I am getting temperature values in the negative thousands.

Fix the boundary condition issue and see what happens and then send
the entire code and we can try and debug it.

Good luck.

--
Daniel Wheeler
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Attachment: Hostetler3.py
Description: Hostetler3.py

_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
  • Lake Tem... Larrue, Tara T. (ARC-TI)[UNIVERSITIES SPACE RESEARCH ASSOCIATION]
    • Re:... Daniel Wheeler
      • ... Larrue, Tara T. (ARC-TI)[UNIVERSITIES SPACE RESEARCH ASSOCIATION]
        • ... Daniel Wheeler

Reply via email to