[Octave forge] [bim package]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Octave forge] [bim package]

JuanPi
Hi all,

I've been plain with the bim package and the 1D laplacian.
Can it be that the functions bim1a_* only work with evenly spaced +D meshes?
Or should they work with any 1D mesh?

Cheers

--
JuanPi Carbajal
https://goo.gl/ayiJzi

-----
"Why is thought, being a secretion of the brain, more wonderful than
gravity, a property of matter?"
- C. Darwin


-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: [Octave forge] [bim package]

c.-2


> On 4 Feb 2018, at 10:17, JuanPi <[hidden email]> wrote:
>
> Hi all,
>
> I've been plain with the bim package and the 1D laplacian.
> Can it be that the functions bim1a_* only work with evenly spaced +D meshes?
> Or should they work with any 1D mesh?

They should work for non-uniform meshes.
Actually they have been extensively tested on layer-adapted meshes [1,2].
Can you show an example that is not working?

> Cheers

c.

[1] http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf
[2] https://link.springer.com/chapter/10.1007/978-3-642-00605-0_9




-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: [Octave forge] [bim package]

c.-2


> On 4 Feb 2018, at 17:02, c. <[hidden email]> wrote:
>
>
>
>> On 4 Feb 2018, at 10:17, JuanPi <[hidden email]> wrote:
>>
>> Hi all,
>>
>> I've been plain with the bim package and the 1D laplacian.
>> Can it be that the functions bim1a_* only work with evenly spaced +D meshes?
>> Or should they work with any 1D mesh?
>
> They should work for non-uniform meshes.
> Actually they have been extensively tested on layer-adapted meshes [1,2].
> Can you show an example that is not working?


This code snippet for example:

>> pkg load bim
>> x = [linspace(0, .5, 100), linspace(.5, 1, 200)(2:end)].';
>> A = bim1a_laplacian (x, 1, 1);
>> b = bim1a_rhs (x, 1, 1);
>> u = zeros (size (x));
>> u(2:end-1) = A(2:end-1, 2:end-1) \ b(2:end-1);
>> plot (x, u, 'x-')

solves

- u''(x) = 1    in 0 < x < 1
u(0) = u(1) = 0

on a piece-wise uniform mesh.

>> Cheers
>
> c.
>
> [1] http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf
> [2] https://link.springer.com/chapter/10.1007/978-3-642-00605-0_9
>
>



-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: [Octave forge] [bim package]

c.-2


> On 4 Feb 2018, at 17:55, c. <[hidden email]> wrote:
>
> This code snippet for example:
>
>>> pkg load bim
>>> x = [linspace(0, .5, 100), linspace(.5, 1, 200)(2:end)].';
>>> A = bim1a_laplacian (x, 1, 1);
>>> b = bim1a_rhs (x, 1, 1);
>>> u = zeros (size (x));
>>> u(2:end-1) = A(2:end-1, 2:end-1) \ b(2:end-1);
>>> plot (x, u, 'x-')
>
> solves
>
> - u''(x) = 1    in 0 < x < 1
> u(0) = u(1) = 0
>
> on a piece-wise uniform mesh.

And, to try a more complex non-uniform mesh spacing, you could test this:

>> y = x .^ 3;
>> A = bim1a_laplacian (y, 1, 1);
>> b = bim1a_rhs (y, 1, 1);
>> u = zeros (size (y));
>> u(2:end-1) = A(2:end-1, 2:end-1) \ b(2:end-1);
>> plot (y, u, 'x-')

c.




-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------