lyc102 / ifem

iFEM is a MATLAB software package containing robust, efficient, and easy-following codes for the main building blocks of adaptive finite element methods on unstructured simplicial grids in both two and three dimensions.
https://lyc102.github.io/ifem/
GNU General Public License v3.0
185 stars 73 forks source link

Strange problem with eleminterpolate #1

Closed stoiver closed 3 years ago

stoiver commented 5 years ago

@lyc102 just using ifem to produce an adaptive shallow water equation solver. But ran into a strange problem with eleminterpolate when interpolating from a fine mesh to a coarse mesh.

For some reason the last command in eleminterpolate.m

newp(tree(:,3)) = [];

doesn't seem to be applied (at least in some cases).

I have attached an example where the error turns up (at least when using matlab R2017a)

eleminterpolate_bug.txt

I can get around the problem by explicitly adding the command newp(tree(:,3)) = []; after the call to eleminterpolate.

By the way, ifem is an impressive package, well done.

lyc102 commented 5 years ago

Thanks. I will take a look and let you know the problem. — Long

On Jun 18, 2019, at 21:36, Stephen Roberts notifications@github.com wrote:

@lyc102 https://github.com/lyc102 just using ifem to produce an adaptive shallow water equation solver. But ran into a strange problem with eleminterpolate when interpolating from a fine mesh to a coarse mesh.

For some reason the last command in eleminterpolate.m

newp(tree(:,3)) = []; doesn't seem to be applied (at least in some cases).

I have attached an example where the error turns up (at least when using matlab R2017a)

eleminterpolate_bug.txt https://github.com/lyc102/ifem/files/3304402/eleminterpolate_bug.txt I can get around the problem by explicitly adding the command newp(tree(:,3)) = []; after the call to eleminterpolate.

By the way, ifem is an impressive package, well done.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lyc102/ifem/issues/1?email_source=notifications&email_token=AC6TPYLHVIRTNSUF4JEGPV3P3GZUBA5CNFSM4HZFZFT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G2JQF3Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AC6TPYNWKDO7IYJFC3JHUM3P3GZUBANCNFSM4HZFZFTQ.

stoiver commented 5 years ago

@lyc102 it seems that for my example NTin > NTf and so the execution never gets to the command newp(tree(:,3)) = [];. A simple fix is to change the elseif to else for the fine to coarse case.

lyc102 commented 5 years ago

Yes. You are right. I looked at your example and found when the tree is obtained by the coarsening, NTf could be smaller than NTin not exactly equal. I have pushed the update to github. Thanks again. — Long

On Jun 19, 2019, at 07:08, Stephen Roberts notifications@github.com wrote:

@lyc102 https://github.com/lyc102 it seems that for my example NTin > NTf and so the execution never gets to the command newp(tree(:,3)) = [];. A simple fix is to change the elseif to else for the fine to coarse case.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lyc102/ifem/issues/1?email_source=notifications&email_token=AC6TPYLUJEKMDWRAE2ROH4TP3I4UPA5CNFSM4HZFZFT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYB7RWA#issuecomment-503576792, or mute the thread https://github.com/notifications/unsubscribe-auth/AC6TPYLPWQDBJEESHLVB7I3P3I4UPANCNFSM4HZFZFTQ.