Changeset 8059d4 in git
- Timestamp:
- Oct 14, 2010, 8:14:08 PM (14 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 9de0abdbc641e8e514442aa3e70a7c66cca9819a
- Parents:
- 3247105d0e1b88a132678cae369bf4353e95ba14
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/findiff.lib
r324710 r8059d4 1 //2 //3 1 ////////////////////////////////////////////////////////////////////////////// 4 2 version="$Id$"; … … 9 7 AUTHOR: Christian Dingler 10 8 11 NOTE: 12 9 OVERVIEW: 10 @texinfo 13 11 Using @code{qepcad}/@code{qepcadsystem} from this 14 12 library requires the program @code{qepcad} to be installed. … … 18 16 19 17 PROCEDURES: 20 visualize(f); shows a scheme in index-notation21 u(D[,#]); gives some vector; depends on @derivatives18 visualize(f); shows a scheme in index-notation 19 u(D[,#]); gives some vector; depends on @derivatives 22 20 scheme([v1,..,vn]); computes the finite difference scheme defined by v1,..,vn 23 21 laxfrT(Ut,U,space); Lax-Friedrich-approximation for the time-direction 24 22 laxfrX(Ux,U,space); Lax-Friedrich-approximation for the space-direction 25 23 forward(U1,U2,VAR); forward-approximation 26 backward(U1,U2,VAR); 27 central1st(U1,U2,VAR); 28 central2nd(U1,U2,VAR); 29 trapezoid(U1,U2,VAR); 30 midpoint(U1,U2,VAR); 24 backward(U1,U2,VAR); backward-approximation 25 central1st(U1,U2,VAR); central-approximation of first order 26 central2nd(U1,U2,VAR); central-approximation of second order 27 trapezoid(U1,U2,VAR); trapezoid-approximation 28 midpoint(U1,U2,VAR); midpoint-approximation 31 29 pyramid(U1,U2,VAR); pyramid-approximation 32 30 setinitials(variable,der[,#]); constructs and sets the basering for further computations 33 31 errormap(f); performs the Fouriertransformation of a poly 34 matrixsystem(M atrices,Approx); gives the scheme of a pde-system as one matrix32 matrixsystem(M,A); gives the scheme of a pde-system as one matrix 35 33 timestep(M); gives the several timelevels of a scheme derived from a pde-system 36 fouriersystem(M atrices,Approx); performs the Fouriertransformation of a matrix scheme34 fouriersystem(M,A); performs the Fouriertransformation of a matrix scheme 37 35 PartitionVar(f,n); partitions a poly into the var(n)-part and the rest 38 ComplexValue(f); computes the complex value of f, var(1) being the imaginary unit 39 VarToPar(f); substitute var(i) by par(i) 40 ParToVar(f); substitute par(i) by var(i) 41 qepcad(f); ask QEPCAD for equivalent constraints to f<1 42 qepcadsystem(l); ask QEPCAD for equivalent constraints to all eigenvals of some matrices being <1 36 ComplexValue(f); computes the complex value of f, var(1) being the imaginary unit 37 VarToPar(f); substitute var(i) by par(i) 38 ParToVar(f); substitute par(i) by var(i) 39 qepcad(f); ask QEPCAD for equivalent constraints to f<1 40 qepcadsystem(l); ask QEPCAD for equivalent constraints to all eigenvals of some matrices being <1 41 "; 43 42 44 45 ";46 43 LIB "ring.lib"; 47 44 LIB "general.lib"; … … 125 122 ///////////////////////////////////// 126 123 proc u(D,list #) 127 "USAGE: 128 RETURN: 124 "USAGE: u(D[,#]); D a string that occurs in the list of @derivatives, # an optional list of integers. 125 RETURN: type vector; gives the vector, that corresponds with gen(n)*m, where m is the monomial defined by # 129 126 EXAMPLE: example u; shows an example 130 127 " … … 203 200 /////////////////////////////////////////////// 204 201 proc scheme(list #) 205 "USAGE: scheme([v1,..,vn]); v1,..,vn of type vector 206 RETURN: type poly; performs substitutions by the means of Groebner Basis computation of the module generated by the input vectors, then intersects the intermediate result with the suitable component in order to get a finite difference scheme; 207 NOTE: works only for a single pde, for the case of a system use matrixsystem 208 EXAMPLE: example scheme; shows an example 202 "USAGE: scheme([v1,..,vn]); v1,..,vn of type vector 203 RETURN: poly 204 PURPOSE: performs substitutions by the means of Groebner basis computation 205 of the submodule, generated by the input vectors, then intersects the 206 intermediate result with the suitable component in order to get a finite 207 difference scheme 208 NOTE: works only for a single PDE, for the case of a system use @code{matrixsystem} 209 EXAMPLE: example scheme; shows an example 209 210 " 210 211 { … … 270 271 "USAGE: laxfrT(U1,U2,var); U1, U2 are the names of occuring derivatives, var is a variable in the basering; 271 272 RETURN: type vector; gives a predefined approximation of the Lax-Friedrich-approximation for the derivation in the timevariable as often used in literature; 272 NOTE: see also laxfrX, setinitials,scheme; WARNING: laxfrT is not to be interchanged with laxfrX273 NOTE: see also laxfrX, setinitials, scheme; Warning: laxfrT is not to be interchanged with laxfrX 273 274 EXAMPLE: example laxfrT; shows an example 274 275 " … … 291 292 //////////////////////// 292 293 proc laxfrX(string Ux, string U, poly space) 293 "USAGE: 294 RETURN: 295 NOTE: see also laxfrT,setinitials,scheme; WARNING: laxfrT is not to be interchanged with laxfrX296 EXAMPLE: 297 " 298 { 299 poly dspace =diffpar(space);294 "USAGE: laxfrX(U1,U2,var); U1, U2 are the names of occuring derivatives, var is a variable in the basering; 295 RETURN: type vector; gives a predefined approximation of the Lax-Friedrich-approximation for the derivation in one of the spatial variables as often used in literature; 296 NOTE: see also laxfrT, setinitials, scheme; Warning: laxfrX is not to be interchanged with laxfrT 297 EXAMPLE: example laxfrX; shows an example 298 " 299 { 300 poly dspace = diffpar(space); 300 301 def v=2*dspace*space*u(Ux)-(space**2-1)*u(U); 301 302 return(v); … … 530 531 proc setinitials(list variable, list der,list #) 531 532 "USAGE: setinitials(V,D[,P]); V,D,P are lists with strings as elements 532 RETURN: no return value: sets the dependence order of the occuring derivatives, constructs the suitable ring to compute in containing user chosen parameters, sets new basering 533 NOTE: P is optional, used to introduce some additional parameters into the ring. The SINE and COSINE values needed for the fouriertransformation are symbolically introduced under the names string(c)+nameof(variable), i.e. if x is any spatial variable then cx:=cosine(dx*ksi), when regarding the fouriertransform after ksi (for sine respectively). Artificial parameters I,T,Px,Py are introduced for the later eigenvalue analysis -> variables can be transformed into parameters of similar name 533 RETURN: no return value: sets the dependence order of the occuring derivatives, 534 constructs the suitable ring to compute in containing user chosen parameters, sets new basering 535 NOTE: P is optional, used to introduce some additional parameters into the ring. The Sine and 536 Cosine values needed for the fourier transformation are symbolically introduced under the names 537 string(c)+nameof(variable), i.e. if x is any spatial variable then cx:=cosine(dx*ksi), when 538 regarding the fourier transform after ksi (for sine respectively). Artificial parameters I,T,Px,Py 539 are introduced for the later eigenvalue analysis. Variables can be transformed into parameters 540 of similar name 534 541 EXAMPLE: example setinitials; shows an example 535 542 " … … 593 600 qring R=std(Id); 594 601 setring R; 602 // comment by VL: it's better to return this ring! causes many changes 603 // across the library 595 604 export(R); 596 605 exportto(Top,basering); … … 857 866 example 858 867 { 859 "EXAMPLE:" echo=2;868 "EXAMPLE:"; echo=2; 860 869 list D="Ut","Ux","Uy","U"; 861 870 list V="t","x","y"; … … 1067 1076 " 1068 1077 { 1078 // how to test, whether QEPCAD is installed? 1079 createQCfilter(); // creates/overwrites qepcadfilter.pl 1069 1080 system("sh","rm -f QEPCAD-out"); 1070 1081 system("sh","rm -f QEPCAD-in"); … … 1141 1152 } 1142 1153 /////////////////////////////////////////// 1154 proc createQCfilter() 1155 { 1156 // writes the following to the file qepcadfilter.pl 1157 // is there already such a file? remove it! 1158 system("sh","rm -f qepcadfilter.pl"); 1159 link l=":w qepcadfilter.pl"; 1160 write(l, "#!/usr/bin/perl"); 1161 write(l, "$flag = 0;"); 1162 write(l, "$res = \"\";"); 1163 write(l,"while(<>)"); 1164 write(l,"{ if ($_ =~ /Warning|WARNING|warning|Error|error|ERROR/) { print $_; }"); 1165 write(l,"elsif ($_ =~ /An\ equivalent/) { $flag = 1; }"); 1166 write(l,"elsif ($flag == 1 && $_ ne \"\n\") { print $_; $flag = 0; } }"); 1167 } 1168 1169 /////////////////////////////////////////// 1143 1170 proc qepcadsystem(list l) 1144 "USAGE: qepcadsytem(f); l a list; 1145 RETURN: type list; gives back some constraints that are equivalent to the eigenvalues of the matrices in the list l being < 1 (computed by QEPCAD); 1171 "USAGE: qepcadsytem(f); l a list; 1172 RETURN: list 1173 PURPOSE: gives back some constraints that are equivalent to the 1174 eigenvalues of the matrices in the list l being < 1 (computed by QEPCAD) 1146 1175 EXAMPLE: example qepcadsystem; shows an example 1147 1176 " 1148 1177 { 1178 // how to test, whether QEPCAD is installed? 1179 createQCfilter(); // creates/overwrites qepcadfilter.pl 1149 1180 system("sh","rm -f QEPCAD-out"); 1150 1181 system("sh","rm -f QEPCAD-in"); … … 1207 1238 if(size(output)==0) 1208 1239 { 1209 return("Try manually"); //maybe too few cells1240 ERROR("Try manually"); //maybe too few cells 1210 1241 } 1211 1242 if(find(output,"FALSE")!=0) 1212 1243 { 1213 return("FALSE");1244 ERROR("FALSE"); 1214 1245 } 1215 1246 if(find(output,"WARNING")!=0) 1216 1247 { 1217 return("WARNING! Try manually");1248 ERROR("WARNING! Try manually"); 1218 1249 } 1219 1250 else
Note: See TracChangeset
for help on using the changeset viewer.