This feed contains pages in the "fem" category.
During my work on a term paper for "nonlinear finite element method" I encountered the problem to do a study about the convergence of a certain problem.
As the the program we had to use to do the calculations (feap) reads all informations needed to solve the problem from an "so-called" inputfile and writes the results to another file called "outputfile". When there is the need to adjust five parameters, it gets a bit messy to change the inputfile, run FEAP and grab the resulting displacement out of the outputfile for several combinations of the parameters.
As an experienced user the fasted way to accomplish this, is to write a little which automates that. Since the people which evaluated the term paper where quite impressed about it, I am documenting it here too. (I am still wondering how they worked with FEAP for years without such a fairly easy wrapper)
So here is the code:
I reduced the number of parameters to three and removed the part which generates a some gnuplot-code for clarity. Just add another loop if you have more parameters.
In the inputfile all relevant parameters should be also declared as parameters:
...
para
p=2 !load
dx=30 !# of horizontal elmts
dy=10 !# of vertical elmts
nu=0.1 !
...
After calculating the solution, there should be a statement to output the displacement of the node you are interested in:
...
disp,node,0,50
...
The script which puts everything together looks like:
#!/bin/bash
#
#############################################################
# "THE BEER-WARE LICENSE" (Revision 42):
# <robert -at- xenim -dot- de> wrote this file. As long as you
# retain this notice you can do whatever you want
# with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return.
#############################################################
#
function setParm() {
sed -i "s/^\($1=\)[^ ]*/\1$2/" $workfile;
}
INPUT=Igruendung
workfile=Ifound
output=${workfile/I/Out}
result=$INPUT-results
cp $INPUT $workfile
i=0
for nue in 0.1 0.499; do
res=$result-$nue
rm $res
setParm nu $nue
for n in {1..20}; do
dx=$[ $n * 3 ]
dy=$[ $n * 1 ]
setParm dx $dx
setParm dy $dy
echo -n $[ dx*dy*2 ] >> $res
echo -en "\t" >> $res
echo -en "Run $i:\tdx=$dx\tdy=$dy\tnue=$nue ... "
./feap -i$workfile -o$output
val=`grep -A1 '^ Node' $output | tail -n 1 | sed 's/.* //'`
echo $val
echo -en "$val\t" >> $res
rm $output
let i=i+1
echo >> $res
done
done
rm $workfile