215 |
GMRES=util.GMRES |
GMRES=util.GMRES |
216 |
PRES20=util.PRES20 |
PRES20=util.PRES20 |
217 |
|
|
218 |
def __init__(self,**args): |
def __init__(self,domain,numEquations=0,numSolutions=0): |
219 |
""" |
""" |
220 |
@brief initializes a new linear PDE. |
@brief initializes a new linear PDE. |
221 |
|
|
224 |
|
|
225 |
# initialize attributes |
# initialize attributes |
226 |
self.__debug=None |
self.__debug=None |
227 |
self.__domain=None |
self.__domain=domain |
228 |
self.__numEquations=0 |
self.__numEquations=numEquations |
229 |
self.__numSolutions=0 |
self.__numSolutions=numSolutions |
230 |
self.cleanCoefficients() |
self.cleanCoefficients() |
231 |
|
|
232 |
self.__operator=escript.Operator() |
self.__operator=escript.Operator() |
236 |
self.__solution=escript.Data() |
self.__solution=escript.Data() |
237 |
self.__solution_isValid=False |
self.__solution_isValid=False |
238 |
|
|
|
# check the arguments |
|
|
coef={} |
|
|
for arg in args.iterkeys(): |
|
|
if arg=="domain": |
|
|
self.__domain=args[arg] |
|
|
elif arg=="numEquations": |
|
|
self.__numEquations=args[arg] |
|
|
elif arg=="numSolutions": |
|
|
self.__numSolutions=args[arg] |
|
|
elif _PDECoefficientTypes.has_key(arg): |
|
|
coef[arg]=args[arg] |
|
|
else: |
|
|
raise ValueError,"Illegal argument %s"%arg |
|
|
|
|
|
# get the domain of the PDE |
|
|
self.__domain=identifyDomain(self.__domain,coef) |
|
|
|
|
239 |
# set some default values: |
# set some default values: |
240 |
self.__homogeneous_constraint=True |
self.__homogeneous_constraint=True |
241 |
self.__row_function_space=escript.Solution(self.__domain) |
self.__row_function_space=escript.Solution(self.__domain) |
245 |
self.__matrix_type=self.__domain.getSystemMatrixTypeId(util.DEFAULT_METHOD,False) |
self.__matrix_type=self.__domain.getSystemMatrixTypeId(util.DEFAULT_METHOD,False) |
246 |
self.__sym=False |
self.__sym=False |
247 |
self.__lumping=False |
self.__lumping=False |
|
self.__numEquations=0 |
|
|
self.__numSolutions=0 |
|
|
# now we can set the ceofficients: |
|
|
self._setCoefficient(**coef) |
|
248 |
|
|
249 |
def getCoefficient(self,name): |
def getCoefficient(self,name): |
250 |
""" |
""" |
260 |
|
|
261 |
@param coefficients |
@param coefficients |
262 |
""" |
""" |
263 |
self._setCoefficient(**coefficients) |
self._setValue(**coefficients) |
264 |
|
|
265 |
|
|
266 |
def _setCoefficient(self,**coefficients): |
def _setValue(self,**coefficients): |
267 |
""" |
""" |
268 |
@brief sets new values to coefficients |
@brief sets new values to coefficients |
269 |
|
|
282 |
else: |
else: |
283 |
alteredCoefficients[i]=escript.Data(d,self.getFunctionSpaceOfCoefficient(i)) |
alteredCoefficients[i]=escript.Data(d,self.getFunctionSpaceOfCoefficient(i)) |
284 |
else: |
else: |
285 |
if self.__numEquations>0 and self.__numSolutions>0: |
alteredCoefficients[i]=escript.Data(d,self.getFunctionSpaceOfCoefficient(i)) |
|
alteredCoefficients[i]=escript.Data(d,self.getShapeOfCoefficient(i),self.getFunctionSpaceOfCoefficient(i)) |
|
|
else: |
|
|
alteredCoefficients[i]=escript.Data(d,self.getFunctionSpaceOfCoefficient(i)) |
|
286 |
else: |
else: |
287 |
raise ValueError,"Attempt to set undefined coefficient %s"%i |
raise ValueError,"Attempt to set undefined coefficient %s"%i |
288 |
# if numEquations and numSolutions is undefined we try identify their values based on the coefficients: |
# if numEquations and numSolutions is undefined we try identify their values based on the coefficients: |
859 |
""" |
""" |
860 |
return self.__domain |
return self.__domain |
861 |
|
|
862 |
|
def getDim(self): |
863 |
|
""" |
864 |
|
@brief returns the spatial dimension of the PDE |
865 |
|
""" |
866 |
|
return self.getDomain().getDim() |
867 |
|
|
868 |
def getNumEquations(self): |
def getNumEquations(self): |
869 |
""" |
""" |
870 |
@brief returns the number of equations |
@brief returns the number of equations |
941 |
|
|
942 |
def __init__(self,domain=None,f=escript.Data(),q=escript.Data()): |
def __init__(self,domain=None,f=escript.Data(),q=escript.Data()): |
943 |
LinearPDE.__init__(self,domain=identifyDomain(domain,{"f":f, "q":q})) |
LinearPDE.__init__(self,domain=identifyDomain(domain,{"f":f, "q":q})) |
944 |
self._setCoefficient(A=numarray.identity(self.getDomain().getDim())) |
self._setValue(A=numarray.identity(self.getDomain().getDim())) |
945 |
self.setSymmetryOn() |
self.setSymmetryOn() |
946 |
self.setValue(f,q) |
self.setValue(f,q) |
947 |
|
|
948 |
def setValue(self,f=escript.Data(),q=escript.Data()): |
def setValue(self,f=escript.Data(),q=escript.Data()): |
949 |
self._setCoefficient(Y=f,q=q) |
self._setValue(Y=f,q=q) |
950 |
|
|
951 |
|
|
952 |
# $Log$ |
# $Log$ |
953 |
# Revision 1.2 2004/12/15 07:08:27 jgs |
# Revision 1.3 2004/12/17 07:43:10 jgs |
954 |
# *** empty log message *** |
# *** empty log message *** |
955 |
# |
# |
956 |
|
# Revision 1.1.2.3 2004/12/16 00:12:34 gross |
957 |
|
# __init__ of LinearPDE does not accept any coefficients anymore |
958 |
|
# |
959 |
# Revision 1.1.2.2 2004/12/14 03:55:01 jgs |
# Revision 1.1.2.2 2004/12/14 03:55:01 jgs |
960 |
# *** empty log message *** |
# *** empty log message *** |
961 |
# |
# |