CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

I developed an FEM toolkit in Java: FuturEye

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By nkliuyueming
  • 1 Post By vonboett

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 29, 2011, 17:23
Default I developed an FEM toolkit in Java: FuturEye
  #1
New Member
 
Yueming Liu
Join Date: Apr 2011
Location: USA
Posts: 6
Rep Power: 15
nkliuyueming is on a distinguished road
Send a message via Skype™ to nkliuyueming
FuturEye is a Java based Finite Element Method (FEM) Toolkit, providing concise, natural and easy understanding programming interfaces for users who wish to develop researching and/or engineering FEM algorithms for Forward and/or Inverse Problems.

The essential components of FEM are abstracted out, such as nodes, elements, meshes, degrees of freedom and shape function etc. The data and operations of these classes are encapsulated together properly. The classes that different from other existing object-oriented FEM softwares or libraries are function classes. The behavior of the function classes in Futureye is very similar to that in mathematical context. For example algebra of functions, function derivatives and composition of functions. Especially in FEM environment, shape functions, Jacobin of coordinate transforms and numerical integration are all based on the function classes. This feature leads to a more close integration between theory and computer implementation.

FuturEye is designed to solve 1D,2D and 3D partial differential equations(PDE) of scalar and/or vector valued unknown functions. The start point of development of this toolkit is solving inverse problems of PDE. In order to solve inverse problems, usually some forward problems must be solved first and many exterior data manipulations should be performed during the solving processes. There are many classes defined for those data operations. However, the data processes are complicated in actual applications, we can not write down all the tools for manipulating data. The design of the basic classes allows operations to all aspect of data structure directly or indirectly in an easily understanding way. This is important for users who need write their own operations or algorithms on the bases of data structure in FuturEye. Some other existing FEM softwares or libraries may over encapsulate the data and operations for such inverse applications.



The toolkit can be used for various purposes:
  • Teaching: The feature of close integration between FEM theory and computer implementation of this toolkit helps a student to understand basic FEM concepts, e.g. shape functions, Jacobin and assembly process.
  • Researching: Helps researchers quickly develop and test their models, experiment data and algorithms. e.g. new equations, new finite elements and new solution methods.
  • Engineering: The performance and efficiency may be unsatisfied for real applications, if an finite element class defined in a mathematical manner without optimization. Thanks to the interface conception in Java, we can implement the same interface in many different ways, thus a carefully optimized finite element class can be used in applications with huge number of elements.
http://code.google.com/p/futureye/
ssh123 likes this.
nkliuyueming is offline   Reply With Quote

Old   October 25, 2011, 23:47
Default update to version 2.1
  #2
New Member
 
Yueming Liu
Join Date: Apr 2011
Location: USA
Posts: 6
Rep Power: 15
nkliuyueming is on a distinguished road
Send a message via Skype™ to nkliuyueming
How to use WeakFormBuilder:

http://code.google.com/p/futureye/wi...self_weakforms


package edu.uta.futureye.tutorial;

import java.util.HashMap;

import edu.uta.futureye.algebra.SolverJBLAS;
import edu.uta.futureye.algebra.intf.Matrix;
import edu.uta.futureye.algebra.intf.Vector;
import edu.uta.futureye.core.Element;
import edu.uta.futureye.core.Mesh;
import edu.uta.futureye.core.NodeType;
import edu.uta.futureye.function.AbstractFunction;
import edu.uta.futureye.function.Variable;
import edu.uta.futureye.function.basic.FC;
import edu.uta.futureye.function.basic.FX;
import edu.uta.futureye.function.intf.Function;
import edu.uta.futureye.function.intf.ScalarShapeFunction;
import edu.uta.futureye.io.MeshReader;
import edu.uta.futureye.io.MeshWriter;
import edu.uta.futureye.lib.assembler.AssemblerScalar;
import edu.uta.futureye.lib.element.FEBilinearRectangle;
import edu.uta.futureye.lib.element.FEBilinearRectangleRegular;
import edu.uta.futureye.lib.element.FELinearTriangle;
import edu.uta.futureye.lib.weakform.WeakFormBuilder;
import edu.uta.futureye.util.container.ElementList;

