Documents

Home QuickStart Guide User's Guide Commands reference

There are awnsering for some common questions:


Q1. How to write a Maple worksheet ?

There are some examples of Maple worksheet that included in the distribution package. Those can be used as a template for new problems. In this document we will show steps to create a simple worksheet. The problem is going to simulated here is a diffusion problem of a scalar \theta.

u=...

In order to solve this equation you can do the following steps:

  1. Including femLEGO library.
  2. Define equations
  3. Define variables
  4. Define Dirichlet boundary conditions
  5. Specify input
  6. Specify initial conditions
  7. Specify output
  8. Specify linear algebra solvers
  9. Creating the core of the solver
  10. Recreate only BoundaryInt

1. Including femLego library

The femLego functions are included to Maple worksheet by using the commands bellow. Actually, the only file ../femLegoLib/maple_src/femlego.m is readed.

>    restart;
read(femLego);

2. Equations

>    # diffusion equation
teq:=ElementInt(phi(x,y,z)*(theta[1](x,y,z)-theta[0](x,y,z))/dt )
= -1/Pe*ElementInt(nab(phi(x,y,z))[n] &t nab(theta[1](x,y,z))[n]);

teq := ElementInt(phi(x,y,z)*(theta[1](x,y,z)-theta[0](x,y,z))/dt) = -1/Pe*ElementInt(diff(phi(x,y,z),x)*diff(theta[1](x,y,z),x)+diff(phi(x,y,z),y)*diff(theta[1](x,y,z),y)+diff(phi(x,y,z),z)*diff(theta...
teq := ElementInt(phi(x,y,z)*(theta[1](x,y,z)-theta[0](x,y,z))/dt) = -1/Pe*ElementInt(diff(phi(x,y,z),x)*diff(theta[1](x,y,z),x)+diff(phi(x,y,z),y)*diff(theta[1](x,y,z),y)+diff(phi(x,y,z),z)*diff(theta...

3. Define variables

>    eq_list := [teq]:
unknown_list := [theta[1](x,y,z)]:
old_unknown_list := [theta[0](x,y,z)]:
params_list := [Pe]:

4. Dirichlet boundary conditions

>    mkDirBC([],unknown_list,old_unknown_list, params_list,`3DP1_tetra_bsf`);

adddbc.f
SPdirb

5. Specify input

>    # Get files to read input from meshfile.gambit and indata files
# An indata_sample will be created with the coresponding input parameters
GambitTetraInput(params_list);

rdinpt.c
rdpara.c
indata_sample

6. Initial conditions

>    # Variables that do not enter in lhs of an ic_eqlst are given the intial value 0:
ic_eqlst:=[]:
mkICcopy(ic_eqlst, unknown_list, params_list,`3DP1_tetra_bsf`);

ic_init

7. Specify output

>    # Specify the output variables and set name for them
>    plotlist:=[theta[1](x,y,z)]:
menulist:=[theta]:
OpenDXPlotP1(plotlist,menulist,unknown_list,params_list,tetrahedra);

wroutp();
outputresults();

8. Specify linear algebra solvers

>    # set up different solvers to use with different equations:
solve_list:=[gmres]:
mkSolve(solve_list,eq_list);

solve.c;

9. Create the core of the solver

The command mkFem is used to build the actual solvers for the equations in the list (eq_list). This function also needs to known the name of the test function that it was used on the equations - phi(x,y,z), and the file containing the element definitions (3DP1_tetra_bsf)
>    # create residual computations etc.
size_parameters:=mkFem(eq_list, unknown_list,
old_unknown_list, params_list, phi(x,y,z), `3DP1_tetra_bsf`);

mkresi
amedsp
adidsp
addr1
addm1
grbcrs
bdebsp
addini
include/size.h
include/csize.h
changing jacobians list:
true
size_parameters := [1,4,3]

10. Recreate only BoundaryInt

>    # redo only boundary integrals if desired;
size_parameters:=mkBCInt(eq_list, unknown_list,
old_unknown_list, params_list, phi(x,y,z), `3DP1_tetra_bsf`);

adbr1
adbm1
grbcrs
bdedsp
size_parameters := 3







Mechanics Department, KTH
Stockholm 2005
minh@mech.kth.se

Update: 2005-01-01