71076 |
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong functionspace of result.") |
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong functionspace of result.") |
71077 |
self.failUnlessEqual(res.getShape(),(4, 5, 3, 2),"wrong shape of result.") |
self.failUnlessEqual(res.getShape(),(4, 5, 3, 2),"wrong shape of result.") |
71078 |
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71079 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71080 |
|
def test_div_onFunction_fromData_ContinuousFunction(self): |
71081 |
|
""" |
71082 |
|
tests divergence of Data on the Function |
71083 |
|
|
71084 |
|
assumptions: ContinuousFunction(self.domain) exists |
71085 |
|
self.domain supports div on Function |
71086 |
|
""" |
71087 |
|
o=self.order |
71088 |
|
dim=self.domain.getDim() |
71089 |
|
w_ref=Function(self.domain) |
71090 |
|
x_ref=w_ref.getX() |
71091 |
|
w=ContinuousFunction(self.domain) |
71092 |
|
x=w.getX() |
71093 |
|
arg=Vector(0,w) |
71094 |
|
if dim==2: |
71095 |
|
arg[0]=(-0.627139584179)*x[0]**o+(0.0871027334774)*x[0]+(-0.540784323698)*x[1]**o+(0.951143032871)*x[1] |
71096 |
|
arg[1]=(-0.119239347115)*x[0]**o+(0.277154010744)*x[0]+(-0.0745557686973)*x[1]**o+(-0.15832879535)*x[1] |
71097 |
|
ref=o*(-0.627139584179)*x_ref[0]**(o-1)+o*(-0.0745557686973)*x_ref[1]**(o-1)+(-0.0712260618722) |
71098 |
|
else: |
71099 |
|
arg[0]=(0.687070465546)*x[0]**o+(0.789237250884)*x[0]+(-0.00415360035876)*x[1]**o+(-0.809802614239)*x[1]+(0.418087966616)*x[2]**o+(0.730203229934)*x[2] |
71100 |
|
arg[1]=(-0.0962217374268)*x[0]**o+(-0.180692492986)*x[0]+(-0.59921793179)*x[1]**o+(-0.799342788982)*x[1]+(0.421364766686)*x[2]**o+(-0.586211831795)*x[2] |
71101 |
|
arg[2]=(0.774915504102)*x[0]**o+(-0.968436517935)*x[0]+(0.325821385033)*x[1]**o+(-0.159885723341)*x[1]+(0.411134413872)*x[2]**o+(0.083388357951)*x[2] |
71102 |
|
ref=o*(0.687070465546)*x_ref[0]**(o-1)+o*(-0.59921793179)*x_ref[1]**(o-1)+o*(0.411134413872)*x_ref[2]**(o-1)+(0.0732828198535) |
71103 |
|
res=div(arg,where=w_ref) |
71104 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71105 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71106 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71107 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71108 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71109 |
|
def test_div_onFunction_fromData_Solution(self): |
71110 |
|
""" |
71111 |
|
tests divergence of Data on the Function |
71112 |
|
|
71113 |
|
assumptions: Solution(self.domain) exists |
71114 |
|
self.domain supports div on Function |
71115 |
|
""" |
71116 |
|
o=self.order |
71117 |
|
dim=self.domain.getDim() |
71118 |
|
w_ref=Function(self.domain) |
71119 |
|
x_ref=w_ref.getX() |
71120 |
|
w=Solution(self.domain) |
71121 |
|
x=w.getX() |
71122 |
|
arg=Vector(0,w) |
71123 |
|
if dim==2: |
71124 |
|
arg[0]=(-0.037254966228)*x[0]**o+(-0.175442318226)*x[0]+(-0.723089592066)*x[1]**o+(-0.487393332634)*x[1] |
71125 |
|
arg[1]=(0.617589532887)*x[0]**o+(0.392126578405)*x[0]+(0.612110931251)*x[1]**o+(-0.932236829843)*x[1] |
71126 |
|
ref=o*(-0.037254966228)*x_ref[0]**(o-1)+o*(0.612110931251)*x_ref[1]**(o-1)+(-1.10767914807) |
71127 |
|
else: |
71128 |
|
arg[0]=(-0.855344637098)*x[0]**o+(0.152992485241)*x[0]+(0.519809077415)*x[1]**o+(-0.0514985311411)*x[1]+(-0.473095642241)*x[2]**o+(-0.743711945025)*x[2] |
71129 |
|
arg[1]=(0.629819444749)*x[0]**o+(-0.649277860811)*x[0]+(-0.382231371814)*x[1]**o+(-0.354475847319)*x[1]+(0.523961319618)*x[2]**o+(-0.0301027430993)*x[2] |
71130 |
|
arg[2]=(0.489214433445)*x[0]**o+(-0.340824606014)*x[0]+(-0.78445257629)*x[1]**o+(-0.821498813523)*x[1]+(-0.147119976738)*x[2]**o+(0.464427291378)*x[2] |
71131 |
|
ref=o*(-0.855344637098)*x_ref[0]**(o-1)+o*(-0.382231371814)*x_ref[1]**(o-1)+o*(-0.147119976738)*x_ref[2]**(o-1)+(0.2629439293) |
71132 |
|
res=div(arg,where=w_ref) |
71133 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71134 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71135 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71136 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71137 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71138 |
|
def test_div_onFunction_fromData_ReducedSolution(self): |
71139 |
|
""" |
71140 |
|
tests divergence of Data on the Function |
71141 |
|
|
71142 |
|
assumptions: ReducedSolution(self.domain) exists |
71143 |
|
self.domain supports div on Function |
71144 |
|
""" |
71145 |
|
o=1 |
71146 |
|
dim=self.domain.getDim() |
71147 |
|
w_ref=Function(self.domain) |
71148 |
|
x_ref=w_ref.getX() |
71149 |
|
w=ReducedSolution(self.domain) |
71150 |
|
x=w.getX() |
71151 |
|
arg=Vector(0,w) |
71152 |
|
if dim==2: |
71153 |
|
arg[0]=(0.983549953155)*x[0]+(0.741104834322)*x[1] |
71154 |
|
arg[1]=(0.548447952865)*x[0]+(-0.817326874507)*x[1] |
71155 |
|
ref=(0.166223078648) |
71156 |
|
else: |
71157 |
|
arg[0]=(1.39002615085)*x[0]+(0.609245504565)*x[1]+(-1.06625041498)*x[2] |
71158 |
|
arg[1]=(-1.13329921103)*x[0]+(0.160224729695)*x[1]+(0.408632198066)*x[2] |
71159 |
|
arg[2]=(0.124694320475)*x[0]+(-1.53975404419)*x[1]+(1.00224340458)*x[2] |
71160 |
|
ref=(2.55249428513) |
71161 |
|
res=div(arg,where=w_ref) |
71162 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71163 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71164 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71165 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71166 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71167 |
|
def test_div_onFunction_fromSymbol_ContinuousFunction(self): |
71168 |
|
""" |
71169 |
|
tests divergence of Symbol on the Function |
71170 |
|
|
71171 |
|
assumptions: ContinuousFunction(self.domain) exists |
71172 |
|
self.domain supports div on Function |
71173 |
|
""" |
71174 |
|
o=self.order |
71175 |
|
dim=self.domain.getDim() |
71176 |
|
w_ref=Function(self.domain) |
71177 |
|
x_ref=w_ref.getX() |
71178 |
|
w=ContinuousFunction(self.domain) |
71179 |
|
x=w.getX() |
71180 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71181 |
|
s=Vector(0,w) |
71182 |
|
if dim==2: |
71183 |
|
s[0]=(0.056440576841)*x[0]**o+(0.246232077047)*x[0]+(0.855071175271)*x[1]**o+(0.501469853761)*x[1] |
71184 |
|
s[1]=(0.138795877959)*x[0]**o+(-0.272898431539)*x[0]+(0.446848353852)*x[1]**o+(0.590328561048)*x[1] |
71185 |
|
ref=o*(0.056440576841)*x_ref[0]**(o-1)+o*(0.446848353852)*x_ref[1]**(o-1)+(0.836560638095) |
71186 |
|
else: |
71187 |
|
s[0]=(-0.50629608129)*x[0]**o+(-0.741872423345)*x[0]+(-0.386081173959)*x[1]**o+(0.318875107198)*x[1]+(-0.385714540576)*x[2]**o+(-0.628522049303)*x[2] |
71188 |
|
s[1]=(-0.174000956733)*x[0]**o+(-0.883773784269)*x[0]+(-0.811120942906)*x[1]**o+(-0.16019437105)*x[1]+(-0.385051346205)*x[2]**o+(0.988540730072)*x[2] |
71189 |
|
s[2]=(0.354661225031)*x[0]**o+(0.900659468106)*x[0]+(0.589271296273)*x[1]**o+(0.339143175651)*x[1]+(-0.50750318566)*x[2]**o+(0.934057146824)*x[2] |
71190 |
|
ref=o*(-0.50629608129)*x_ref[0]**(o-1)+o*(-0.811120942906)*x_ref[1]**(o-1)+o*(-0.50750318566)*x_ref[2]**(o-1)+(0.0319903524287) |
71191 |
|
res=div(arg,where=w_ref) |
71192 |
|
sub=res.substitute({arg:s}) |
71193 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71194 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71195 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71196 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71197 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71198 |
|
def test_div_onFunction_fromSymbol_Solution(self): |
71199 |
|
""" |
71200 |
|
tests divergence of Symbol on the Function |
71201 |
|
|
71202 |
|
assumptions: Solution(self.domain) exists |
71203 |
|
self.domain supports div on Function |
71204 |
|
""" |
71205 |
|
o=self.order |
71206 |
|
dim=self.domain.getDim() |
71207 |
|
w_ref=Function(self.domain) |
71208 |
|
x_ref=w_ref.getX() |
71209 |
|
w=Solution(self.domain) |
71210 |
|
x=w.getX() |
71211 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71212 |
|
s=Vector(0,w) |
71213 |
|
if dim==2: |
71214 |
|
s[0]=(-0.170850365394)*x[0]**o+(0.150036471084)*x[0]+(0.0923309607854)*x[1]**o+(-0.296802366309)*x[1] |
71215 |
|
s[1]=(0.61420032995)*x[0]**o+(-0.430079619352)*x[0]+(0.0912728436628)*x[1]**o+(0.817677896693)*x[1] |
71216 |
|
ref=o*(-0.170850365394)*x_ref[0]**(o-1)+o*(0.0912728436628)*x_ref[1]**(o-1)+(0.967714367777) |
71217 |
|
else: |
71218 |
|
s[0]=(-0.740025332388)*x[0]**o+(0.628542391186)*x[0]+(0.201133646437)*x[1]**o+(0.518904232415)*x[1]+(0.745948286476)*x[2]**o+(0.6146222318)*x[2] |
71219 |
|
s[1]=(-0.646212542688)*x[0]**o+(-0.687137148869)*x[0]+(-0.162072841283)*x[1]**o+(0.627944920212)*x[1]+(-0.713818605572)*x[2]**o+(0.246460903592)*x[2] |
71220 |
|
s[2]=(-0.736234793544)*x[0]**o+(-0.382762645761)*x[0]+(-0.837579788578)*x[1]**o+(-0.913690456246)*x[1]+(0.364622848764)*x[2]**o+(0.241650777953)*x[2] |
71221 |
|
ref=o*(-0.740025332388)*x_ref[0]**(o-1)+o*(-0.162072841283)*x_ref[1]**(o-1)+o*(0.364622848764)*x_ref[2]**(o-1)+(1.49813808935) |
71222 |
|
res=div(arg,where=w_ref) |
71223 |
|
sub=res.substitute({arg:s}) |
71224 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71225 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71226 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71227 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71228 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71229 |
|
def test_div_onFunction_fromSymbol_ReducedSolution(self): |
71230 |
|
""" |
71231 |
|
tests divergence of Symbol on the Function |
71232 |
|
|
71233 |
|
assumptions: ReducedSolution(self.domain) exists |
71234 |
|
self.domain supports div on Function |
71235 |
|
""" |
71236 |
|
o=1 |
71237 |
|
dim=self.domain.getDim() |
71238 |
|
w_ref=Function(self.domain) |
71239 |
|
x_ref=w_ref.getX() |
71240 |
|
w=ReducedSolution(self.domain) |
71241 |
|
x=w.getX() |
71242 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71243 |
|
s=Vector(0,w) |
71244 |
|
if dim==2: |
71245 |
|
s[0]=(0.0131350820952)*x[0]+(-1.82221871934)*x[1] |
71246 |
|
s[1]=(-1.89777545856)*x[0]+(0.191135975577)*x[1] |
71247 |
|
ref=(0.204271057672) |
71248 |
|
else: |
71249 |
|
s[0]=(-1.30169999796)*x[0]+(-0.550711448862)*x[1]+(0.241706428593)*x[2] |
71250 |
|
s[1]=(0.843465810567)*x[0]+(-1.42460661253)*x[1]+(1.72435488277)*x[2] |
71251 |
|
s[2]=(0.290030514202)*x[0]+(1.75177720442)*x[1]+(0.568532008682)*x[2] |
71252 |
|
ref=(-2.15777460181) |
71253 |
|
res=div(arg,where=w_ref) |
71254 |
|
sub=res.substitute({arg:s}) |
71255 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71256 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71257 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71258 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71259 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71260 |
|
def test_div_onFunctionOnBoundary_fromData_ContinuousFunction(self): |
71261 |
|
""" |
71262 |
|
tests divergence of Data on the FunctionOnBoundary |
71263 |
|
|
71264 |
|
assumptions: ContinuousFunction(self.domain) exists |
71265 |
|
self.domain supports div on FunctionOnBoundary |
71266 |
|
""" |
71267 |
|
o=self.order |
71268 |
|
dim=self.domain.getDim() |
71269 |
|
w_ref=FunctionOnBoundary(self.domain) |
71270 |
|
x_ref=w_ref.getX() |
71271 |
|
w=ContinuousFunction(self.domain) |
71272 |
|
x=w.getX() |
71273 |
|
arg=Vector(0,w) |
71274 |
|
if dim==2: |
71275 |
|
arg[0]=(-0.39999188185)*x[0]**o+(-0.0985302665504)*x[0]+(0.103912148113)*x[1]**o+(-0.440893151166)*x[1] |
71276 |
|
arg[1]=(-0.550867128413)*x[0]**o+(-0.141593933069)*x[0]+(0.70592012062)*x[1]**o+(-0.836308099686)*x[1] |
71277 |
|
ref=o*(-0.39999188185)*x_ref[0]**(o-1)+o*(0.70592012062)*x_ref[1]**(o-1)+(-0.934838366236) |
71278 |
|
else: |
71279 |
|
arg[0]=(-0.00405079499937)*x[0]**o+(-0.282117848793)*x[0]+(0.979898720034)*x[1]**o+(-0.418106638625)*x[1]+(-0.443550810851)*x[2]**o+(-0.114976349698)*x[2] |
71280 |
|
arg[1]=(0.194746221496)*x[0]**o+(0.324772666848)*x[0]+(0.887813387362)*x[1]**o+(-0.9362867149)*x[1]+(-0.837328978457)*x[2]**o+(0.666079514358)*x[2] |
71281 |
|
arg[2]=(0.974797445328)*x[0]**o+(0.00365347225195)*x[0]+(-0.285413216102)*x[1]**o+(-0.253930177142)*x[1]+(0.306713249275)*x[2]**o+(-0.651133960743)*x[2] |
71282 |
|
ref=o*(-0.00405079499937)*x_ref[0]**(o-1)+o*(0.887813387362)*x_ref[1]**(o-1)+o*(0.306713249275)*x_ref[2]**(o-1)+(-1.86953852444) |
71283 |
|
res=div(arg,where=w_ref) |
71284 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71285 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71286 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71287 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71288 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71289 |
|
def test_div_onFunctionOnBoundary_fromData_Solution(self): |
71290 |
|
""" |
71291 |
|
tests divergence of Data on the FunctionOnBoundary |
71292 |
|
|
71293 |
|
assumptions: Solution(self.domain) exists |
71294 |
|
self.domain supports div on FunctionOnBoundary |
71295 |
|
""" |
71296 |
|
o=self.order |
71297 |
|
dim=self.domain.getDim() |
71298 |
|
w_ref=FunctionOnBoundary(self.domain) |
71299 |
|
x_ref=w_ref.getX() |
71300 |
|
w=Solution(self.domain) |
71301 |
|
x=w.getX() |
71302 |
|
arg=Vector(0,w) |
71303 |
|
if dim==2: |
71304 |
|
arg[0]=(-0.756094856241)*x[0]**o+(-0.185186427186)*x[0]+(0.15709960228)*x[1]**o+(-0.408372399703)*x[1] |
71305 |
|
arg[1]=(-0.680793761252)*x[0]**o+(0.815275471992)*x[0]+(-0.0564602888317)*x[1]**o+(0.542507598499)*x[1] |
71306 |
|
ref=o*(-0.756094856241)*x_ref[0]**(o-1)+o*(-0.0564602888317)*x_ref[1]**(o-1)+(0.357321171313) |
71307 |
|
else: |
71308 |
|
arg[0]=(-0.934829971573)*x[0]**o+(-0.202157515712)*x[0]+(0.972095997183)*x[1]**o+(0.430890291958)*x[1]+(0.973333736054)*x[2]**o+(0.563067835398)*x[2] |
71309 |
|
arg[1]=(-0.676905980848)*x[0]**o+(0.721377714968)*x[0]+(-0.594993636371)*x[1]**o+(0.678979489168)*x[1]+(-0.491382641255)*x[2]**o+(-0.237396572727)*x[2] |
71310 |
|
arg[2]=(-0.429697616397)*x[0]**o+(-0.8280062193)*x[0]+(0.549112225165)*x[1]**o+(0.73490904828)*x[1]+(0.543450722632)*x[2]**o+(-0.910092410543)*x[2] |
71311 |
|
ref=o*(-0.934829971573)*x_ref[0]**(o-1)+o*(-0.594993636371)*x_ref[1]**(o-1)+o*(0.543450722632)*x_ref[2]**(o-1)+(-0.433270437087) |
71312 |
|
res=div(arg,where=w_ref) |
71313 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71314 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71315 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71316 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71317 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71318 |
|
def test_div_onFunctionOnBoundary_fromData_ReducedSolution(self): |
71319 |
|
""" |
71320 |
|
tests divergence of Data on the FunctionOnBoundary |
71321 |
|
|
71322 |
|
assumptions: ReducedSolution(self.domain) exists |
71323 |
|
self.domain supports div on FunctionOnBoundary |
71324 |
|
""" |
71325 |
|
o=1 |
71326 |
|
dim=self.domain.getDim() |
71327 |
|
w_ref=FunctionOnBoundary(self.domain) |
71328 |
|
x_ref=w_ref.getX() |
71329 |
|
w=ReducedSolution(self.domain) |
71330 |
|
x=w.getX() |
71331 |
|
arg=Vector(0,w) |
71332 |
|
if dim==2: |
71333 |
|
arg[0]=(-0.701055390328)*x[0]+(-0.873109677704)*x[1] |
71334 |
|
arg[1]=(-0.459521943793)*x[0]+(-1.63064815751)*x[1] |
71335 |
|
ref=(-2.33170354784) |
71336 |
|
else: |
71337 |
|
arg[0]=(-0.408202035271)*x[0]+(-0.114769362644)*x[1]+(1.5510990077)*x[2] |
71338 |
|
arg[1]=(0.17481433607)*x[0]+(-0.466969145604)*x[1]+(1.25289823435)*x[2] |
71339 |
|
arg[2]=(-0.215477376297)*x[0]+(0.437173510517)*x[1]+(1.00334359062)*x[2] |
71340 |
|
ref=(0.128172409746) |
71341 |
|
res=div(arg,where=w_ref) |
71342 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71343 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71344 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71345 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71346 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71347 |
|
def test_div_onFunctionOnBoundary_fromSymbol_ContinuousFunction(self): |
71348 |
|
""" |
71349 |
|
tests divergence of Symbol on the FunctionOnBoundary |
71350 |
|
|
71351 |
|
assumptions: ContinuousFunction(self.domain) exists |
71352 |
|
self.domain supports div on FunctionOnBoundary |
71353 |
|
""" |
71354 |
|
o=self.order |
71355 |
|
dim=self.domain.getDim() |
71356 |
|
w_ref=FunctionOnBoundary(self.domain) |
71357 |
|
x_ref=w_ref.getX() |
71358 |
|
w=ContinuousFunction(self.domain) |
71359 |
|
x=w.getX() |
71360 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71361 |
|
s=Vector(0,w) |
71362 |
|
if dim==2: |
71363 |
|
s[0]=(0.600081772347)*x[0]**o+(-0.45657364476)*x[0]+(0.100558790895)*x[1]**o+(-0.055643420941)*x[1] |
71364 |
|
s[1]=(-0.568472071712)*x[0]**o+(-0.683739238637)*x[0]+(-0.14866031141)*x[1]**o+(-0.17686218803)*x[1] |
71365 |
|
ref=o*(0.600081772347)*x_ref[0]**(o-1)+o*(-0.14866031141)*x_ref[1]**(o-1)+(-0.63343583279) |
71366 |
|
else: |
71367 |
|
s[0]=(-0.822374031685)*x[0]**o+(-0.587511521237)*x[0]+(0.963639060657)*x[1]**o+(-0.190070692051)*x[1]+(0.558162506917)*x[2]**o+(-0.460808186343)*x[2] |
71368 |
|
s[1]=(-0.798572575819)*x[0]**o+(-0.101266909891)*x[0]+(-0.516195739148)*x[1]**o+(0.617726153299)*x[1]+(-0.34240818464)*x[2]**o+(0.335550364849)*x[2] |
71369 |
|
s[2]=(-0.213593757489)*x[0]**o+(-0.366203371298)*x[0]+(0.531651196423)*x[1]**o+(0.199631639651)*x[1]+(0.775999930783)*x[2]**o+(-0.3541802777)*x[2] |
71370 |
|
ref=o*(-0.822374031685)*x_ref[0]**(o-1)+o*(-0.516195739148)*x_ref[1]**(o-1)+o*(0.775999930783)*x_ref[2]**(o-1)+(-0.323965645638) |
71371 |
|
res=div(arg,where=w_ref) |
71372 |
|
sub=res.substitute({arg:s}) |
71373 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71374 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71375 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71376 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71377 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71378 |
|
def test_div_onFunctionOnBoundary_fromSymbol_Solution(self): |
71379 |
|
""" |
71380 |
|
tests divergence of Symbol on the FunctionOnBoundary |
71381 |
|
|
71382 |
|
assumptions: Solution(self.domain) exists |
71383 |
|
self.domain supports div on FunctionOnBoundary |
71384 |
|
""" |
71385 |
|
o=self.order |
71386 |
|
dim=self.domain.getDim() |
71387 |
|
w_ref=FunctionOnBoundary(self.domain) |
71388 |
|
x_ref=w_ref.getX() |
71389 |
|
w=Solution(self.domain) |
71390 |
|
x=w.getX() |
71391 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71392 |
|
s=Vector(0,w) |
71393 |
|
if dim==2: |
71394 |
|
s[0]=(0.737547486132)*x[0]**o+(-0.8688345451)*x[0]+(0.750434018309)*x[1]**o+(0.140443192943)*x[1] |
71395 |
|
s[1]=(-0.581930862436)*x[0]**o+(-0.0165116457364)*x[0]+(-0.575385479046)*x[1]**o+(0.840871277956)*x[1] |
71396 |
|
ref=o*(0.737547486132)*x_ref[0]**(o-1)+o*(-0.575385479046)*x_ref[1]**(o-1)+(-0.0279632671436) |
71397 |
|
else: |
71398 |
|
s[0]=(0.270325198436)*x[0]**o+(-0.47191239181)*x[0]+(-0.999528728847)*x[1]**o+(-0.103752839996)*x[1]+(-0.76928188931)*x[2]**o+(0.595426116602)*x[2] |
71399 |
|
s[1]=(0.269434059222)*x[0]**o+(0.387014929786)*x[0]+(-0.0817482722299)*x[1]**o+(-0.36264415709)*x[1]+(-0.693828731298)*x[2]**o+(-0.82629322569)*x[2] |
71400 |
|
s[2]=(0.171309519816)*x[0]**o+(-0.696536709305)*x[0]+(-0.835027772202)*x[1]**o+(-0.916627860891)*x[1]+(0.35239086527)*x[2]**o+(-0.921910360255)*x[2] |
71401 |
|
ref=o*(0.270325198436)*x_ref[0]**(o-1)+o*(-0.0817482722299)*x_ref[1]**(o-1)+o*(0.35239086527)*x_ref[2]**(o-1)+(-1.75646690915) |
71402 |
|
res=div(arg,where=w_ref) |
71403 |
|
sub=res.substitute({arg:s}) |
71404 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71405 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71406 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71407 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71408 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71409 |
|
def test_div_onFunctionOnBoundary_fromSymbol_ReducedSolution(self): |
71410 |
|
""" |
71411 |
|
tests divergence of Symbol on the FunctionOnBoundary |
71412 |
|
|
71413 |
|
assumptions: ReducedSolution(self.domain) exists |
71414 |
|
self.domain supports div on FunctionOnBoundary |
71415 |
|
""" |
71416 |
|
o=1 |
71417 |
|
dim=self.domain.getDim() |
71418 |
|
w_ref=FunctionOnBoundary(self.domain) |
71419 |
|
x_ref=w_ref.getX() |
71420 |
|
w=ReducedSolution(self.domain) |
71421 |
|
x=w.getX() |
71422 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71423 |
|
s=Vector(0,w) |
71424 |
|
if dim==2: |
71425 |
|
s[0]=(-0.759081801873)*x[0]+(1.19486066363)*x[1] |
71426 |
|
s[1]=(0.124293887621)*x[0]+(0.239495671437)*x[1] |
71427 |
|
ref=(-0.519586130436) |
71428 |
|
else: |
71429 |
|
s[0]=(0.114143993825)*x[0]+(1.00937429349)*x[1]+(-0.402505788806)*x[2] |
71430 |
|
s[1]=(1.3389839478)*x[0]+(-1.18006174569)*x[1]+(-0.7113433796)*x[2] |
71431 |
|
s[2]=(-0.082639774749)*x[0]+(-0.349220712526)*x[1]+(0.477197377967)*x[2] |
71432 |
|
ref=(-0.588720373901) |
71433 |
|
res=div(arg,where=w_ref) |
71434 |
|
sub=res.substitute({arg:s}) |
71435 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71436 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71437 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71438 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71439 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71440 |
|
def test_div_onFunctionOnContactZero_fromData_ContinuousFunction(self): |
71441 |
|
""" |
71442 |
|
tests divergence of Data on the FunctionOnContactZero |
71443 |
|
|
71444 |
|
assumptions: ContinuousFunction(self.domain) exists |
71445 |
|
self.domain supports div on FunctionOnContactZero |
71446 |
|
""" |
71447 |
|
o=self.order |
71448 |
|
dim=self.domain.getDim() |
71449 |
|
w_ref=FunctionOnContactZero(self.domain) |
71450 |
|
x_ref=w_ref.getX() |
71451 |
|
w=ContinuousFunction(self.domain) |
71452 |
|
x=w.getX() |
71453 |
|
arg=Vector(0,w) |
71454 |
|
if dim==2: |
71455 |
|
arg[0]=(-0.168949755871)*x[0]**o+(-0.850028843808)*x[0]+(-0.120402543124)*x[1]**o+(-0.962848557803)*x[1] |
71456 |
|
arg[1]=(-0.654809749448)*x[0]**o+(-0.86782287971)*x[0]+(0.063297622975)*x[1]**o+(0.400298481087)*x[1] |
71457 |
|
ref=o*(-0.168949755871)*x_ref[0]**(o-1)+o*(0.063297622975)*x_ref[1]**(o-1)+(-0.449730362722) |
71458 |
|
else: |
71459 |
|
arg[0]=(-0.171176882625)*x[0]**o+(-0.983025148621)*x[0]+(-0.287555867477)*x[1]**o+(-0.689164237089)*x[1]+(0.700322207054)*x[2]**o+(0.224056812199)*x[2] |
71460 |
|
arg[1]=(-0.112978574269)*x[0]**o+(-0.858210458939)*x[0]+(-0.9204250284)*x[1]**o+(0.123297295575)*x[1]+(-0.824406652345)*x[2]**o+(-0.514156554116)*x[2] |
71461 |
|
arg[2]=(0.51215310895)*x[0]**o+(-0.484568237326)*x[0]+(0.324174170946)*x[1]**o+(0.00636990564332)*x[1]+(0.640205070676)*x[2]**o+(0.642111592847)*x[2] |
71462 |
|
ref=o*(-0.171176882625)*x_ref[0]**(o-1)+o*(-0.9204250284)*x_ref[1]**(o-1)+o*(0.640205070676)*x_ref[2]**(o-1)+(-0.217616260198) |
71463 |
|
res=div(arg,where=w_ref) |
71464 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71465 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71466 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71467 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71468 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71469 |
|
def test_div_onFunctionOnContactZero_fromData_Solution(self): |
71470 |
|
""" |
71471 |
|
tests divergence of Data on the FunctionOnContactZero |
71472 |
|
|
71473 |
|
assumptions: Solution(self.domain) exists |
71474 |
|
self.domain supports div on FunctionOnContactZero |
71475 |
|
""" |
71476 |
|
o=self.order |
71477 |
|
dim=self.domain.getDim() |
71478 |
|
w_ref=FunctionOnContactZero(self.domain) |
71479 |
|
x_ref=w_ref.getX() |
71480 |
|
w=Solution(self.domain) |
71481 |
|
x=w.getX() |
71482 |
|
arg=Vector(0,w) |
71483 |
|
if dim==2: |
71484 |
|
arg[0]=(-0.878817592363)*x[0]**o+(-0.670917442592)*x[0]+(0.497874113437)*x[1]**o+(-0.923717382234)*x[1] |
71485 |
|
arg[1]=(-0.26042852826)*x[0]**o+(0.0668495878627)*x[0]+(-0.24188250168)*x[1]**o+(-0.189346966858)*x[1] |
71486 |
|
ref=o*(-0.878817592363)*x_ref[0]**(o-1)+o*(-0.24188250168)*x_ref[1]**(o-1)+(-0.86026440945) |
71487 |
|
else: |
71488 |
|
arg[0]=(-0.853829042745)*x[0]**o+(0.708253823804)*x[0]+(-0.420888906754)*x[1]**o+(0.94422817266)*x[1]+(-0.0454733411462)*x[2]**o+(-0.588636328569)*x[2] |
71489 |
|
arg[1]=(0.502105411994)*x[0]**o+(0.618635348918)*x[0]+(-0.459898919811)*x[1]**o+(0.0206615239957)*x[1]+(-0.479378221929)*x[2]**o+(-0.0383028811998)*x[2] |
71490 |
|
arg[2]=(-0.624273042239)*x[0]**o+(0.11218158851)*x[0]+(0.300065081794)*x[1]**o+(-0.823140829548)*x[1]+(-0.537442909756)*x[2]**o+(-0.537901446348)*x[2] |
71491 |
|
ref=o*(-0.853829042745)*x_ref[0]**(o-1)+o*(-0.459898919811)*x_ref[1]**(o-1)+o*(-0.537442909756)*x_ref[2]**(o-1)+(0.191013901452) |
71492 |
|
res=div(arg,where=w_ref) |
71493 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71494 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71495 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71496 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71497 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71498 |
|
def test_div_onFunctionOnContactZero_fromData_ReducedSolution(self): |
71499 |
|
""" |
71500 |
|
tests divergence of Data on the FunctionOnContactZero |
71501 |
|
|
71502 |
|
assumptions: ReducedSolution(self.domain) exists |
71503 |
|
self.domain supports div on FunctionOnContactZero |
71504 |
|
""" |
71505 |
|
o=1 |
71506 |
|
dim=self.domain.getDim() |
71507 |
|
w_ref=FunctionOnContactZero(self.domain) |
71508 |
|
x_ref=w_ref.getX() |
71509 |
|
w=ReducedSolution(self.domain) |
71510 |
|
x=w.getX() |
71511 |
|
arg=Vector(0,w) |
71512 |
|
if dim==2: |
71513 |
|
arg[0]=(1.40908912517)*x[0]+(0.980544777047)*x[1] |
71514 |
|
arg[1]=(1.54735707911)*x[0]+(0.136617363775)*x[1] |
71515 |
|
ref=(1.54570648895) |
71516 |
|
else: |
71517 |
|
arg[0]=(0.542899657951)*x[0]+(0.445471953165)*x[1]+(0.832668361385)*x[2] |
71518 |
|
arg[1]=(-0.658976315278)*x[0]+(0.467903824571)*x[1]+(-1.00818943414)*x[2] |
71519 |
|
arg[2]=(-1.10271841197)*x[0]+(1.48792855886)*x[1]+(-0.560275626738)*x[2] |
71520 |
|
ref=(0.450527855784) |
71521 |
|
res=div(arg,where=w_ref) |
71522 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71523 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71524 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71525 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71526 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71527 |
|
def test_div_onFunctionOnContactZero_fromSymbol_ContinuousFunction(self): |
71528 |
|
""" |
71529 |
|
tests divergence of Symbol on the FunctionOnContactZero |
71530 |
|
|
71531 |
|
assumptions: ContinuousFunction(self.domain) exists |
71532 |
|
self.domain supports div on FunctionOnContactZero |
71533 |
|
""" |
71534 |
|
o=self.order |
71535 |
|
dim=self.domain.getDim() |
71536 |
|
w_ref=FunctionOnContactZero(self.domain) |
71537 |
|
x_ref=w_ref.getX() |
71538 |
|
w=ContinuousFunction(self.domain) |
71539 |
|
x=w.getX() |
71540 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71541 |
|
s=Vector(0,w) |
71542 |
|
if dim==2: |
71543 |
|
s[0]=(0.161146122811)*x[0]**o+(-0.167192157833)*x[0]+(-0.375618887584)*x[1]**o+(0.0878245139474)*x[1] |
71544 |
|
s[1]=(-0.537393073871)*x[0]**o+(0.120284625555)*x[0]+(-0.732878618183)*x[1]**o+(0.950964015707)*x[1] |
71545 |
|
ref=o*(0.161146122811)*x_ref[0]**(o-1)+o*(-0.732878618183)*x_ref[1]**(o-1)+(0.783771857874) |
71546 |
|
else: |
71547 |
|
s[0]=(0.663467704633)*x[0]**o+(0.192717069721)*x[0]+(-0.348590092108)*x[1]**o+(-0.00702534646765)*x[1]+(0.359300718583)*x[2]**o+(0.325682691269)*x[2] |
71548 |
|
s[1]=(0.127384376464)*x[0]**o+(-0.974260164601)*x[0]+(0.623191833228)*x[1]**o+(0.927154841547)*x[1]+(0.66921644471)*x[2]**o+(0.730046317457)*x[2] |
71549 |
|
s[2]=(0.477753719763)*x[0]**o+(0.303349068035)*x[0]+(0.297684454456)*x[1]**o+(-0.23387142141)*x[1]+(-0.160162179877)*x[2]**o+(0.321427279218)*x[2] |
71550 |
|
ref=o*(0.663467704633)*x_ref[0]**(o-1)+o*(0.623191833228)*x_ref[1]**(o-1)+o*(-0.160162179877)*x_ref[2]**(o-1)+(1.44129919049) |
71551 |
|
res=div(arg,where=w_ref) |
71552 |
|
sub=res.substitute({arg:s}) |
71553 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71554 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71555 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71556 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71557 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71558 |
|
def test_div_onFunctionOnContactZero_fromSymbol_Solution(self): |
71559 |
|
""" |
71560 |
|
tests divergence of Symbol on the FunctionOnContactZero |
71561 |
|
|
71562 |
|
assumptions: Solution(self.domain) exists |
71563 |
|
self.domain supports div on FunctionOnContactZero |
71564 |
|
""" |
71565 |
|
o=self.order |
71566 |
|
dim=self.domain.getDim() |
71567 |
|
w_ref=FunctionOnContactZero(self.domain) |
71568 |
|
x_ref=w_ref.getX() |
71569 |
|
w=Solution(self.domain) |
71570 |
|
x=w.getX() |
71571 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71572 |
|
s=Vector(0,w) |
71573 |
|
if dim==2: |
71574 |
|
s[0]=(-0.714164520534)*x[0]**o+(0.82104115064)*x[0]+(-0.101329353755)*x[1]**o+(0.211581405872)*x[1] |
71575 |
|
s[1]=(0.154441871043)*x[0]**o+(-0.545965134865)*x[0]+(0.232672960523)*x[1]**o+(0.613108805891)*x[1] |
71576 |
|
ref=o*(-0.714164520534)*x_ref[0]**(o-1)+o*(0.232672960523)*x_ref[1]**(o-1)+(1.43414995653) |
71577 |
|
else: |
71578 |
|
s[0]=(0.668585271141)*x[0]**o+(0.367611537166)*x[0]+(0.241825965301)*x[1]**o+(-0.111380450261)*x[1]+(-0.928428911379)*x[2]**o+(-0.282714026941)*x[2] |
71579 |
|
s[1]=(-0.733274659976)*x[0]**o+(0.827799978056)*x[0]+(0.957107141065)*x[1]**o+(0.654786636056)*x[1]+(-0.327647026546)*x[2]**o+(-0.263782117053)*x[2] |
71580 |
|
s[2]=(-0.770358571743)*x[0]**o+(-0.793594113842)*x[0]+(-0.870794666744)*x[1]**o+(-0.760800400466)*x[1]+(0.987607632645)*x[2]**o+(0.960902635484)*x[2] |
71581 |
|
ref=o*(0.668585271141)*x_ref[0]**(o-1)+o*(0.957107141065)*x_ref[1]**(o-1)+o*(0.987607632645)*x_ref[2]**(o-1)+(1.98330080871) |
71582 |
|
res=div(arg,where=w_ref) |
71583 |
|
sub=res.substitute({arg:s}) |
71584 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71585 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71586 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71587 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71588 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71589 |
|
def test_div_onFunctionOnContactZero_fromSymbol_ReducedSolution(self): |
71590 |
|
""" |
71591 |
|
tests divergence of Symbol on the FunctionOnContactZero |
71592 |
|
|
71593 |
|
assumptions: ReducedSolution(self.domain) exists |
71594 |
|
self.domain supports div on FunctionOnContactZero |
71595 |
|
""" |
71596 |
|
o=1 |
71597 |
|
dim=self.domain.getDim() |
71598 |
|
w_ref=FunctionOnContactZero(self.domain) |
71599 |
|
x_ref=w_ref.getX() |
71600 |
|
w=ReducedSolution(self.domain) |
71601 |
|
x=w.getX() |
71602 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71603 |
|
s=Vector(0,w) |
71604 |
|
if dim==2: |
71605 |
|
s[0]=(0.445276807175)*x[0]+(-0.878942915065)*x[1] |
71606 |
|
s[1]=(-0.0238953550121)*x[0]+(0.361680637262)*x[1] |
71607 |
|
ref=(0.806957444436) |
71608 |
|
else: |
71609 |
|
s[0]=(0.0467419526691)*x[0]+(-0.00176696769735)*x[1]+(1.42280058205)*x[2] |
71610 |
|
s[1]=(0.184131344951)*x[0]+(0.64372416222)*x[1]+(-1.33372814614)*x[2] |
71611 |
|
s[2]=(0.284337855687)*x[0]+(-0.185747325055)*x[1]+(0.328830085951)*x[2] |
71612 |
|
ref=(1.01929620084) |
71613 |
|
res=div(arg,where=w_ref) |
71614 |
|
sub=res.substitute({arg:s}) |
71615 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71616 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71617 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71618 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71619 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71620 |
|
def test_div_onFunctionOnContactOne_fromData_ContinuousFunction(self): |
71621 |
|
""" |
71622 |
|
tests divergence of Data on the FunctionOnContactOne |
71623 |
|
|
71624 |
|
assumptions: ContinuousFunction(self.domain) exists |
71625 |
|
self.domain supports div on FunctionOnContactOne |
71626 |
|
""" |
71627 |
|
o=self.order |
71628 |
|
dim=self.domain.getDim() |
71629 |
|
w_ref=FunctionOnContactOne(self.domain) |
71630 |
|
x_ref=w_ref.getX() |
71631 |
|
w=ContinuousFunction(self.domain) |
71632 |
|
x=w.getX() |
71633 |
|
arg=Vector(0,w) |
71634 |
|
if dim==2: |
71635 |
|
arg[0]=(-0.506403770066)*x[0]**o+(0.32584268281)*x[0]+(-0.83529844868)*x[1]**o+(0.83697332673)*x[1] |
71636 |
|
arg[1]=(-0.85254932286)*x[0]**o+(0.751060747065)*x[0]+(-0.672601723159)*x[1]**o+(0.33751172176)*x[1] |
71637 |
|
ref=o*(-0.506403770066)*x_ref[0]**(o-1)+o*(-0.672601723159)*x_ref[1]**(o-1)+(0.66335440457) |
71638 |
|
else: |
71639 |
|
arg[0]=(-0.437811901761)*x[0]**o+(-0.135276240019)*x[0]+(0.683969739116)*x[1]**o+(-0.207547375093)*x[1]+(0.028594861031)*x[2]**o+(0.721966907461)*x[2] |
71640 |
|
arg[1]=(0.315283027578)*x[0]**o+(0.724158692434)*x[0]+(-0.746372201791)*x[1]**o+(-0.370798791131)*x[1]+(-0.677893413238)*x[2]**o+(0.645317237187)*x[2] |
71641 |
|
arg[2]=(0.0795681320657)*x[0]**o+(-0.165210743397)*x[0]+(0.866175461075)*x[1]**o+(0.10183311172)*x[1]+(-0.642389179022)*x[2]**o+(-0.917391184653)*x[2] |
71642 |
|
ref=o*(-0.437811901761)*x_ref[0]**(o-1)+o*(-0.746372201791)*x_ref[1]**(o-1)+o*(-0.642389179022)*x_ref[2]**(o-1)+(-1.4234662158) |
71643 |
|
res=div(arg,where=w_ref) |
71644 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71645 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71646 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71647 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71648 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71649 |
|
def test_div_onFunctionOnContactOne_fromData_Solution(self): |
71650 |
|
""" |
71651 |
|
tests divergence of Data on the FunctionOnContactOne |
71652 |
|
|
71653 |
|
assumptions: Solution(self.domain) exists |
71654 |
|
self.domain supports div on FunctionOnContactOne |
71655 |
|
""" |
71656 |
|
o=self.order |
71657 |
|
dim=self.domain.getDim() |
71658 |
|
w_ref=FunctionOnContactOne(self.domain) |
71659 |
|
x_ref=w_ref.getX() |
71660 |
|
w=Solution(self.domain) |
71661 |
|
x=w.getX() |
71662 |
|
arg=Vector(0,w) |
71663 |
|
if dim==2: |
71664 |
|
arg[0]=(0.46385553428)*x[0]**o+(-0.91930502543)*x[0]+(0.316745110613)*x[1]**o+(-0.0996899204895)*x[1] |
71665 |
|
arg[1]=(-0.473415736992)*x[0]**o+(0.514718374433)*x[0]+(-0.473429315265)*x[1]**o+(-0.194316615233)*x[1] |
71666 |
|
ref=o*(0.46385553428)*x_ref[0]**(o-1)+o*(-0.473429315265)*x_ref[1]**(o-1)+(-1.11362164066) |
71667 |
|
else: |
71668 |
|
arg[0]=(0.740236725813)*x[0]**o+(0.887898498849)*x[0]+(-0.44803045798)*x[1]**o+(0.160930903094)*x[1]+(-0.530527194219)*x[2]**o+(0.0622347651074)*x[2] |
71669 |
|
arg[1]=(0.36748785661)*x[0]**o+(-0.618052241987)*x[0]+(-0.57186325537)*x[1]**o+(-0.180576934525)*x[1]+(-0.381568503551)*x[2]**o+(0.0356882174068)*x[2] |
71670 |
|
arg[2]=(0.070144257808)*x[0]**o+(0.823052625211)*x[0]+(-0.426522615959)*x[1]**o+(-0.294700653199)*x[1]+(0.209922433427)*x[2]**o+(-0.532056800218)*x[2] |
71671 |
|
ref=o*(0.740236725813)*x_ref[0]**(o-1)+o*(-0.57186325537)*x_ref[1]**(o-1)+o*(0.209922433427)*x_ref[2]**(o-1)+(0.175264764106) |
71672 |
|
res=div(arg,where=w_ref) |
71673 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71674 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71675 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71676 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71677 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71678 |
|
def test_div_onFunctionOnContactOne_fromData_ReducedSolution(self): |
71679 |
|
""" |
71680 |
|
tests divergence of Data on the FunctionOnContactOne |
71681 |
|
|
71682 |
|
assumptions: ReducedSolution(self.domain) exists |
71683 |
|
self.domain supports div on FunctionOnContactOne |
71684 |
|
""" |
71685 |
|
o=1 |
71686 |
|
dim=self.domain.getDim() |
71687 |
|
w_ref=FunctionOnContactOne(self.domain) |
71688 |
|
x_ref=w_ref.getX() |
71689 |
|
w=ReducedSolution(self.domain) |
71690 |
|
x=w.getX() |
71691 |
|
arg=Vector(0,w) |
71692 |
|
if dim==2: |
71693 |
|
arg[0]=(0.0337229572599)*x[0]+(0.820391566535)*x[1] |
71694 |
|
arg[1]=(0.640567267185)*x[0]+(1.03537999206)*x[1] |
71695 |
|
ref=(1.06910294932) |
71696 |
|
else: |
71697 |
|
arg[0]=(-0.0797501374913)*x[0]+(-0.798826730006)*x[1]+(-0.590979881432)*x[2] |
71698 |
|
arg[1]=(-0.414547879032)*x[0]+(0.845538994985)*x[1]+(-1.21203164133)*x[2] |
71699 |
|
arg[2]=(-0.438232052406)*x[0]+(-0.35977163998)*x[1]+(-1.01489636413)*x[2] |
71700 |
|
ref=(-0.249107506635) |
71701 |
|
res=div(arg,where=w_ref) |
71702 |
|
self.failUnless(isinstance(res,Data),"wrong type of result.") |
71703 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71704 |
|
self.failUnlessEqual(res.getFunctionSpace(),w_ref,"wrong function space of result.") |
71705 |
|
self.failUnless(Lsup(res-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71706 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71707 |
|
def test_div_onFunctionOnContactOne_fromSymbol_ContinuousFunction(self): |
71708 |
|
""" |
71709 |
|
tests divergence of Symbol on the FunctionOnContactOne |
71710 |
|
|
71711 |
|
assumptions: ContinuousFunction(self.domain) exists |
71712 |
|
self.domain supports div on FunctionOnContactOne |
71713 |
|
""" |
71714 |
|
o=self.order |
71715 |
|
dim=self.domain.getDim() |
71716 |
|
w_ref=FunctionOnContactOne(self.domain) |
71717 |
|
x_ref=w_ref.getX() |
71718 |
|
w=ContinuousFunction(self.domain) |
71719 |
|
x=w.getX() |
71720 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71721 |
|
s=Vector(0,w) |
71722 |
|
if dim==2: |
71723 |
|
s[0]=(-0.0898941553957)*x[0]**o+(-0.856300995796)*x[0]+(0.348298533454)*x[1]**o+(0.0351975574428)*x[1] |
71724 |
|
s[1]=(-0.930316249846)*x[0]**o+(-0.0295682442002)*x[0]+(-0.648381042093)*x[1]**o+(0.0737127687654)*x[1] |
71725 |
|
ref=o*(-0.0898941553957)*x_ref[0]**(o-1)+o*(-0.648381042093)*x_ref[1]**(o-1)+(-0.782588227031) |
71726 |
|
else: |
71727 |
|
s[0]=(-0.163987987624)*x[0]**o+(-0.511857517274)*x[0]+(0.741666372996)*x[1]**o+(0.496640177195)*x[1]+(0.460061066559)*x[2]**o+(-0.558420509462)*x[2] |
71728 |
|
s[1]=(0.71525289068)*x[0]**o+(0.886545582)*x[0]+(-0.904766629428)*x[1]**o+(0.146361771148)*x[1]+(0.570424059304)*x[2]**o+(0.305997230748)*x[2] |
71729 |
|
s[2]=(0.615370647779)*x[0]**o+(0.471712532771)*x[0]+(0.570468738833)*x[1]**o+(-0.728014206718)*x[1]+(-0.38659264723)*x[2]**o+(0.717051171147)*x[2] |
71730 |
|
ref=o*(-0.163987987624)*x_ref[0]**(o-1)+o*(-0.904766629428)*x_ref[1]**(o-1)+o*(-0.38659264723)*x_ref[2]**(o-1)+(0.351555425021) |
71731 |
|
res=div(arg,where=w_ref) |
71732 |
|
sub=res.substitute({arg:s}) |
71733 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71734 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71735 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71736 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71737 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71738 |
|
def test_div_onFunctionOnContactOne_fromSymbol_Solution(self): |
71739 |
|
""" |
71740 |
|
tests divergence of Symbol on the FunctionOnContactOne |
71741 |
|
|
71742 |
|
assumptions: Solution(self.domain) exists |
71743 |
|
self.domain supports div on FunctionOnContactOne |
71744 |
|
""" |
71745 |
|
o=self.order |
71746 |
|
dim=self.domain.getDim() |
71747 |
|
w_ref=FunctionOnContactOne(self.domain) |
71748 |
|
x_ref=w_ref.getX() |
71749 |
|
w=Solution(self.domain) |
71750 |
|
x=w.getX() |
71751 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71752 |
|
s=Vector(0,w) |
71753 |
|
if dim==2: |
71754 |
|
s[0]=(0.194773312667)*x[0]**o+(-0.265468977683)*x[0]+(-0.0352177899992)*x[1]**o+(0.463717858721)*x[1] |
71755 |
|
s[1]=(0.139203691371)*x[0]**o+(-0.799672510649)*x[0]+(-0.367277227148)*x[1]**o+(0.111274990466)*x[1] |
71756 |
|
ref=o*(0.194773312667)*x_ref[0]**(o-1)+o*(-0.367277227148)*x_ref[1]**(o-1)+(-0.154193987217) |
71757 |
|
else: |
71758 |
|
s[0]=(0.0505125806914)*x[0]**o+(0.149858893872)*x[0]+(-0.095881973707)*x[1]**o+(-0.850488788785)*x[1]+(-0.0110026442959)*x[2]**o+(-0.407209597266)*x[2] |
71759 |
|
s[1]=(0.72998229305)*x[0]**o+(0.745287781387)*x[0]+(-0.940255747769)*x[1]**o+(0.67408292569)*x[1]+(-0.149905927735)*x[2]**o+(0.0681385797299)*x[2] |
71760 |
|
s[2]=(-0.314939233587)*x[0]**o+(0.716212656447)*x[0]+(-0.78946710376)*x[1]**o+(-0.867972385662)*x[1]+(0.299407109746)*x[2]**o+(-0.601525689779)*x[2] |
71761 |
|
ref=o*(0.0505125806914)*x_ref[0]**(o-1)+o*(-0.940255747769)*x_ref[1]**(o-1)+o*(0.299407109746)*x_ref[2]**(o-1)+(0.222416129783) |
71762 |
|
res=div(arg,where=w_ref) |
71763 |
|
sub=res.substitute({arg:s}) |
71764 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71765 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71766 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71767 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |
71768 |
|
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
71769 |
|
def test_div_onFunctionOnContactOne_fromSymbol_ReducedSolution(self): |
71770 |
|
""" |
71771 |
|
tests divergence of Symbol on the FunctionOnContactOne |
71772 |
|
|
71773 |
|
assumptions: ReducedSolution(self.domain) exists |
71774 |
|
self.domain supports div on FunctionOnContactOne |
71775 |
|
""" |
71776 |
|
o=1 |
71777 |
|
dim=self.domain.getDim() |
71778 |
|
w_ref=FunctionOnContactOne(self.domain) |
71779 |
|
x_ref=w_ref.getX() |
71780 |
|
w=ReducedSolution(self.domain) |
71781 |
|
x=w.getX() |
71782 |
|
arg=Symbol(shape=(dim,),dim=dim) |
71783 |
|
s=Vector(0,w) |
71784 |
|
if dim==2: |
71785 |
|
s[0]=(-0.98773096396)*x[0]+(0.381969528266)*x[1] |
71786 |
|
s[1]=(0.508967927604)*x[0]+(0.742652762961)*x[1] |
71787 |
|
ref=(-0.245078200999) |
71788 |
|
else: |
71789 |
|
s[0]=(0.0672222632785)*x[0]+(0.303873945969)*x[1]+(-0.471524980136)*x[2] |
71790 |
|
s[1]=(0.63378224019)*x[0]+(-0.865690740572)*x[1]+(-0.0997380430882)*x[2] |
71791 |
|
s[2]=(0.711173440054)*x[0]+(0.845130507211)*x[1]+(-1.10616823701)*x[2] |
71792 |
|
ref=(-1.9046367143) |
71793 |
|
res=div(arg,where=w_ref) |
71794 |
|
sub=res.substitute({arg:s}) |
71795 |
|
self.failUnless(isinstance(res,Symbol),"wrong type of result.") |
71796 |
|
self.failUnlessEqual(res.getShape(),(),"wrong shape of result.") |
71797 |
|
self.failUnlessEqual(sub.getFunctionSpace(),w_ref,"wrong function space of result.") |
71798 |
|
self.failUnless(Lsup(sub-ref)<=self.RES_TOL*Lsup(ref),"wrong result") |