Giter VIP home page Giter VIP logo

lyc102 / ifem Goto Github PK

View Code? Open in Web Editor NEW
185.0 16.0 73.0 28.39 MB

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.

Home Page: https://lyc102.github.io/ifem/

License: GNU General Public License v3.0

MATLAB 85.31% Shell 0.02% Smarty 0.05% CSS 7.12% Python 0.02% JavaScript 0.76% TeX 6.54% C++ 0.16% M 0.01%

ifem's Introduction

iFEM: an integrated finite element method package in MATLAB

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. Besides the simplicity and readability, sparse matrixlization, an innovative programming style for MATLAB, is introduced to improve the efficiency. In this novel coding style, the sparse matrix and its operations are used extensively in the data structure and algorithms.

Installation

Add the path to iFEM into the path library of MATLAB by either:

  1. Graphical interface. Click File -> Set Path -> Add with Subfolders and chose the directory where the package iFEM is stored.

  2. Command window. Go to the directory of iFEM and run setpath

Help

  1. help funexample displays a description of and syntax for the function funexample. For example, help mg will show basic usage for mg function in the plain text.
  2. ifem funexampledoc show detailed description. For example, ifem mgdoc will explain the mg function step by step in html format. But not every function has a html documentation.

Quick Start

  1. Type ifem introduction to get an introduction on ifem.

  2. Go through examples in \example directory.

Feedback

If you like it, please send me an email [email protected]. If you feel it is helpful for your research, please acknowledge your use by citing:

L. Chen. iFEM: an integrated finite element method package in MATLAB. Technical Report, University of California at Irvine, 2009.

