pyNastran  0.5.0
pyNastran BDF Reader/Writer, OP2 Parser, and GUI
damper.py
Go to the documentation of this file.
00001 ## GNU Lesser General Public License
00002 ## 
00003 ## Program pyNastran - a python interface to NASTRAN files
00004 ## Copyright (C) 2011-2012  Steven Doyle, Al Danial
00005 ## 
00006 ## Authors and copyright holders of pyNastran
00007 ## Steven Doyle <mesheb82@gmail.com>
00008 ## Al Danial    <al.danial@gmail.com>
00009 ## 
00010 ## This file is part of pyNastran.
00011 ## 
00012 ## pyNastran is free software: you can redistribute it and/or modify
00013 ## it under the terms of the GNU Lesser General Public License as published by
00014 ## the Free Software Foundation, either version 3 of the License, or
00015 ## (at your option) any later version.
00016 ## 
00017 ## pyNastran is distributed in the hope that it will be useful,
00018 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 ## GNU General Public License for more details.
00021 ## 
00022 ## You should have received a copy of the GNU Lesser General Public License
00023 ## along with pyNastran.  If not, see <http://www.gnu.org/licenses/>.
00024 ## 
00025 # pylint: disable=C0103,R0902,R0904,R0914
00026 
00027 from __future__ import division, print_function
00028 
00029 from pyNastran.bdf.fieldWriter import set_blank_if_default
00030 from pyNastran.bdf.cards.baseCard import Property
00031 
00032 class DamperProperty(Property):
00033     type = 'DamperProperty'
00034     def __init__(self, card, data):
00035         Property.__init__(self, card, data)
00036         pass
00037     def crossReference(self,model):
00038         pass
00039 
00040 class PVISC(DamperProperty):
00041     type = 'PVISC'
00042     def __init__(self,card=None,nPVISC=0,data=None):
00043         if card:
00044             self.pid = card.field(1+4*nPVISC)
00045             self.ce = card.field(2+4*nPVISC)
00046             self.cr = card.field(3+4*nPVISC,0.)
00047         else:
00048             self.pid = data[0]
00049             self.ce = data[1]
00050             self.cr = data[2]
00051         ###
00052     
00053     def crossReference(self,model):
00054         pass
00055 
00056     def rawFields(self):
00057         fields = ['PVISC',self.pid,self.ce,self.cr]
00058         return fields
00059     
00060     def reprFields(self):
00061         cr = set_blank_if_default(self.cr,0.)
00062         fields = ['PVISC',self.pid,self.ce,cr]
00063         return fields
00064 
00065 class PDAMP(DamperProperty):
00066     type = 'PDAMP'
00067     def __init__(self,card=None,nPDAMP=0,data=None):
00068         DamperProperty.__init__(self, card, data)
00069         nOffset = nPDAMP*2
00070         if card:
00071             ## Property ID
00072             self.pid = card.field(1+nOffset) # 3 PDAMP properties can be defined on 1 PDAMP card
00073             ## Force per unit velocity (Real)
00074             self.b   = card.field(2+nOffset) # these are split into 2 separate cards
00075         else:
00076             self.pid = data[0]
00077             self.b   = data[1]
00078         ###
00079 
00080     def rawFields(self):
00081         fields = ['PDAMP',self.pid,self.b]
00082         return fields
00083 
00084     def reprFields(self):
00085         return self.rawFields()
00086 
00087 class PDAMP5(DamperProperty):
00088     type = 'PDAMP5'
00089     def __init__(self,card=None,data=None):
00090         """
00091         Defines the damping multiplier and references the material properties for damping. CDAMP5 is intended
00092         for heat transfer analysis only.
00093         """
00094         DamperProperty.__init__(self, card, data)
00095         if card:
00096             ## Property ID
00097             self.pid = card.field(1)
00098             ## Material ID
00099             self.mid = card.field(2)
00100             ## Damping multiplier. (Real > 0.0)
00101             ## B is the mass that multiplies the heat capacity CP on the MAT4 or MAT5 entry.
00102             self.b   = card.field(3)
00103         else:
00104             self.pid = data[0]
00105             self.mid = data[1]
00106             self.b   = data[2]
00107         ###
00108 
00109     def crossReference(self,model):
00110         self.mid = model.Material(self.mid)
00111     
00112     def Mid(self):
00113         if isinstance(self.mid,int):
00114             return self.mid
00115         return self.mid.mid
00116     
00117     def reprFields(self):
00118         return self.rawFields()
00119 
00120     def rawFields(self):
00121         fields = ['PDAMP5',self.pid,self.Mid(),self.b]
00122         return fields
00123 
00124 class PDAMPT(DamperProperty):
00125     type = 'PDAMPT'
00126     def __init__(self,card=None,data=None):
00127         DamperProperty.__init__(self, card, data)
00128         if card:
00129             ## Property ID
00130             self.pid  = card.field(1)
00131             ## Identification number of a TABLEDi entry that defines the
00132             ## damping force per-unit velocity versus frequency relationship
00133             self.tbid = card.field(2,0)
00134         else:
00135             self.pid  = data[0]
00136             self.tbid = data[1]
00137         ###
00138 
00139     def crossReference(self,model):
00140         self.tbid = model.Table(self.tbid)
00141     
00142     def Tbid(self):
00143         if self.tbid==0:
00144             return None
00145         elif isinstance(self.tbid,int):
00146             return self.tbid
00147         return self.tbid.tid
00148 
00149     def reprFields(self):
00150         return self.rawFields()
00151 
00152     def rawFields(self):
00153         fields = ['PDAMPT',self.pid,self.Tbid()]
00154         return fields
00155 
 All Classes Namespaces Files Functions Variables