FINITE ELEMENTS
SYMBOLIC PROGRAMMING IN MAPLE
by Artur Portela
Potential-Flow Example 4:
Symbolic Variables
> restart:interface(verboseproc=3):printlevel:=3:
> libname := "C:/mylib/fem",libname:
> with(Plotter):
> with(Cgt_fem):
> with(G_cgt_fem):
>
Data Preparation
The best way to input data for Cgt_fem is to use the procedure read_save_data , which reads a file with the following structure:
*
control
* [title,point sources,element sources,boundary velocities]
title Potential Flow in a Rectangular Domain
point sources
element sources
boundary velocities
*
materials
* [material,x-permeability,y-permeability,angle of the local x-direction]
1 2 2 45
2 8 8 45
*
nodes
* [node,x,y]
1 0 0
2 0 1
3 0 2
4 1 0
5 1 1
6 1 2
7 2 0
8 2 1
9 2 2
10 3 0
11 3 1
12 3 2
13 4 0
14 4 1
15 4 2
*
elements
* [element,node1,node2,node3,material]
1 1 4 5 1
2 1 5 2 1
3 2 5 3 1
4 3 5 6 1
5 4 7 8 1
6 5 4 8 1
7 5 8 6 1
8 6 8 9 1
9 7 10 11 1
10 7 11 8 1
11 8 11 9 1
12 11 12 9 1
13 10 13 14 1
14 10 14 11 1
15 11 14 12 1
16 12 14 15 1
*
constraints
* [node,potential]
1 10
2 10
3 10
13 0
14 0
15 0
*
boundary velocities
* [node1,node2,normal velocity]
1 2 0
2 3 0
5 4 0
*
point sources
* [node,Q]
1 -50
*
element sources
* [element,q]
2 30
*
end
*
The data blocks, with the respective keyword on the top, can be defined in any order.
Alternatively, data can be given manually through the definition of the variables: tcase , control , nods , elems , mat_props , bdr_conds , b_velts , p_srcs and e_srcs . See bellow the structure of these variables.
>
Symbolic Variables
For the sake of simplicity, start reading the data of example 1
> read_save_data();
read data from a file (y/n) ? y;
file name: "dat_test1.txt";
save data into a file (y/n) ? n;
> #tcase;control;nods;elems;mat_props;bdr_conds;b_velts;p_srcs;e_srcs;
Redefine this data with symbolic variables :
> mat_props:=[[kx,ky,alpha]]:elems:=[[1,4,5,1],[1,5,2,1],[2,5,3,1],[3,5,6,1],[4,7,8,1],[5,4,8,1],[5,8,6,1],[6,8,9,1],[7,10,11,1],[7,11,8,1],[8,11,9,1],[11,12,9,1],[10,13,14,1],[10,14,11,1],[11,14,12,1],[12,14,15,1]]:
> #tcase;control;nods;elems;mat_props;bdr_conds;b_velts;p_srcs;e_srcs;
> cgt_fem(yes);
In order to display graphics, it is necessary to substitute symbolic variables by numeric values.
> n_potls;e_grads;
> subs(kx=2,ky=2,alpha=45,e_velts);subs(kx=2,ky=2,alpha=45,n_velts);
> subs(kx=2,ky=2,alpha=45,n_fluxes);
> subs(kx=2,ky=2,alpha=45,n_kined);subs(kx=2,ky=2,alpha=45,total_kinetic_energy);
>