skade eaction ffusion ne-dimensional System - ZIB
skade eaction ffusion ne-dimensional System - ZIB
skade eaction ffusion ne-dimensional System - ZIB
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Tehnicl Repot TR 9-9 (July 193)<br />
Jens Lang<br />
<strong>skade</strong> <strong>eaction</strong> <strong>ffusion</strong><br />
<strong>ne</strong>-<strong>dimensional</strong> <strong>System</strong>
Jens Lang<br />
KARDOS — KA<strong>skade</strong> R<strong>eaction</strong> Di<strong>ffusion</strong><br />
O<strong>ne</strong>-<strong>dimensional</strong> <strong>System</strong><br />
Abstract. A software package for the adaptive solution of time-dependent<br />
r<strong>eaction</strong>-di<strong>ffusion</strong> systems and i<strong>ne</strong>ar elliptic systems in o<strong>ne</strong> space dimenson<br />
is presented. The used algorithm is based on fundamental arguments in<br />
LANG/WALTER [4]. Here, only brief outli<strong>ne</strong>s of the algorithm are given.<br />
This software package is based on the KASKADE olbox [3]<br />
Key words: Rothe method, embedded Runge-Kutta method, adaptiv<br />
ultilevl Fnite Element method.
Contents<br />
Introducti<br />
efng a problem<br />
eading ri<br />
ommad lngua<br />
For programmers oly 10<br />
efining a tim problem 10<br />
efining a time ntegrator 11<br />
Time integration process<br />
id manageent 17<br />
exampl<br />
er funtions for a population ecology odl 18<br />
efining he <strong>ne</strong>w probl 22<br />
oviding two omon arse grids 22<br />
alog wih the sysem<br />
efereces 25
haper<br />
ntroduction<br />
Usng the program KARDOS, sysems of semli<strong>ne</strong>ar parabolic initial boundary<br />
value problems of the for<br />
{x)ut ~ {D{X)U) F(u X G 0 C R\ t G [t t<br />
Ci(, ^GTiCön<br />
un + a(x)u £2(^ x x £ T2 C df<br />
u(tx) = u0(x<br />
are solvable. Here, u = (u u2,... ur) is a vector function The matrix<br />
function P(x) may vanish on subset of ft. The discretizaton is do<strong>ne</strong> by<br />
the Rothe method. In contrast to he widespread method of li<strong>ne</strong>s, time is<br />
discretized first than space. The main advantage of this sequence is the<br />
possibility o compute the pace discretizaton optimal during the time integration<br />
b an adaptiv multileve finite element method. Therefore the<br />
KASKADE toolbox is modified to handle o<strong>ne</strong>-<strong>dimensional</strong> problems. In<br />
KARDOS a special embedded Runge-Kutta method of order 32) has bee<br />
implemented. This method keeps its accuracy even in the case of ifferenial<br />
algebraic equations (P(x) = 0 somewhere).<br />
The above differetial equations can be reformulated into an abstract Cauchy<br />
problem poibl of differenal-algebraic type in an appropriate Hilbrt<br />
pace H<br />
Pu f(u u G H ,t e[tt<br />
u(0) = u0<br />
Now, a three-stage embedded Rosenbroc ethod for his pure tim problem<br />
looks as follows:<br />
{P ~ 7" r /«(«o))A;8 = r/(u0 + Yl a<br />
1.<br />
) + T f{uo Y l i = 1 3<br />
3=1 J=<br />
Uo +<br />
u0 + Y<br />
3 =<br />
1.3)
Yet this frm not suited to be implemented straight-forward, becuse<br />
along with function evaluations there are still matrix*vector producs on the<br />
ighhand ide. The ransformation<br />
leads to the <strong>ne</strong>w ysem<br />
/ "fi * — A<br />
1 \<br />
P-fu(u0) {u0 + J2 a J2— « = 1<br />
r 7 i=1 j=1<br />
uo ^ r (1.<br />
In KARDOS a special set of parameters, which guarantees L-stabiity of the<br />
chosen method, is used. Setting 711 = 722 = 733 := 7 only two function<br />
valuations and o<strong>ne</strong> matrix inversion are <strong>ne</strong>eded on the righthand side. The<br />
corresponding method was given by ROCHE [], who gives further sateent<br />
about convergence and consisteny.<br />
efficent<br />
0 . 5 2 8 4<br />
704526589 9 3 9 4 1<br />
7309 0.940143465<br />
09140443903 0.<br />
1.99625219 0.874044410<br />
1.99625219 4797<br />
0. 223756213<br />
ue to the drence of the pproximaed ues of er 3 and<br />
timeError := ||u (1-<br />
we have a good estimator of the main error term descibing the ocal error<br />
of the econd order method. The proposal for the <strong>ne</strong>w te ize is<br />
timeTol \<br />
afeFa — — 1-<br />
timeError
The nom whih KARDOS uses s a weighted L-no, giv by<br />
whe<br />
it<br />
uAbsi<br />
uRelMxi<br />
\\ u<br />
r-<br />
||«<br />
||^||o < f ^ i<br />
uAfe, < ||u||o < uRelMxi<br />
uRelM ||u<br />
ReM RTOL o ,<br />
uA6s ATOL * (O) 1 /<br />
:i-7)<br />
Scaling can be tur<strong>ne</strong>d on or off. If the scaled error norm is used, the tolerances<br />
RTOLi and ATOLi have to be seleced very carefully to reflect accurately<br />
the scale of the problem. The tolra<strong>ne</strong> ATOLi should indicate the absolute<br />
value at which the i-th compo<strong>ne</strong>nt is essentially insignifican. O the other<br />
hand, the value RTOLi affects the relative accuracy of the i-th compo<strong>ne</strong>nt<br />
with respect to its maximal value in time. This control turns out to be quite<br />
efficient and robust for a wid lass of problems. Howeer, it is cear that i<br />
is not a univeral mthod.<br />
To implement o<strong>ne</strong> time step, o<strong>ne</strong> elliptic proble has to be solved at each<br />
tage of the Rosenbrock method. This is do<strong>ne</strong> by means of an adaptiv<br />
ultilevel finite element method elaborated in recent years, see DEUFLHARD<br />
et al. []. This method is an excellent tool to adapt the space discretization<br />
for the current solution in uch a way, that a prescribed tolerance spaceTol<br />
is achieved. KARDOS uses standard li<strong>ne</strong>ar elements con<strong>ne</strong>cted with local<br />
error estimator of BABUSKA-HEINBOLDT [1] yp. We get at each tage,<br />
discretizations of the form<br />
B T v ) = n(v) e SnVvn e S i = 3 1.8)<br />
where Sn denotes the space of al ntinuous, piecewise li<strong>ne</strong>ar functions on<br />
partition An of 0, satisfying the Dirichlet boundary conditions. In S% hey<br />
vanish on the Dirichlet boundary. The equations only differ in the respective<br />
righthand id and in the pecial boundary conditions taken in onsider<br />
ation.
To cntrol the pace dicretiztion, we restrict urselves to the firt stage of<br />
the Rosenbrock method which is exactly the semiimplicit Euler method applied<br />
to the system (1.2). According to a local principle, on each current grid<br />
an error estimation is computed. Therefore we consider the corresponding<br />
elliptic differental equation on each element, imposng the urrent solution<br />
of the Euler method UE as boundary conditions, and solve it approximately<br />
by a quadratic finite element method. The difference ek between the li<strong>ne</strong>ar<br />
and quadratic approximation over the kth elent satisfies<br />
(e
paceTol<br />
The final grid is used for solving the other elliptc problems too. Only o<strong>ne</strong><br />
grid is appled for all unknowns of the ystem<br />
Setting the parameter globTol, KARDOS ontrols the space and time is<br />
retization due t he special tolerances<br />
aceTol = globTol/3.0 , timeTol = globTol/0 .<br />
This specific splitting results from the chosen parameters of the method. O<br />
the other hand, the parameters spaceTol and timTol allow specal tuning,<br />
desired. For more details see LANG/WALTER [4,]<br />
In the case of inconsisent sarting values for differential-algebraic systems<br />
it is possible to use an implicit Euler method in the firt time step coupled<br />
with a damped Newton thod.<br />
As a program, which handles a very ge<strong>ne</strong>ral class of problems, KARDOS<br />
cannot succed for all problems. Experiments have hown, that the compuations<br />
have often been improved settng the paramters ery carefully. In<br />
reme cases the iterativ olver may fail
haper<br />
efining roblem<br />
At first the user has to check that in the main file kardos.c the static param<br />
eter time is set t o<strong>ne</strong>. Next the desired number of equations noEqn used in<br />
he funcions<br />
nitProblemO'kardos",100,noEqn,250,FULL)<br />
nitTimeProblem("kardos",100,noEqn)<br />
to prepare the memory has to be inserted. At the momnt the maximal<br />
number is 10. It can be changed easly in nods.h settng the fixed parameter<br />
MAX_NODE_GROUPS.<br />
The actual problem is defi<strong>ne</strong>d by the functions<br />
Parabolic<br />
Laplace<br />
onvection<br />
elmholtz<br />
ource<br />
acobian<br />
nitialFunc<br />
auchy<br />
irichlet<br />
P(x)<br />
di<strong>ffusion</strong> matrix D(x)<br />
not carried out! (IGNORE)<br />
put in the righhand id (IGNORE<br />
force term F(u)<br />
jacobian of the force te (u<br />
initial values u0(x)<br />
boundary values ^2(t}x)}o(x<br />
boundary values £(tx)<br />
The procedur SetTimeProblem announces the problem defi<strong>ne</strong>d that way to<br />
he KARDOS toolbox. According to the fact, that o<strong>ne</strong> example is better<br />
han thousand explanatons, the reader is referred to sud ntensively the<br />
ile stdtimeprob.c.<br />
nt: etting time=0 KARDOS can also be used o solv systems of li<strong>ne</strong>ar<br />
liptic partial dfferential equations i o<strong>ne</strong> spac imenson omarabl to<br />
LLKASK [3]
haper<br />
din id<br />
KARDOS requires two common starting grids, which first have to be read<br />
with the help of the command readtri. During the computation o<strong>ne</strong> grid concerns<br />
the starting values, on the other grid he urrent solution is computed<br />
adaptively.<br />
Beside a geometrical descripton of the coarse space discretization, the sor<br />
of boundary conditions has to be declared. For that, the parameters B, I, D<br />
and C, which stand for Boundary, Interor, Dirichlet and Cauchy, are avail<br />
able. Furthermore, it's possible to characterize different subdomains through<br />
lassparameter. A ge<strong>ne</strong>ral input reads as follows:<br />
grid name<br />
Dimension:(numbe of points,number of edges<br />
point index:x-coordinate,B or I to characterize<br />
he location of the point, I or D or C to characterize<br />
he boundary conditions for all compo<strong>ne</strong>nts, classparamete<br />
to characterize a specal propery onl on the boundar<br />
END<br />
edge index:(left point index,right point index), cassparameter<br />
to characterize a special propery of a subdomain<br />
END<br />
n example oncerning two compo<strong>ne</strong>nts with mixed boundary conditions on<br />
[0,1] and two different materials in [0,0.) and (051] looks lik the following<br />
input stream<br />
xamplel<br />
Dimension: 4,3)<br />
0:0.B,DC,<br />
0.1,11<br />
2:0.1,11<br />
3:1.B,CD1<br />
END<br />
0,<br />
1,,0<br />
1<br />
ND<br />
In<strong>ne</strong>r boundary points are available.
haper<br />
C o n d ng<br />
All specal commands which K ARD OS <strong>ne</strong>eds for the time integration are ex<br />
plai<strong>ne</strong>d n the following. A list of all commands can be found in kardos.def<br />
All other ommands not explai<strong>ne</strong>d here are used as in KASKADE.<br />
KARDOS reads at the start a file kardos.startup which contains a sequence<br />
of ommands and executes these commands. If no quit is incuded, more<br />
ommands are requesed from sandard input.<br />
timeproblem<br />
A tim probl is selected.<br />
inftimeproblem<br />
informs about the urrent tim probl<br />
seliterate<br />
For the time i<strong>ne</strong>gration the paramters ssortim and stabtime are avail<br />
abl<br />
selrefi<strong>ne</strong><br />
For different refi<strong>ne</strong>ent the paramete anval or extrapol are available.<br />
seltimeinteg<br />
A time integrator is sected. The parameters rodas and euler are available.<br />
The Euler method can be used only for the sarting tep.<br />
timestepping<br />
This command corresponds to the solve-command of KASKADE. The tim<br />
i<strong>ne</strong>graton is carried out. The following parameters can be used:
verboseP<br />
scaling<br />
masteps nt<br />
tstart eal<br />
tend eal<br />
timestep eal<br />
globtol<br />
spacetol eal<br />
timetol eal<br />
itertol eal<br />
itermasteps nt<br />
showsol nt<br />
atoli eal<br />
rtoli eal<br />
Important da prnted. A he momnt,<br />
always true.<br />
ep size control: 0 absolute,<br />
1 for relative. If scaling is set to be 1, so<br />
all corresponding parameters atoli, rtoli<br />
il,2,...,number of unknowns have to be et too.<br />
umber of maximal tim teps<br />
starting tim<br />
final time<br />
initial ime ep<br />
accuracy demanded for the integrator (internal<br />
pacetol and timetol ar et automatically)<br />
desred space accurac<br />
desired time accuracy (if spacetol<br />
and timetol are selected, hen internal globtol<br />
is set)<br />
desred relative accuracy of he ierativ<br />
olver for the li<strong>ne</strong>ar sysems<br />
standard is 0.0001<br />
maximal number of iterations, standard is 1000<br />
graphic is plotted every Int seps, standard is 1<br />
i=l,...,number of unknowns, <strong>ne</strong>cessary input for<br />
every unknown to control the time step size<br />
relatively (scaling 1). The tolerance atol should<br />
ndicate the absolute value at which the<br />
corresponding compo<strong>ne</strong>nt is essntiall<br />
insignificant. The tolerance rtol affects<br />
the relative accurac with respect to the<br />
maximal value in time.
haper<br />
r o g e r only<br />
This chapter gives some information to get a feeling for the internal structur<br />
of the program Of course, it cannot mention all details. Furthermore<br />
for a better understanding it is <strong>ne</strong>cessary o read al header and c-files of<br />
K ARD OS very carefully.<br />
5.1 Defining a time problem<br />
To include all data of a initial boundary value problem two <strong>ne</strong>w data struc<br />
ures are added.<br />
struct timeProblem<br />
char *name;<br />
int (*Parabolic)(...);<br />
int (*Laplace)(...);<br />
int (*onvection)(...);<br />
int (*elmholtz)(...);<br />
int (*ource)(...);<br />
int (*Jacobian)(...);<br />
real (*InitialFunc)(...);<br />
int (*auchy)(...);<br />
int (*irichlet)(...);<br />
int (*ol)(...);<br />
struct timeProblemType<br />
char *name;<br />
int maxNoOfTimeProblems;<br />
int noOfEquations;<br />
The access to these srucures is realized by he pointers<br />
timeProblem *actTimeProblem, *timeProblems;<br />
timeProblemType *theTimeProblem;<br />
Furthermore, there are some functions t announc ertain problms within<br />
he program<br />
int etTimeProblem(char *name, char **varames<br />
int *Parabolic,<br />
10
A tim probl is announced.<br />
int *Laplace,<br />
int *onvection,<br />
int *elmholtz<br />
int *ource,<br />
int *acobian,<br />
real *InitialFunc,<br />
int *auchy,<br />
int *irichlet,<br />
int *ol)<br />
int SetStdTimeProblemsO<br />
ome standard time problems are announced.<br />
void SetTimeProblemAddressesO<br />
Special addresses are set to sect time problems within the ommand language.<br />
int nitTimeProblem(char *name,<br />
int noOfTimeProblems,<br />
int noOfEquations)<br />
The current timeProblemTyp-sructure is built up<br />
5.2 Defining a time integrato<br />
To defi<strong>ne</strong> a time integrator the ructure timentegMethod is used. It oniss<br />
of the following elements:<br />
char *name<br />
ame of the im ntegrator<br />
int verboseP<br />
ontrol of the informaton output, sandard: true<br />
int scaling<br />
ontrol of the nor for the time error, 0: absolute, 1: relativ<br />
int showSol<br />
ontrol of the picture plot, standard: 1
int nonNegativity<br />
ontrol of the non<strong>ne</strong>gativi of the olution, unused<br />
int noOfTimeteps<br />
number of the urrent tim teps<br />
int maxSteps<br />
aximal number of time steps<br />
int noOfStepReductions<br />
number of the time step reducons within an integraton tep<br />
int maxStepReductions<br />
maximal allowed im ep redtions within an integraton tep<br />
tandard:<br />
int stepTypePar<br />
differeiation from the starting step<br />
STAR_STEP: starting step, LATER_STEP: later sep<br />
int backDepth<br />
grid depth, on which ever olution process is sarted again, sandard: 0<br />
real time<br />
local starting time<br />
real <strong>ne</strong>wTime<br />
local nal tim<br />
real tEnd<br />
global final time<br />
real timeStep<br />
length of the time step<br />
real <strong>ne</strong>wTimeStep<br />
<strong>ne</strong>w propoed im ep
eal tRest<br />
emai<strong>ne</strong>d global im<br />
real gammaStab<br />
tabili arameter of the mthod<br />
real timeTol<br />
allowed olra<strong>ne</strong> of the local time error<br />
real spaceTol<br />
allowed olra<strong>ne</strong> of the local space error<br />
real globTol<br />
allowed olra<strong>ne</strong> of the global error<br />
real timeError<br />
urren ocal time error<br />
real globError<br />
urrent global error<br />
real trueError<br />
rue error if solution known, unused<br />
real normSol<br />
nor of the solution<br />
real timeStepFactor<br />
factor by which the old time step is divided<br />
real rho<br />
imeTolglobTol, standard:<br />
real maxTimeStep<br />
aximal time step, standard: 0.<br />
real timeStepSafe<br />
afety factor for the onrol of the tim tep, sandard:
eal spaceTolFac<br />
paceTolglobTol, sandard: 1.<br />
TRIANULATION *compTrian<br />
urren omputation grid<br />
TRIANGULATON *resultTrian<br />
grid for the sartng values<br />
int *InitTimenteg<br />
inializes the tim ntegraton process<br />
int *Timente<br />
ealizes the im ntegration proces<br />
int *CloseTimeInteg<br />
oses the im ntegration proces<br />
int *AssRhsl<br />
omputes the righthand side of the firs tage<br />
int *AssRhs2<br />
omputes the righthand side of the second sage<br />
int *AssRhs3<br />
omputes the righthand side of the thid stage<br />
problem *firstStage<br />
iptic problem of he firt stage<br />
problem *secondtage<br />
iptic problem of he second stage<br />
problem *thirdStage<br />
iptic problem of he third sage<br />
The access to the dfferent tim ntegrators is do<strong>ne</strong> by he pointe<br />
timentegMethod *actTimentegtor, *timenteMethods;
To bui up im ntegr the fllowing funcions a avable<br />
int fTimentegMethod(char *name,<br />
int *InitTimeInteg,<br />
int *TimeInteg,<br />
int *CloseTimenteg,<br />
char *nameFirstStage,<br />
char *nameSecondStage,<br />
char *nameThirdtage,<br />
int *sshsl,<br />
int *sshs2,<br />
int *AssRhs3,<br />
real spaceTolFactor,<br />
real gammatability)<br />
announces time i<strong>ne</strong>grator. Beside a name, functions for the realiza<br />
ion of the method (initTimenteg, Timenteg, loseTimelnteg), the<br />
corresponding elliptic problems ("nameFirstStage" , "nameSecondStage" ,<br />
"nameThirdStage") the functons for the computation of the righthand<br />
ides ssRhsl, AssRhs2, AssRhs3), the parameter spaceTolFac and the<br />
tabilit parameter gammaStab have to be inserted,<br />
uch as DefTimeIntegMethod("rodas",InitIntegtep,R°dasStep,lose<br />
ntegStep,"rodasl", "rodas2","rodas3",AssRHSodasl,ssRHS<br />
odas2,ssRHSodasTHIRDDAS_GA) .<br />
int SetStageProblemsO<br />
The elliptc problems occurring in each stage of the method are annou<strong>ne</strong>d<br />
within ettageProblems by calling the funcon etProblem.<br />
5.3 ime interaion process<br />
Picture 1 shows the whole process of he time integration method. The program<br />
comes to an end when the final time or the maximal step number are<br />
eached or when the maximal number of sep ize reducions wihin o<strong>ne</strong> <strong>ne</strong>graton<br />
ep is exceeded.
espping<br />
5.4 Grid managent<br />
The program KASKADE supports work with several grids which are con<strong>ne</strong>cted<br />
to a list. A time integration requires to exchange values on differently<br />
efi<strong>ne</strong>d grids. This leads to cos eek algorihms. To be more efective here,<br />
he srucure EDG is enlarged he <strong>ne</strong>w elent<br />
*twin<br />
If the considered edge exists in he other triangulation, then this elemen<br />
points at he corresponding element, otherwise it is nil. In the structur<br />
TRIANGULATION the <strong>ne</strong>w element int twinRelation stands for the e<br />
istence of such a relation between two triangulations.<br />
To work wih tw grids the folowing funcons can be used:<br />
int SetTwinRelOnCoarseGrids(TRIANGULATI *t,RIUL *t)<br />
inializes the twirelaton of two arse grids.<br />
DG *FindBrotherEdge(real ,EDG *edFrom<br />
nds the edge of the other grid n which a given poin ies.<br />
real InterpolateInEdge(real E *edn,int var,int inde<br />
gives back an nterpolated value.<br />
17
haper<br />
le<br />
In this chapte how how to add a <strong>ne</strong>w problem to the list of predefi<strong>ne</strong>d<br />
problems:<br />
defi<strong>ne</strong> a s of functions to characerize the inial boundary value probem<br />
add the problem to the list of predefi<strong>ne</strong>d problems (call etProblem,<br />
using nitUserTime in user. of the kardos-directory,<br />
add tw ommon car grids in the grids-directory,<br />
use kardos . startup for an automatic ommand language dialog wi<br />
the sysem<br />
6.1 ser functions for opulation ecolo del<br />
Let us olve the folowing equatons<br />
- 0.<br />
+ 1-u<br />
in the domain 0 ) for t > 0, with the boundary condons<br />
and the initial condition<br />
= 0 for t > x = 0 and x =<br />
5 for<br />
4x + 1 for<br />
-4x + 11 for<br />
for<br />
10 for<br />
4x + for<br />
-4x + for<br />
for<br />
18
This system of nonli<strong>ne</strong>ar equations modls a cerain planktonit predator<br />
prey suations in which crowding is a facor. The KARDOS user defi<strong>ne</strong>s in<br />
user. he following funtions:<br />
static int EcoParabolic(real x, int classA, real t, real *fVals,<br />
int equation, int variable)<br />
if (equation!=variable) return F_IGN0RE;<br />
switch (variable)<br />
{<br />
case 0: fVals[0] = 1.0;<br />
break;<br />
case 1: fVals[0] = 1.0;<br />
break;<br />
return F_C0ISTAIT;<br />
static int EcoLaplace(real x, int classA, real t, real *fVals,<br />
int equation, int variable)<br />
if (equation!=variable) return F_IGN0RE;<br />
switch (variable)<br />
{ case 0: fVals[0] = 0.0125;<br />
break;<br />
case 1: fVals[0] = 1.0;<br />
break;<br />
return F_C0ISTAIT;<br />
static int EcoConvection(real x, int classA, real t, real *fVal,<br />
int equation, int variable)<br />
return F_IGI0RE;<br />
static int EcoHelmholtz(real x, int classA, real t, real *fVal,<br />
int equation, int variable)<br />
return F_IGI0RE;<br />
static int EcoSource(real x, int classA, real t, EDG* ed,
eal valO, vail;<br />
real *fVal, int equation,<br />
real (*Func)(real,EDG*,int,timeIntegMethod*))<br />
switch (equation)<br />
{<br />
case 0: valO = Func(x,ed,0,actTimeIntegtor);<br />
vail = Func(x,ed,l,actTimeIntegtor);<br />
fVal[0] = ((35.0+16.0*val0-val0*val0)/9.0-vall)*val0;<br />
break;<br />
case 1: valO = Func(x,ed,0,actTimeIntegtor);<br />
vail = Func(x,ed,l,actTimeIntegtor);<br />
fVal[0] = (val0-1.0-0.4*vall)*vall;<br />
break;<br />
return F_VARIABLE;<br />
static int EcoJacobian(real x, int classA, real t, EDG* ed, real *fVal,<br />
int equation, int variable,<br />
real (*Func)(real,EDG*,int,timeIntegMethod*))<br />
real valO, vail;<br />
switch (equation)<br />
{<br />
case 0: if (variable==0)<br />
{<br />
valO = Func(x,ed,0,actTimeIntegtor);<br />
vail = Func(x,ed,l,actTimeIntegtor);<br />
fVal[0] = (35.0+32.0*val0-3.0*val0*val0)/9.0-vall;<br />
else if (variable==l)<br />
{<br />
vail = Func(x,ed,l,actTimeIntegtor);<br />
fVal[0] = -vail;<br />
else <strong>ZIB</strong>StdOut("error in EcoJacobian\n");<br />
break;<br />
case 1: if (variable==0)<br />
{<br />
vail = Func(x,ed,l,actTimeIntegtor);<br />
fVal[0] = vail;
eturn F_VARIABLE;<br />
else if (variable==l)<br />
{<br />
valO = Func(x,ed,0,actTimeIntegtor);<br />
vail = Func(x,ed,l,actTimeIntegtor);<br />
fVal[0] = val0-1.0-0.*vall;<br />
else <strong>ZIB</strong>StdOut("error in EcoJacobian\n");<br />
break;<br />
static real EcoInitialFunc(real x, int classA, int variable)<br />
{<br />
real val = 0.0;<br />
switch (variable)<br />
{<br />
case 0: if ((0.0
fVals[l] = 0.0; /* */<br />
else <strong>ZIB</strong>StdOutCerror in EcoCauchy\n");<br />
break;<br />
case 1: i ((x==0.0)I I(x==2.5))<br />
fVals[0] =0.0; /* Sigma */<br />
fVals[l] = 0.0; /* i */<br />
return F_COISTAIT;<br />
eise <strong>ZIB</strong>StdOutC"error in EcoCauchy\n");<br />
break;<br />
6.2 Defining the <strong>ne</strong>w problem<br />
ext we def<strong>ne</strong> the <strong>ne</strong>w problem wih the help of the following procedure<br />
int InitUserTimeQ<br />
{<br />
f (!SetTimeProblem("example1",varName,<br />
EcoParabolic,<br />
EcoLaplace,<br />
EcoConvection,<br />
EcoHelmholtz,<br />
EcoSource,<br />
EcoJacobian,<br />
EcoInitialFunc,<br />
EcoCauchy,<br />
EcoDirichlet,<br />
(int(*)(real,int,real,real*,int))nil));<br />
return true;<br />
A call of nitTimeUser is carried out automatically from he main program<br />
6.3 roviding tw como coar rid<br />
Now we inser two arse grids n the grids-decory using the files ecologyl<br />
and cology2<br />
ecologyl ecology2<br />
Dimension:(11,10) Dimension:(11,0)<br />
22
0 0.0,B,CC 0 0.0,B,CC<br />
1:0.25,1,11 1:0.25,1,11<br />
2:0.5,1,11 2:0.5,1,11<br />
3:0.5,1,11 3:0.5,1,11<br />
4:1.0,1,11 4:1.0,1,11<br />
5:1.25,1,11 5:1.25,1,11<br />
6:1.5,1,11 6:1.5,1,11<br />
:1.5,1,11 1.5,1,11<br />
:2.0,1,11 :2.0,1,11<br />
9:2.25,1,11 9:2.25,1,11<br />
0:2.5,B,CC 10:2.5,B,CC<br />
EID EID<br />
0 (0,1) 0 (0,1)<br />
1 (1,2) 1 (1,2)<br />
2 (2,3) 2 (2,3)<br />
3 (3,4) 3 (3,4)<br />
4 (4,5) 4 (4,5)<br />
5 (5,6) 5 (5,6)<br />
6 (6, 6 (6,<br />
( (<br />
(9) (9)<br />
9 (9,0) 9 (9,10)<br />
EID EID<br />
6.4 ialo with the ste<br />
KARDOS reads at the tart a file kardos.startup which contains a sequenc<br />
of commands and executes these commands. That way we get an automat<br />
dialog wih the system. Of course, a step-by-step ialog is available to.<br />
deposit in kardos.starup the following omands:<br />
read ../grids/ecologyl.g<br />
read ../grids/ecology2.g<br />
timeproblem examplel<br />
seliterate pbicgstabtime<br />
selmatmul sparse<br />
selestimate babuska<br />
selrefi<strong>ne</strong> meanval<br />
seltimeinteg rodas<br />
window <strong>ne</strong>w automatic name solutionl<br />
graphic solution triangulation<br />
seldraw 0<br />
window <strong>ne</strong>w automatic name solution2<br />
graphic solution triangulation
seldraw 1<br />
timesteppin timestep 0.0001 maxsteps 200 globTol 0.02 tEnd 10.0<br />
ow we can start the program
ferences<br />
Babus, W.C. Rheinboldt: Error estimas for adptive fin et<br />
comutons. SIAM J. Numer. Anal 15 p. 7364 (1978)<br />
] P. Deuflhard, P. Lei<strong>ne</strong>n, H. Yserentant: Concepts an Adaptie Herarcal<br />
F e Elen Code. IMPACT, , p. 3-3 1989)<br />
3] B. Erdmann, J. Lang, R. Roitzsch: KASKADE - Manual. To appear as<br />
Technical Report TR 93-5, Konrad-Zus-Zentrum (<strong>ZIB</strong>) (1993)<br />
[4] J. Lang, A. Walter: A Fnie Eent Method Adaptive n Space and<br />
Tim for Nonli<strong>ne</strong>ar R<strong>eaction</strong>-Dffuson <strong>System</strong>s. IMPAC of Comput<br />
ing Scence and Engi<strong>ne</strong>erng, , p. 9-314 (199<br />
] J. Lang, A Walter: An Adaptive Rothe Method for Nonli<strong>ne</strong>ar Reacon-<br />
Diffuson Sstms. Appled Numerial Mathematics 13 p. 1 1 4<br />
1993)<br />
M. Roche: Rosenbrock Methods for ifferenal Albraic Equatons.<br />
umer Math. 52, p. 4 (1<br />
Acknowledgements. I acknowledge R. Roitzsch for inspiring disussions<br />
on the field of programming and for making available always he urrent<br />
version of KASKADE. I also thank U. Nowak for supplying me wih referen<br />
olutions obtai<strong>ne</strong>d y his finite dffere<strong>ne</strong> method.