Daniel Wheeler | 20 Jun 01:19
Gravatar

Re: Mixed Boundary Conditions


On Thu, Jun 19, 2008 at 10:10 AM, Daniel Wheeler
<daniel.wheeler2@...> wrote:
> On Thu, Jun 19, 2008 at 8:57 AM, Recif <recif@...> wrote:
>>
>>
>> Hi,
>> I have listed below the values of -Pe*C + grad C at faces 1 and 2 and
>> the values of grad C at faces n-1 and n for Pe=5.
>
> How did you evaluate "-Pe*C + grad C"? If you are using C.getGrad() be
> aware that getGrad always returns zero on the exterior faces.

This was a little misleading. getGrad() always assumes that the
exterior face value is equal to the adjacent cell value. Thus boundary
conditions are not taken into account.
getGrad() is in fact a CellVariable if it is invoked by a
Cellvariable. I was thinking of getFaceGrad() when I answered your
question, but the idea is the same.

--

-- 
Daniel Wheeler

Recif | 8 Jul 15:56
Favicon

Re: Mixed Boundary Conditions


Daniel Wheeler <daniel.wheeler2@...> writes:

> 
> 
> On Thu, Jun 19, 2008 at 10:10 AM, Daniel Wheeler
> <daniel.wheeler2@...> wrote:
> > On Thu, Jun 19, 2008 at 8:57 AM, Recif <recif@...> wrote:
> >>
> >>
> >> Hi,
> >> I have listed below the values of -Pe*C + grad C at faces 1 and 2 and
> >> the values of grad C at faces n-1 and n for Pe=5.
> >
> > How did you evaluate "-Pe*C + grad C"? If you are using C.getGrad() be
> > aware that getGrad always returns zero on the exterior faces.
> 
> This was a little misleading. getGrad() always assumes that the
> exterior face value is equal to the adjacent cell value. Thus boundary
> conditions are not taken into account.
> getGrad() is in fact a CellVariable if it is invoked by a
> Cellvariable. I was thinking of getFaceGrad() when I answered your
> question, but the idea is the same.
> 

Hi,
 I had used C.getFaceGrad() before, which did give a zero value at exterior faces. 
  With C.getGrad(), I get the following values:

x	C	C_gauss_grad_x	
(Continue reading)

Daniel Wheeler | 8 Jul 17:49
Gravatar

Re: Mixed Boundary Conditions


On Tue, Jul 8, 2008 at 9:56 AM, Recif <recif@...> wrote:
>
> Daniel Wheeler <daniel.wheeler2@...> writes:
>
>>
>>
>> On Thu, Jun 19, 2008 at 10:10 AM, Daniel Wheeler
>> <daniel.wheeler2@...> wrote:
>> > On Thu, Jun 19, 2008 at 8:57 AM, Recif <recif@...> wrote:
>> >>
>> >>
>> >> Hi,
>> >> I have listed below the values of -Pe*C + grad C at faces 1 and 2 and
>> >> the values of grad C at faces n-1 and n for Pe=5.
>> >
>> > How did you evaluate "-Pe*C + grad C"? If you are using C.getGrad() be
>> > aware that getGrad always returns zero on the exterior faces.
>>
>> This was a little misleading. getGrad() always assumes that the
>> exterior face value is equal to the adjacent cell value. Thus boundary
>> conditions are not taken into account.
>> getGrad() is in fact a CellVariable if it is invoked by a
>> Cellvariable. I was thinking of getFaceGrad() when I answered your
>> question, but the idea is the same.
>>
>
>
> Hi,
>  I had used C.getFaceGrad() before, which did give a zero value at exterior faces.
(Continue reading)

Recif | 9 Jul 14:51
Favicon

Re: Mixed Boundary Conditions


> I don't think there is a way to get what you want other than doing the
> calculation "by hand (with indexing)". getGrad() is using the face
> values to calculate the gradient. Thus,
> 
>      C.getgrad()[0] = (C.getArithmeticFaceValue()[1] -
> C.getArithmeticFaceValue()[0]) / dx
>                               = (C[1] - C[0]) / 2 / dx
> 
> However, what you really want is (C[1] - C[0]) / dx. One of the issues
> with making getGrad work the way you want is that
> getArithmeticFaceValue would need to know the interpolated value at
> the exterior faces, which of course requires getGrad. Chicken and egg
> problem. Boundary conditions for variables may go some way in dealing
> with this issue. Do you have any ideas?
> 
> Cheers
> 
Hi,
 I use the approach below to implement BC, and calculate gradients at 
