Skip to content

Commit

Permalink
added some debugging code to check actual and predicted h
Browse files Browse the repository at this point in the history
  • Loading branch information
cekees committed May 11, 2015
1 parent 85f4bbd commit 784eeb9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 20 deletions.
7 changes: 6 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
*.h5 filter=fat -crlf
*.bmp filter=fat -crlf
*.bmp filter=fat -crlf
*.xmf filter=lfs diff=lfs merge=lfs -crlf
*.h5 filter=lfs diff=lfs merge=lfs -crlf
*.mp4 filter=lfs diff=lfs merge=lfs -crlf
*.png filter=lfs diff=lfs merge=lfs -crlf
*.jpg filter=lfs diff=lfs merge=lfs -crlf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from math import *
from proteus import Domain
from proteus.Gauges import PointGauges, LineGauges, LineGauges_phi
from proteus.Gauges import PointGauges, LineGauges
#, LineGauges_phi

import proteus.MeshTools
from proteus.default_n import *
Expand Down Expand Up @@ -87,7 +88,7 @@

lineGauges = LineGauges(gaugeEndpoints={'lineGauge_xtoH=0.825': ((0.495, 0.0, 0.0), (0.495, 1.8, 0.0))}, linePoints=20)
#'lineGauge_x/H=1.653':((0.99,0.0,0.0),(0.99,1.8,0.0))
lineGauges_phi = LineGauges_phi(lineGauges.endpoints, linePoints=20)
#lineGauges_phi = LineGauges_phi(lineGauges.endpoints, linePoints=20)

if useHex:
nnx = 4 * Refinement + 1
Expand Down
36 changes: 22 additions & 14 deletions 3d/floating_bar/floating_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,26 +394,34 @@ def calculate(self):
M[1]*opts.free_r[1],
M[2]*opts.free_r[2]))
self.world.step(self.model.stepController.dt_model)
self.h = (self.velocity[0]*self.model.stepController.dt_model,
self.velocity[1]*self.model.stepController.dt_model,
self.velocity[2]*self.model.stepController.dt_model)
x,y,z = self.body.getPosition()
u,v,w = self.body.getLinearVel()
self.last_velocity=self.velocity
self.last_position=self.position
self.position=(x,y,z)
self.velocity=(u,v,w)
self.h = (self.position[0]-self.last_position[0],
self.position[1]-self.last_position[1],
self.position[2]-self.last_position[2])
print "%1.2fsec: pos=(%6.3f, %6.3f, %6.3f) vel=(%6.3f, %6.3f, %6.3f)" % \
(self.model.stepController.t_model,
self.position[0], self.position[1], self.position[2],
self.velocity[0],self.velocity[1],self.velocity[2])
print "%1.2fsec: last_pos=(%6.3f, %6.3f, %6.3f) last_vel=(%6.3f, %6.3f, %6.3f)" % \
(self.model.stepController.t_model,
self.last_position[0], self.last_position[1], self.last_position[2],
self.last_velocity[0],self.last_velocity[1],self.last_velocity[2])
print "displacement at center of gravity",self.h
self.last_velocity=self.velocity
self.last_position=self.position
h_v = (self.model.stepController.dt_model*self.velocity[0],
self.model.stepController.dt_model*self.velocity[1],
self.model.stepController.dt_model*self.velocity[2])
for i,(hi,h_vi) in enumerate(zip(self.h,h_v)):
if fabs(hi-h_vi)/(fabs(hi)+1.0e-8) > 1.0e-8:
print "hi hcz",hi,h_vi,i
print "%1.2fsec: pos=(%6.3f, %6.3f, %6.3f) vel=(%6.3f, %6.3f, %6.3f)" % (self.model.stepController.t_model,
self.position[0],
self.position[1],
self.position[2],
self.velocity[0],
self.velocity[1],
self.velocity[2])
print "%1.2fsec: last_pos=(%6.3f, %6.3f, %6.3f) last_vel=(%6.3f, %6.3f, %6.3f)" % (self.model.stepController.t_model,
self.last_position[0],
self.last_position[1],
self.last_position[2],
self.last_velocity[0],
self.last_velocity[1],
self.last_velocity[2])

bar = RigidBar(density=0.5*(rho_0+rho_1),bar_center=bar_center,bar_dim=opts.bar_dim)
6 changes: 3 additions & 3 deletions 3d/floating_bar/moveMesh_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def hx(self,x,t):
hx = self.object.body.getPointVel(x)[0]*self.object.model.stepController.dt_model
hcx = self.object.h[0]
if fabs(hx-hcx)/(fabs(hcx)+1.0e-8) > 1.0e-8:
print hx,hcx
print "hx hcx",hx,hcx
return hx
def hy(self,x,t):
if self.object == None:
Expand All @@ -50,7 +50,7 @@ def hy(self,x,t):
hy = self.object.body.getPointVel(x)[1]*self.object.model.stepController.dt_model
hcy = self.object.h[1]
if fabs(hy-hcy)/(fabs(hcy)+1.0e-8) > 1.0e-8:
print hy,hcy
print "hy hcy",hy,hcy
return hy
def hz(self,x,t):
if self.object == None:
Expand All @@ -59,7 +59,7 @@ def hz(self,x,t):
hz = self.object.body.getPointVel(x)[2]*self.object.model.stepController.dt_model
hcz = self.object.h[2]
if fabs(hz-hcz)/(fabs(hcz)+1.0e-8) > 1.0e-8:
print hz,hcz
print "hz hcz",hz,hcz
return hz
def calculate(self):
pass
Expand Down
Binary file modified doc/source/chl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/source/hrw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 784eeb9

Please sign in to comment.