@techreport{Chen:2008ifem,
	author = {Long Chen},
	journal = {Technical Report, University of California at Irvine},
	title = {{$i$FEM}: an integrated finite element methods package in {MATLAB}},
	url = {https://github.com/lyc102/ifem},
	year = {2009}}

Acknowledgement

The author would like to thank Professor Michael Holst in University of California at San Diego and Professor Ludmil Zikatanov in Pennsylvania State University for many insightful discussion, and also Professor Chensong Zhang in Chinese Academy of Sciences for the effort in the development of AFEM@matlab, an early version of iFEM.

The author thanks students or postdocs Shuhao Cao, Ming Wang, Huayi Wei, Lin Zhong, and Jie Zhou for their contribution to iFEM in one way or another. Detailed credits can be found in the M-lint of several m files.

The author is also grateful to the NSF for the partial support over the years.

Long Chen

--

Professor

Department of Mathematics University of California at Irvine http://math.uci.edu/~chenlong/

--

ifem's People

Contributors

david-hang-du avatar litaihe avatar lyc102 avatar ruru777 avatar scaomath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ifem's Issues

Output argument "isBdNode" (and possibly others) not assigned a value in the execution with "gradmatrix" function.

when I run the example\fem\Maxwell\Maxwell3ND0femrate.m, the fellowing error will appear

Output argument "isBdNode" (and possibly others) not assigned a value in
the execution with "gradmatrix" function.

Error in mgMaxwell (line 79)
[grad,isBdNode] = gradmatrix(edge,isBdEdge);

Error in Maxwell (line 393)
    [u,info] = mgMaxwell(bigAD,f,AP,node,elemold,edge,HB,option);

Error in femMaxwell3 (line 60)
                [u,edge,eqn,info] = Maxwell(node,elem,bdFlag,pde,option);

Error in Maxwell3ND0femrate (line 39)
femMaxwell3(mesh,pde,option);

this error will be resolved when I make the following changes to the file solver/gradmatrix.m

@@ -28,5 +28,6 @@ if any(isBdEdge) % no grad on boundary edges
    idx = ~(isBdEdge(i) | isBdNode(j)); 
else
    idx = 1:length(i);
    isBdNode = false(N,1);
end
grad = sparse(i(idx),j(idx),s(idx),NE,N);

is the modification reasonable? thank you.

`Uniformrefine3` unfavorable behavior after update in `cubemesh`

Problem

In 842ba40 commit, the loop ordering of the cubemesh is changed such that the elem generated by it will have a nice ascending ordering in both rows and columns. For example

[node, elem] = cubemesh([-1,1,-1,1,-1,1],1);

gives

elem =
     1     4     5    14
     1     2     5    14
     1    10    13    14
     1    10    11    14
     1     4    13    14
     1     2    11    14
     2     5     6    15
     2     3     6    15
     2    11    14    15
     2    11    12    15
     2     5    14    15
     2     3    12    15
     4     7     8    17
     4     5     8    17
     4    13    16    17
     4    13    14    17
     4     7    16    17
     4     5    14    17
     5     8     9    18
     5     6     9    18
     5    14    17    18
     5    14    15    18
     5     8    17    18
     5     6    15    18
    10    13    14    23
    10    11    14    23
    10    19    22    23
    10    19    20    23
    10    13    22    23
    10    11    20    23
    11    14    15    24
    11    12    15    24
    11    20    23    24
    11    20    21    24
    11    14    23    24
    11    12    21    24
    13    16    17    26
    13    14    17    26
    13    22    25    26
    13    22    23    26
    13    16    25    26
    13    14    23    26
    14    17    18    27
    14    15    18    27
    14    23    26    27
    14    23    24    27
    14    17    26    27
    14    15    24    27

Visualizing the elements by a six-element group we will have
mesh1

However, if we do from cubemesh then uniformrefine3, the ascending ordering is gone.

[node,elem] = cubemesh([-1,1,-1,1,-1,1],2);
[node,elem] = uniformrefine3(node,elem);

gives

elem =
     1    10    11    15
     1     9    11    15
     1    12    14    15
     1    12    13    15
     1    10    14    15
     1     9    13    15
    10     3    19    21
     9     2    16    18
    12     5    24    25
    12     5    23    25
    10     3    20    21
     9     2    17    18
    11    19     4    22
    11    16     4    22
    14    24     7    27
    13    23     6    26
    14    20     7    27
    13    17     6    26
    15    21    22     8
    15    18    22     8
    15    25    27     8
    15    25    26     8
    15    21    27     8
    15    18    26     8
    10    11    15    21
     9    11    15    18
    12    14    15    25
    12    13    15    25
    10    14    15    21
     9    13    15    18
    10    11    19    21
     9    11    16    18
    12    14    24    25
    12    13    23    25
    10    14    20    21
     9    13    17    18
    11    15    21    22
    11    15    18    22
    14    15    25    27
    13    15    25    26
    14    15    21    27
    13    15    18    26
    11    19    21    22
    11    16    18    22
    14    24    25    27
    13    23    25    26
    14    20    21    27
    13    17    18    26

and visualizing the refined elements by 6-element groups yields something like the following:
mesh2

Potential solution

  • re-implement uniformrefine3, this is somewhat unwanted from a development pov.
  • add an ordering check pre/post-refining.

typos in HodgeLaptest.m and HodgeLapfemrate.m

HodgeLaplacianE(node,elem,pde,bdFlag,option) <---> HodgeLaplacianE(node,elem,bdFlag, pde, option)

mfemHodgeLap(node,elem,bdFlag,pde,option) <-----> mfemHodgeLap(mesh,pde,option,varargin)

Strange problem with eleminterpolate

@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.

CahnHillard Benchmark

Hello!
so far it seems that the periodic boundary conditions are not applied for CahnHillard Benchmark?

Best regards!

Adaptive Wilson element with at most one hangnode on one edge

Professor Chen,

Sorry to disturb you. There's some bug in my codes and it took a lot of effort and time to get nothing. I was coding the adaptive Wilson element to solve the Poisson equation. Since it is the rectangle element, I can rarely refer to you ifem package. I write the square bisect codes (bisectQuad.m). In the solving step (PoissonWilson.m), things go right when dealing with the uniform refinement (compSolFig_nohang.m). While with hangnodes, it goes wrong (compSolFig_hang.m).
I am hoping if you can have a look on my codes when you are spare. Thanks a lot!
The theoretical results refer to the following pdf.
Have a nice day!

Xuemei ZHou
A Ph.D. student of Chinese Academy of Sciences

hu2014 New a posteriori error estimate and quasi-optimal convergence of the adaptive nonconforming Wilson element.pdf

WilsonSolve.zip

One data m file is missing, which is just the Lshapedata.m in your ifem package.

CareyData.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.