the outer faces for a 1D finite-volume code.
  I used the TSVViewer, as suggested in the FiPy FAQ, to output results 
in a tab-separated ASCII format. Is it possible to write output in binary
format, that can be read by other programs for post-processing? 
Thanks,
Recif

% Faces: 1     2     3                   N    N+1
%        |--x--|--x--|--x--         --x--|--x--|--x
% Nodes:    0     1     2            N-1    N    N+1
(Continue reading)

Daniel Wheeler | 9 Jul 16:57
Gravatar

Re: Mixed Boundary Conditions


On Wed, Jul 9, 2008 at 8:51 AM, Recif <recif@...> wrote:
>>
> Hi,
>  I use the approach below to implement BC, and calculate gradients at
> the outer faces for a 1D finite-volume code.

Very interesting. Of course I would like fipy to be such that you
don't have to do special indexing. Boundary conditions like these make
it hard to change dimensions and mesh configurations.

>  I used the TSVViewer, as suggested in the FiPy FAQ, to output results
> in a tab-separated ASCII format. Is it possible to write output in binary
> format, that can be read by other programs for post-processing?

Have you looked at scipy.io? There is quite a lot of stuff in there
(netcdf_file looks interesting, also npfile).

--

-- 
Daniel Wheeler

Jonathan Guyer | 9 Jul 21:06
Favicon

Re: Mixed Boundary Conditions


On Jul 9, 2008, at 8:51 AM, Recif wrote:

>  I used the TSVViewer, as suggested in the FiPy FAQ, to output results
> in a tab-separated ASCII format. Is it possible to write output in  
> binary
> format, that can be read by other programs for post-processing?

Anything in particular in mind? "binary format" covers a multitude of  
sins and I haven't observed an overwhelming degree of uniformity in  
what other applications will agree to read.

It's probable that we'll implement either or both of NetCDF and Vtk.  
Feel free to add comments to http://www.matforge.org/fipy/ticket/147.

R C | 10 Jul 14:33
Favicon

Re: Mixed Boundary Conditions


--- On Wed, 7/9/08, Jonathan Guyer <guyer@...> wrote:

> From: Jonathan Guyer <guyer@...>
> Subject: Re: Mixed Boundary Conditions
> To: "Multiple recipients of list" <fipy@...>
> Date: Wednesday, July 9, 2008, 3:06 PM
> On Jul 9, 2008, at 8:51 AM, Recif wrote:
> 
> >  I used the TSVViewer, as suggested in the FiPy FAQ,
> to output results
> > in a tab-separated ASCII format. Is it possible to
> write output in  
> > binary
> > format, that can be read by other programs for
> post-processing?
> 
> Anything in particular in mind? "binary format"
> covers a multitude of  
> sins and I haven't observed an overwhelming degree of
> uniformity in  
> what other applications will agree to read.
> 
> It's probable that we'll implement either or both
> of NetCDF and Vtk.  
> Feel free to add comments to
> http://www.matforge.org/fipy/ticket/147.

I use HDF4/5 for portable binary files, but NetCDF would work fine too. I will also follow up on the
suggestion to check out options available through SciPy.
(Continue reading)

Jonathan Guyer | 10 Jul 20:19
Favicon

Re: Mixed Boundary Conditions


On Jul 10, 2008, at 8:33 AM, R C wrote:

> I use HDF4/5 for portable binary files,

When I looked into this several years ago, "use HDF" seemed akin to

  Q: What should I pack for a trip to the Antarctic?
  A: A suitcase.

Early in FiPy's development, I talked with Elena Pourmal of the HDF  
team at NCSA, and she was trying to convince us (NIST) to develop a  
meshed data format to go in HDF. As far as I could tell at the time  
(2005/2006), although there were rumblings of initiatives between  
LLNL, LANL, and NASA, they'd gotten bogged down in politics. NetCDF  
was apparently talking about migrating to HDF5 as their internal  
format, but I don't know if that ever happened.

I ultimately got frustrated with the seeming disarray in an area that  
must have been encountered by bigger fish than us and so I gave up.  
TSV files are readable by absolutely anything (including people).

If you know more current information about any of this, I'd be happy  
to hear it.


Gmane