201 |
@param args: |
@param args: |
202 |
""" |
""" |
203 |
# COEFFICIENTS can be overwritten by subclasses: |
# COEFFICIENTS can be overwritten by subclasses: |
204 |
self.COEFFICIENTS={ |
self.__COEFFICIENTS={ |
205 |
"A" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM,PDECoefficient.SOLUTION,PDECoefficient.DIM),PDECoefficient.OPERATOR), |
"A" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM,PDECoefficient.SOLUTION,PDECoefficient.DIM),PDECoefficient.OPERATOR), |
206 |
"B" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM,PDECoefficient.SOLUTION),PDECoefficient.OPERATOR), |
"B" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM,PDECoefficient.SOLUTION),PDECoefficient.OPERATOR), |
207 |
"C" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.SOLUTION,PDECoefficient.DIM),PDECoefficient.OPERATOR), |
"C" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.SOLUTION,PDECoefficient.DIM),PDECoefficient.OPERATOR), |
215 |
"r" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.RIGHTHANDSIDE), |
"r" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.RIGHTHANDSIDE), |
216 |
"q" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.SOLUTION,),PDECoefficient.BOTH)} |
"q" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.SOLUTION,),PDECoefficient.BOTH)} |
217 |
|
|
218 |
|
self.COEFFICIENTS=self.__COEFFICIENTS |
219 |
# initialize attributes |
# initialize attributes |
220 |
self.__debug=None |
self.__debug=None |
221 |
self.__domain=domain |
self.__domain=domain |
277 |
""" |
""" |
278 |
return self.COEFFICIENTS.has_key(name) |
return self.COEFFICIENTS.has_key(name) |
279 |
|
|
280 |
|
def hasPDECoefficient(self,name): |
281 |
|
""" |
282 |
|
return true if name is the name of a coefficient |
283 |
|
|
284 |
|
@param name: |
285 |
|
""" |
286 |
|
return self.__COEFFICIENTS.has_key(name) |
287 |
|
|
288 |
def getFunctionSpaceForEquation(self): |
def getFunctionSpaceForEquation(self): |
289 |
""" |
""" |
290 |
return true if the test functions should use reduced order |
return true if the test functions should use reduced order |
319 |
""" |
""" |
320 |
return escript.Data(0,self.getShapeOfCoefficient(name),self.getFunctionSpaceForCoefficient(name)) |
return escript.Data(0,self.getShapeOfCoefficient(name),self.getFunctionSpaceForCoefficient(name)) |
321 |
|
|
322 |
|
def createNewCoefficientOfPDE(self,name): |
323 |
|
""" |
324 |
|
returns a new coefficient appropriate for coefficient name: |
325 |
|
""" |
326 |
|
return escript.Data(0,self.getShapeOfCoefficientOfPDE(name),self.getFunctionSpaceForCoefficientOfPDE(name)) |
327 |
|
|
328 |
|
def getShapeOfCoefficientOfPDE(self,name): |
329 |
|
""" |
330 |
|
return the shape of the coefficient name |
331 |
|
|
332 |
|
@param name: |
333 |
|
""" |
334 |
|
if self.hasPDECoefficient(name): |
335 |
|
return self.__COEFFICIENTS[name].buildShape(self.getNumEquations(),self.getNumSolutions(),self.getDomain().getDim()) |
336 |
|
else: |
337 |
|
raise ValueError,"Unknown coefficient %s requested"%name |
338 |
|
|
339 |
|
def getFunctionSpaceForCoefficientOfPDE(self,name): |
340 |
|
""" |
341 |
|
return the atoms of the coefficient name |
342 |
|
|
343 |
|
@param name: |
344 |
|
""" |
345 |
|
if self.hasPDECoefficient(name): |
346 |
|
return self.__COEFFICIENTS[name].getFunctionSpace(self.getDomain()) |
347 |
|
else: |
348 |
|
raise ValueError,"unknown coefficient %s requested"%name |
349 |
|
|
350 |
def getShapeOfCoefficient(self,name): |
def getShapeOfCoefficient(self,name): |
351 |
""" |
""" |
356 |
if self.hasCoefficient(name): |
if self.hasCoefficient(name): |
357 |
return self.COEFFICIENTS[name].buildShape(self.getNumEquations(),self.getNumSolutions(),self.getDomain().getDim()) |
return self.COEFFICIENTS[name].buildShape(self.getNumEquations(),self.getNumSolutions(),self.getDomain().getDim()) |
358 |
else: |
else: |
359 |
raise ValueError,"Solution coefficient %s requested"%name |
raise ValueError,"Unknown coefficient %s requested"%name |
360 |
|
|
361 |
def getFunctionSpaceForCoefficient(self,name): |
def getFunctionSpaceForCoefficient(self,name): |
362 |
""" |
""" |
367 |
if self.hasCoefficient(name): |
if self.hasCoefficient(name): |
368 |
return self.COEFFICIENTS[name].getFunctionSpace(self.getDomain()) |
return self.COEFFICIENTS[name].getFunctionSpace(self.getDomain()) |
369 |
else: |
else: |
370 |
raise ValueError,"Solution coefficient %s requested"%name |
raise ValueError,"unknown coefficient %s requested"%name |
371 |
|
|
372 |
def alteredCoefficient(self,name): |
def alteredCoefficient(self,name): |
373 |
""" |
""" |
1347 |
|
|
1348 |
class to define a linear PDE of the form |
class to define a linear PDE of the form |
1349 |
\f[ |
\f[ |
1350 |
-(\lambda (u_{i,j}+u_{j,i}))_{,j} - \mu u_{j,ji}} = F_i -\sigma_{ij,j} |
-(\mu (u_{i,j}+u_{j,i}))_{,j} - \lambda u_{j,ji}} = F_i -\sigma_{ij,j} |
1351 |
\f] |
\f] |
1352 |
|
|
1353 |
with boundary conditons: |
with boundary conditons: |
1354 |
|
|
1355 |
\f[ |
\f[ |
1356 |
n_j(\lambda(u_{i,j}+u_{j,i})-sigma_{ij}) + n_i\mu u_{j,j} = f_i |
n_j(\mu (u_{i,j}+u_{j,i})-sigma_{ij}) + n_i\lambda u_{j,j} = f_i |
1357 |
\f] |
\f] |
1358 |
|
|
1359 |
and constraints: |
and constraints: |
1368 |
self.COEFFICIENTS={ |
self.COEFFICIENTS={ |
1369 |
"lame_lambda" : PDECoefficient(PDECoefficient.INTERIOR,(),PDECoefficient.OPERATOR), |
"lame_lambda" : PDECoefficient(PDECoefficient.INTERIOR,(),PDECoefficient.OPERATOR), |
1370 |
"lame_mu" : PDECoefficient(PDECoefficient.INTERIOR,(),PDECoefficient.OPERATOR), |
"lame_mu" : PDECoefficient(PDECoefficient.INTERIOR,(),PDECoefficient.OPERATOR), |
1371 |
"F" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM),PDECoefficient.RIGHTHANDSIDE), |
"F" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,),PDECoefficient.RIGHTHANDSIDE), |
1372 |
"sigma" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.EQUATION),PDECoefficient.RIGHTHANDSIDE), |
"sigma" : PDECoefficient(PDECoefficient.INTERIOR,(PDECoefficient.EQUATION,PDECoefficient.DIM),PDECoefficient.RIGHTHANDSIDE), |
1373 |
"f" : PDECoefficient(PDECoefficient.BOUNDARY,(PDECoefficient.EQUATION,),PDECoefficient.RIGHTHANDSIDE), |
"f" : PDECoefficient(PDECoefficient.BOUNDARY,(PDECoefficient.EQUATION,),PDECoefficient.RIGHTHANDSIDE), |
1374 |
"r" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.BOTH), |
"r" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.BOTH), |
1375 |
"q" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.BOTH)} |
"q" : PDECoefficient(PDECoefficient.CONTINUOUS,(PDECoefficient.EQUATION,),PDECoefficient.BOTH)} |
1391 |
@param name: |
@param name: |
1392 |
""" |
""" |
1393 |
if name == "A" : |
if name == "A" : |
1394 |
A =self.createNewCoefficient("A") |
out =self.createNewCoefficientOfPDE("A") |
1395 |
for i in range(self.getDim()): |
for i in range(self.getDim()): |
1396 |
for j in range(self.getDim()): |
for j in range(self.getDim()): |
1397 |
out[i,i,j,j] += self.getCoefficient("lame_mu") |
out[i,i,j,j] += self.getCoefficient("lame_lambda") |
1398 |
out[i,j,j,i] += self.getCoefficient("lame_lambda") |
out[i,j,j,i] += self.getCoefficient("lame_mu") |
1399 |
out[i,j,i,j] += self.getCoefficient("lame_lambda") |
out[i,j,i,j] += self.getCoefficient("lame_mu") |
1400 |
return out |
return out |
1401 |
elif name == "B" : |
elif name == "B" : |
1402 |
return escript.Data() |
return escript.Data() |
1424 |
raise SystemError,"unknown PDE coefficient %s",name |
raise SystemError,"unknown PDE coefficient %s",name |
1425 |
|
|
1426 |
# $Log$ |
# $Log$ |
1427 |
# Revision 1.9 2005/07/25 05:28:13 jgs |
# Revision 1.10 2005/08/12 01:45:36 jgs |
1428 |
# Merge of development branch back to main trunk on 2005-07-25 |
# erge of development branch dev-02 back to main trunk on 2005-08-12 |
1429 |
# |
# |
1430 |
# Revision 1.8 2005/06/09 05:37:59 jgs |
# Revision 1.9.2.1 2005/07/29 07:10:27 gross |
1431 |
# Merge of development branch back to main trunk on 2005-06-09 |
# new functions in util and a new pde type in linearPDEs |
1432 |
# |
# |
1433 |
# Revision 1.7 2005/05/06 04:26:10 jgs |
# Revision 1.1.2.25 2005/07/28 04:21:09 gross |
1434 |
# Merge of development branch back to main trunk on 2005-05-06 |
# Lame equation: (linear elastic, isotropic) added |
1435 |
# |
# |
1436 |
# Revision 1.1.2.24 2005/07/22 06:37:11 gross |
# Revision 1.1.2.24 2005/07/22 06:37:11 gross |
1437 |
# some extensions to modellib and linearPDEs |
# some extensions to modellib and linearPDEs |