MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Automating a finite element procedure

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108184] Re: [mg108149] Re: Automating a finite element procedure
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Wed, 10 Mar 2010 01:43:40 -0500 (EST)
  • References: <hn2mcj$454$1@smc.vnet.net> <201003091123.GAA07055@smc.vnet.net>

Nasser M. Abbasi wrote:
> "Kamil" <meetkamil at gmail.com> wrote in message 
> news:hn2mcj$454$1 at smc.vnet.net...
>> Hello all,
>>
>> I have this function in Mathematica:
>> BeamElement[EI_, {x1_, x2_}] := Module[{L = x2 - x1, ke, kt},
>>   ke = {{(12*EI)/L^3, (6*EI)/L^2, -((12*EI)/L^3), (6*EI)/
>>       L^2}, {(6*EI)/L^2, (4*EI)/L, -((6*EI)/L^2), (2*EI)/
>>       L}, {-((12*EI)/L^3), -((6*EI)/L^2), (12*EI)/
>>       L^3, -((6*EI)/L^2)}, {(6*EI)/L^2, (2*EI)/
>>       L, -((6*EI)/L^2), (4*EI)/L}};
>>   kt = {{6/(5 L), 1/10, -(6/(5 L)), 1/10}, {1/10, (2 L)/
>>      15, -(1/10), -(L/30)}, {-(6/(5 L)), -(1/10), 6/(
>>      5 L), -(1/10)}, {1/10, -(L/30), -(1/10), (2 L)/15}}; {ke, kt}
>>   ];
>>
>> I have called the above function with the following and it worked
>> well:
>> {k[1], kt[1]} = BeamElement[EI, nodes[[{1, 2}]]];
>> {k[2], kt[2]} = BeamElement[EI, nodes[[{2, 3}]]];
>> {k[3], kt[3]} = BeamElement[EI, nodes[[{3, 4}]]];
>> lm[1] = {1, 2, 3, 4};
>> lm[2] = {3, 4, 5, 6};
>> lm[3] = {5, 6, 7, 8};
>> K = Table[0, {8}, {8}];
>> R = Table[0, {8}, {8}];
>> Do[K[[lm[i], lm[i]]] += ke[i]; R[[lm[i], lm[i]]] += kt[i], {i, 1, 3}];
>>
>> Now; I tried to automate it using this procedure and it is not
>> working:
>>
>> Do[{ke[i], kt[i]} =
>>   BucklingLinElement[EI, nodes[[{(i - 1) + 1, (i - 1) + 2}]]], {i, 1,
>>    3}];
>> K = Table[0, {8}, {8}]; (R = Table[0, {8}, {8}]) // MatrixForm;
>> Do[lm[i] = {(2 i - 1), (2 i - 1) + 1, (2 i - 1) + 2, (2 i - 1) + 3};
>>  K[[lm[i], lm[i]]] += ke[i]; R[[lm[i], lm[i]]] += kt[i], {i, 1, 3}];
>>
>> I would be grateful to know where the wrong is. Thank you.
>>
>>
> 
> I'll let someone else tackle this. But I just wanted to point out that when 
> posting a question, and then one says "it is not working", then this 
> statement does not give the reader any useful insight into what is really 
> meant "it is not working".
> 
> To get better help, one needs to say what is the expected result, and 
> explain the result that was obtained instead and why the result obtained is 
> not correct.
> 
> The reader is most likely unable to read the poster's mind, and so they will 
> then have to guess, which can result in some misunderstanding.
> 
> --Nasser

In addition to this good advice, I would add that it is important to 
provide complete code. In the example above that would include showing 
definition of nodes and BucklingLinElement (which, to judge from the 
code structure, was maybe intended to be BeamElement?).

Daniel Lichtblau
Wolfram Research




  • Prev by Date: Re: Re: Re: Mathematica function to calculate correlation coefficient?
  • Next by Date: Re: Re: Re: Mathematica function to calculate correlation coefficient?
  • Previous by thread: Re: Automating a finite element procedure
  • Next by thread: Re: How to lay out a grid of plots with frame labels, but no spaces