Implementing finite elements in Mma ?
- To: mathgroup at smc.vnet.net
- Subject: [mg7073] Implementing finite elements in Mma ?
- From: jost at no-junk-mail.fr (Christian Jost)
- Date: Sun, 4 May 1997 21:59:34 -0400 (EDT)
- Organization: Universite Paris-Sud XI
- Sender: owner-wri-mathgroup at wolfram.com
I try to test some simple (one-dimensional) finite-element algorithms in
Mathematica, and havn't found yet a way to program them in a way to keep
them symbolically integratable. The function below calculates the value of
the i-th linear finite element phi_i at time t based on the array of
timevalues that defines where the respective finite elements should be 1
or 0 (phi_i(t_j) = delta_ij (kronecker)). But the way its implemented only
allows for numerical integration. Any idea?
Thanks, Christian.
numberQ[x_] := NumberQ[N[x]]
BasisFunctions[i_Integer, t_Real,timeValue:{_?numberQ..}] :=
Module[{posOfT,sublist,len,value},
len = Length[timeValue];
If[Length[(sublist= Position[(# < t)& /@timeValue,False])] > 0,
posOfT = sublist[[1,1]];, posOfT = 0;];
Which[t<timeValue[[1]], (* beginning of which*)
value = 0.0,
t>timeValue[[len]],
0.0,
posOfT == i,
(t-timeValue[[posOfT-1]])/(timeValue[[posOfT]]-timeValue[[posOfT-1]]),
posOfT == i+1,
(timeValue[[posOfT]]-t)/(timeValue[[posOfT]]-timeValue[[posOfT-1]]),
True,
0.0 ] (* end of which *)
]
--
*********************************************************************
Christian Jost, Université Paris-Sud XI, Orsay, France
Please don't send any junk mail or advertisements. For personal mail please send to: Christian.Jost at epc.u-psud.fr