# Diff of /trunk/escript/py_src/linearPDEs.py

revision 141 by jgs, Thu Jun 9 05:38:05 2005 UTC revision 142 by jgs, Mon Jul 25 05:28:20 2005 UTC
1240
1241  class Poisson(LinearPDE):  class Poisson(LinearPDE):
1242     """     """
1243     Class to define a Poisson equstion problem:     Class to define a Poisson equation problem:
1244
1245     class to define a linear PDE of the form     class to define a linear PDE of the form
1246     \f[     \f[
# Line 1269  class Poisson(LinearPDE): Line 1269  class Poisson(LinearPDE):
1269         self.setValue(f,q)         self.setValue(f,q)
1270
1271     def setValue(self,f=escript.Data(),q=escript.Data()):     def setValue(self,f=escript.Data(),q=escript.Data()):
1272           """set value of PDE parameters f and q"""
1273         self._LinearPDE__setValue(f=f,q=q)         self._LinearPDE__setValue(f=f,q=q)
1274
1275     def getCoefficientOfPDE(self,name):     def getCoefficientOfPDE(self,name):
# Line 1304  class Poisson(LinearPDE): Line 1305  class Poisson(LinearPDE):
1305       else:       else:
1306           raise SystemError,"unknown PDE coefficient %s",name           raise SystemError,"unknown PDE coefficient %s",name
1307
1308    class LameEquation(LinearPDE):
1309       """
1310       Class to define a Lame equation problem:
1311
1312       class to define a linear PDE of the form
1313       \f[
1314       -(\lambda (u_{i,j}+u_{j,i}))_{,j} - \mu u_{j,ji}} = F_i -\sigma_{ij,j}
1315       \f]
1316
1317       with boundary conditons:
1318
1319       \f[
1320       n_j(\lambda(u_{i,j}+u_{j,i})-sigma_{ij}) + n_i\mu u_{j,j} = f_i
1321       \f]
1322
1323       and constraints:
1324
1325       \f[
1327       \f]
1328       """
1329
1330       def __init__(self,domain,f=escript.Data(),q=escript.Data()):
1331           LinearPDE.__init__(self,domain,domain.getDim(),domain.getDim())
1332           self.COEFFICIENTS={
1333           "lame_lambda"  : PDECoefficient(PDECoefficient.INTERIOR,(),PDECoefficient.OPERATOR),
1334           "lame_mu"      : PDECoefficient(PDECoefficient.INTERIOR,(),PDECoefficient.OPERATOR),
1335           "F"            : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM),PDECoefficient.RIGHTHANDSIDE),
1336           "sigma"        : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.EQUATION),PDECoefficient.RIGHTHANDSIDE),
1337           "f"            : PDECoefficient(PDECoefficient.BOUNDARY,(PDECoefficient.EQUATION,),PDECoefficient.RIGHTHANDSIDE),
1338           "r"            : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.BOTH),
1339           "q"            : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.BOTH)}
1340           self.setSymmetryOn()
1341
1342       def setValue(self,lame_lambda=escript.Data(),lame_mu=escript.Data(),F=escript.Data(),sigma=escript.Data(),f=escript.Data(),r=escript.Data(),q=escript.Data()):
1343           """set value of PDE parameters"""
1344           self._LinearPDE__setValue(lame_lambda=lame_lambda, \
1345                                     lame_mu=lame_mu, \
1346                                     F=F, \
1347                                     sigma=sigma, \
1348                                     f=f, \
1349                                     r=r, \
1350                                     q=q)
1351       def getCoefficientOfPDE(self,name):
1352         """
1353         return the value of the coefficient name of the general PDE
1354
1355         @param name:
1356         """
1357         if name == "A" :
1358             A =self.createNewCoefficient("A")
1359             for i in range(self.getDim()):
1360               for j in range(self.getDim()):
1361                 out[i,i,j,j] += self.getCoefficient("lame_mu")
1362                 out[i,j,j,i] += self.getCoefficient("lame_lambda")
1363                 out[i,j,i,j] += self.getCoefficient("lame_lambda")
1364             return out
1365         elif name == "B" :
1366             return escript.Data()
1367         elif name == "C" :
1368             return escript.Data()
1369         elif name == "D" :
1370             return escript.Data()
1371         elif name == "X" :
1372             return self.getCoefficient("sigma")
1373         elif name == "Y" :
1374             return self.getCoefficient("F")
1375         elif name == "d" :
1376             return escript.Data()
1377         elif name == "y" :
1378             return self.getCoefficient("f")
1379         elif name == "d_contact" :
1380             return escript.Data()
1381         elif name == "y_contact" :
1382             return escript.Data()
1383         elif name == "r" :
1384             return self.getCoefficient("r")
1385         elif name == "q" :
1386             return self.getCoefficient("q")
1387         else:
1388             raise SystemError,"unknown PDE coefficient %s",name
1389
1390  # $Log$  # $Log$
1391    # Revision 1.9  2005/07/25 05:28:13  jgs
1392    # Merge of development branch back to main trunk on 2005-07-25
1393    #
1394  # Revision 1.8  2005/06/09 05:37:59  jgs  # Revision 1.8  2005/06/09 05:37:59  jgs
1395  # Merge of development branch back to main trunk on 2005-06-09  # Merge of development branch back to main trunk on 2005-06-09
1396  #  #
1397  # Revision 1.7  2005/05/06 04:26:10  jgs  # Revision 1.7  2005/05/06 04:26:10  jgs
1398  # Merge of development branch back to main trunk on 2005-05-06  # Merge of development branch back to main trunk on 2005-05-06
1399  #  #
1400    # Revision 1.1.2.24  2005/07/22 06:37:11  gross
1401    # some extensions to modellib and linearPDEs
1402    #
1403  # Revision 1.1.2.23  2005/05/13 00:55:20  cochrane  # Revision 1.1.2.23  2005/05/13 00:55:20  cochrane
1404  # Fixed up some docstrings.  Moved module-level functions to top of file so  # Fixed up some docstrings.  Moved module-level functions to top of file so
1405  # that epydoc and doxygen can pick them up properly.  # that epydoc and doxygen can pick them up properly.

Legend:
 Removed from v.141 changed lines Added in v.142