# Re: Question regarding Boundary Condition Implementation

```
> On Apr 10, 2019, at 4:42 PM, Daniel DeSantis <desan...@gmail.com> wrote:
>
> 1) Set a different Cp, rho, and k in just the PCM domain when the temperature
> in that domain crosses over a certain melt temperature (350K). I tried an if
> statement inside the solving loop and I think that has worked, based on some
> print testing I did in the loop. I just wanted to get your opinion and see if
> that was the right way to go.

Seems reasonable, as long as you're calling `.setValue()` and not redefining
Cp, rho, and k.

In fact, I wouldn't use an `if`:

>>> for step in range(steps):
...     T.updateOld()
...     eq.solve(dt=dt)
...     rho.setValue(rho_melt, where=PCM & (T > 350))

> 2) I'd like to move this to cylindrical coordinates with the lengths being
> radii. I'm not sure if the cylindrical grid is working though. And if it
> isn't, is there a way to convert the diffusion equation into something that
> would solve the problem in Cartesian? More specifically, how would you write
> an appropriate equation for the heat transfer of a radial system in Cartesian
> coordinates? In short, how would you write this:
> <image.png>
> in FiPy?

The CylindricalGrids work fine, except for taking the gradient of the field,
which is an unusual need.

>
> 3) Ideally, I would move this to a 2D system which is the most confusing to
> me. In a 2D system, heat would be transmitted radially while air would be
> flowing axially. The air would cool as it passes through the tube. The
> diffusion term in the axial direction would be significantly lower than the
> convection term. Can I use the same heat transfer equation you've suggested
> slightly modified? I would guess the equation to be something like this:
>
> eq = TransientTerm(coeff = rho*Cp,var = T) +
> PowerLawConvectionTerm(coeff=rho*Cp*v,var = T) == DiffusionTerm(coeff=k,var =
> T)
>
> s.t. v = velocity of the air.

Looks OK

> I would also think that I would have to set the value of v to 0 at the wall
> and beyond, which means v would be a CellVariable like rho and k.

Actually, v should be a rank-1 FaceVariable.

Anisotropic diffusion is supported in FiPy (see
https://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.anisotropy.html),
but are you really sure you have lower axial diffusivity? It seems to me more
likely that transport is simply dominated by axial flow.

> I also guess this equation would be subject to any changes that would be made
> in question 2, regarding writing a cylindrical equation in a cartesian
> system. What do you think?

Use a CylindricalGrid and don't change the equation at all.

> Again, thank you so much for your help and I hope I haven't taken up too much