public class UseWeakFormBuilder {

/**
* <blockquote><pre>
* Solve
* -k*\Delta{u} = f in \Omega
* u(x,y) = 0, on boundary x=3.0 of \Omega
* u_n + u = 0.01, on other boundary of \Omega
* where
* \Omega = [-3,3]*[-3,3]
* k = 2
* f = -4*(x^2+y^2)+72
* u_n = \frac{\partial{u}}{\partial{n}}
* n: outer unit normal of \Omega
* </blockquote></pre>
*/
public static void rectangleTest() {
//1.Read in a rectangle mesh from an input file with
// format ASCII UCD generated by Gridgen
MeshReader reader = new MeshReader("rectangle.grd");
Mesh mesh = reader.read2DMesh();
mesh.computeNodeBelongsToElements();

//2.Mark border types
HashMap<NodeType, Function> mapNTF = new HashMap<NodeType, Function>();
//Robin type on boundary x=3.0 of \Omega
mapNTF.put(NodeType.Robin, new AbstractFunction("x","y"){
@Override
public double value(Variable v) {
if(3.0-v.get("x") < 0.01)
return 1.0; //this is Robin condition
else
return -1.0;
}
});
//Dirichlet type on other boundary of \Omega
mapNTF.put(NodeType.Dirichlet, null);
mesh.markBorderNode(mapNTF);

//3.Use element library to assign degrees of
// freedom (DOF) to element
ElementList eList = mesh.getElementList();
//FEBilinearRectangle bilinearRectangle = new FEBilinearRectangle();
//If the boundary of element parallel with coordinate use this one instead.
//It will be faster than the old one.
FEBilinearRectangleRegular bilinearRectangle = new FEBilinearRectangleRegular();
for(int i=1;i<=eList.size();i++)
bilinearRectangle.assignTo(eList.at(i));


//4.Weak form. We use WeakFormBuilder to define weak form
WeakFormBuilder wfb = new WeakFormBuilder() {
/**
* Override this function to define weak form
*/
@Override
public Function makeExpression(Element e, Type type) {
ScalarShapeFunction u = getScalarTrial();
ScalarShapeFunction v = getScalarTest();
//Call param() to get parameters, do NOT define functions here
//except for constant functions (or class FC). Because functions
//will be transformed to local coordinate system by param()
Function fk = param(e,"k");
Function ff = param(e,"f");
switch(type) {
case LHS_Domain:
// k*(u_x*v_x + u_y*v_y) in \Omega
return fk.M( u._d("x").M(v._d("x")) .A (u._d("y").M(v._d("y"))) );
case LHS_Border:
// k*u*v on Robin boundary
return fk.M(u.M(v));
case RHS_Domain:
return ff.M(v);
case RHS_Border:
return v.M(0.01);
default:
return null;
}
}
};
Function fx = FX.fx;
Function fy = FX.fy;
wfb.addParamters(FC.c(2.0), "k");
//Right hand side(RHS): f = -4*(x^2+y^2)+72
wfb.addParamters(fx.M(fx).A(fy.M(fy)).M(-4.0).A(72.0),"f");

//5.Assembly process
AssemblerScalar assembler =
new AssemblerScalar(mesh, wfb.getScalarWeakForm());
System.out.println("Begin Assemble...");
assembler.assemble();
Matrix stiff = assembler.getStiffnessMatrix();
Vector load = assembler.getLoadVector();
//Boundary condition
assembler.imposeDirichletCondition(FC.c0);
System.out.println("Assemble done!");

//6.Solve linear system
SolverJBLAS solver = new SolverJBLAS();
Vector u = solver.solveDGESV(stiff, load);
System.out.println("u=");
for(int i=1;i<=u.getDim();i++)
System.out.println(String.format("%.3f", u.get(i)));

//7.Output results to an Techplot format file
MeshWriter writer = new MeshWriter(mesh);
writer.writeTechplot("./tutorial/UseWeakFormBuilder2.dat", u);
}

public static void main(String[] args) {
rectangleTest();
}

}
nkliuyueming is offline   Reply With Quote

Old   June 20, 2012, 03:25
Default Update
  #3
New Member
 
Yueming Liu
Join Date: Apr 2011
Location: USA
Posts: 6
Rep Power: 15
nkliuyueming is on a distinguished road
Send a message via Skype™ to nkliuyueming
FuturEye3.0

http://code.google.com/p/futureye/

Scala Language Version: ScalaFEM0.1
nkliuyueming is offline   Reply With Quote

Old   June 20, 2012, 03:48
Default
  #4
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
Quote:
Originally Posted by nkliuyueming View Post
FuturEye3.0

http://code.google.com/p/futureye/

Scala Language Version: ScalaFEM0.1

just a quick remark: In your plot, it should be Lagrange multiplier, not language multiplier
cfdnewbie is offline   Reply With Quote

Old   June 20, 2012, 11:02
Default thanks
  #5
New Member
 
Yueming Liu
Join Date: Apr 2011
Location: USA
Posts: 6
Rep Power: 15
nkliuyueming is on a distinguished road
Send a message via Skype™ to nkliuyueming
many thanks!
nkliuyueming is offline   Reply With Quote

Old   July 30, 2012, 03:22
Default Does anyone interested in developing this project?
  #6
New Member
 
Yueming Liu
Join Date: Apr 2011
Location: USA
Posts: 6
Rep Power: 15
nkliuyueming is on a distinguished road
Send a message via Skype™ to nkliuyueming
I have a plan to extend and optimize the toolkit, FuturEye, if you are interested in developing FEM code, please contact me
nkliuyueming is offline   Reply With Quote

Old   August 3, 2012, 06:26
Default
  #7
Senior Member
 
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 240
Rep Power: 17
vonboett is on a distinguished road
So it is OpenSource (MIT) right? At ETH Zürich we developed once a Software for simulating soil salinisation (SimSalin) in Java including groundwater flow, evapotranspiration and transport, and we came to the point to see that Java is too slow. Since Java is so close related to C++, would it be worth the effort to rewrite part of your code in C++ and call the methods from Java? The discrete element software FARO for Rockfall protection nets for which I implement new Elements has a Java3D Interface and calls C++ methods and is among the fastest codes of its kind.
ssh123 likes this.
vonboett is offline   Reply With Quote

Old   January 29, 2016, 14:28
Default
  #8
New Member
 
Yueming Liu
Join Date: Apr 2011
Location: USA
Posts: 6
Rep Power: 15
nkliuyueming is on a distinguished road
Send a message via Skype™ to nkliuyueming
Since google code has been closed I have moved the project to Github: https://github.com/yuemingl/Futureye_v2
nkliuyueming is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
comments on FDM, FEM, FVM, SM, SEM, DSEM, BEM kenn Main CFD Forum 2 July 18, 2004 19:28
FEM or FVM for CFD Astrid Main CFD Forum 18 December 15, 2000 01:02
How good is CFD? kai Main CFD Forum 39 April 7, 2000 13:48


All times are GMT -4. The time now is 16:12.