Skip to content

Commit

Permalink
bdf_vectorized3:
Browse files Browse the repository at this point in the history
 - adding thermal cards: CHBDYE, CHBDYG, CHBDYP, PCONV, PCONVM, PHBDY, CONV, CONVM
 - fixing some issues with CTRIA3/CQUAD4 not writing correctly
 - fixing bug with MONPNT3 default change
  • Loading branch information
SteveDoyle2 committed Dec 19, 2023
1 parent 4c90b49 commit 9ea8541
Show file tree
Hide file tree
Showing 13 changed files with 222 additions and 170 deletions.
30 changes: 16 additions & 14 deletions pyNastran/dev/bdf_vectorized3/bdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@
from pyNastran.bdf.cards.dmig import DMIG, DMI, DMIJ, DMIK, DMIJI, DMIG_UACCEL, DTI, DTI_UNITS, DMIAX
#from .bdf.cards.elements.thermal import BDYOR
#from .cards.thermal.loads import (TEMPB3, TEMPRB)
#from .cards.thermal.thermal import (CHBDYE, CHBDYG, CHBDYP, PCONV, PCONVM,
#PHBDY, CONV, CONVM, TEMPBC)
from pyNastran.dev.bdf_vectorized3.cards.elements.thermal import (
CHBDYE, CHBDYG, CHBDYP, PCONV, PCONVM,
PHBDY, CONV, CONVM, # TEMPBC,
)
#from .cards.thermal.radiation import RADM, RADBC, RADCAV, RADLST, RADMTX, VIEW, VIEW3D
from pyNastran.bdf.cards.bdf_tables import (
TABLED1, TABLED2, TABLED3, TABLED4,
Expand Down Expand Up @@ -751,9 +753,9 @@ def __init__(self, debug: Union[str, bool, None]=True,
# temperature cards
'TEMP', 'TEMPD', # 'TEMPB3', 'TEMPAX',
'QBDY1', 'QBDY2', 'QBDY3', 'QHBDY',
#'CHBDYE', 'CHBDYG', 'CHBDYP', 'BDYOR',
#'PCONV', 'PCONVM', 'PHBDY',
'RADBC', # 'CONV',
'CHBDYE', 'CHBDYG', 'CHBDYP', 'BDYOR',
'PCONV', 'PCONVM', 'PHBDY',
'RADBC', 'CONV',
'RADM', # 'VIEW', 'VIEW3D', # TODO: not validated

#'RADCAV', ## radcavs
Expand Down Expand Up @@ -912,7 +914,7 @@ def __init__(self, debug: Union[str, bool, None]=True,
#'RADLST', 'RADMTX', #'RADBND',
#'TEMPP1',
#'TEMPRB',
#'CONVM',
'CONVM',
## ???
#'PANEL', 'SWLDPRM',
#'CWELD', 'PWELD',
Expand Down Expand Up @@ -2496,17 +2498,17 @@ def add_card(cls, card, comment=''):
#'PACBAR': (PACBAR, add_methods._add_acoustic_property_object),

# thermal elements
#'CHBDYE': partial(self._prepare_card, self.chbdye),
#'CHBDYG': partial(self._prepare_card, self.chbdyg),
#'CHBDYP': partial(self._prepare_card, self.chbdyp),
#'PHBDY': partial(self._prepare_card, self.phbdy),
'CHBDYE': partial(self._prepare_card, self.chbdye),
'CHBDYG': partial(self._prepare_card, self.chbdyg),
'CHBDYP': partial(self._prepare_card, self.chbdyp),
'PHBDY': partial(self._prepare_card, self.phbdy),
#'TEMPRB' : (TEMPRB, add_methods._add_thermal_load_object),
#'TEMPB3' : (TEMPB3, add_methods._add_thermal_load_object),

#'CONV': partial(self._prepare_card, self.conv),
#'PCONV': partial(self._prepare_card, self.pconv),
#'CONVM': partial(self._prepare_card, self.convm),
#'PCONVM': partial(self._prepare_card, self.pconvm),
'CONV': partial(self._prepare_card, self.conv),
'PCONV': partial(self._prepare_card, self.pconv),
'CONVM': partial(self._prepare_card, self.convm),
'PCONVM': partial(self._prepare_card, self.pconvm),

# static loads
'LOAD' : partial(self._prepare_card, self.load),
Expand Down
20 changes: 10 additions & 10 deletions pyNastran/dev/bdf_vectorized3/bdf_interface/add_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -5172,7 +5172,7 @@ def add_view3d(self, icavity, gitb=4, gips=4, cier=4, error_tol=0.1,
def add_pconv(self, pconid, mid=None, form=0, expf=0.0, ftype=0, tid=None,
chlen=None, gidin=None, ce=0,
e1=None, e2=None, e3=None,
comment: str='') -> PCONV:
comment: str='') -> int:
"""
Creates a PCONV card
Expand Down Expand Up @@ -5207,15 +5207,15 @@ def add_pconv(self, pconid, mid=None, form=0, expf=0.0, ftype=0, tid=None,
a comment for the card
"""
prop = PCONV(pconid, mid=mid,
form=form, expf=expf, ftype=ftype,
tid=tid, chlen=chlen, gidin=gidin,
ce=ce, e1=e1, e2=e2, e3=e3, comment=comment)
self._add_methods._add_convection_property_object(prop)
prop = self.pconv.add(
pconid, mid=mid,
form=form, expf=expf, ftype=ftype,
tid=tid, chlen=chlen, gidin=gidin,
ce=ce, e1=e1, e2=e2, e3=e3, comment=comment)
return prop

def add_pconvm(self, pconid, mid, coef, form=0, flag=0,
expr=0.0, exppi=0.0, exppo=0.0, comment: str='') -> PCONVM:
expr=0.0, exppi=0.0, exppo=0.0, comment: str='') -> int:
"""
Creates a PCONVM card
Expand Down Expand Up @@ -5244,9 +5244,9 @@ def add_pconvm(self, pconid, mid, coef, form=0, flag=0,
a comment for the card
"""
prop = PCONVM(pconid, mid, coef, form=form, flag=flag,
expr=expr, exppi=exppi, exppo=exppo, comment=comment)
self._add_methods._add_convection_property_object(prop)
prop = self.pconvm.add(
pconid, mid, coef, form=form, flag=flag,
expr=expr, exppi=exppi, exppo=exppo, comment=comment)
return prop

def add_radset(self, cavity_ids: list[int], comment: str='') -> int:
Expand Down
30 changes: 15 additions & 15 deletions pyNastran/dev/bdf_vectorized3/bdf_interface/bdf_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from pyNastran.dev.bdf_vectorized3.cards.elements.mass import CONM1, CONM2
from pyNastran.dev.bdf_vectorized3.cards.elements.cmass import PMASS, CMASS1, CMASS2, CMASS3, CMASS4
from pyNastran.dev.bdf_vectorized3.cards.elements.nsm import NSMADD, NSM, NSM1, NSML, NSML1
#from pyNastran.dev.bdf_vectorized3.cards.elements.thermal import CHBDYE, CHBDYP, CHBDYG, CONV, PCONV, CONVM, PCONVM, PHBDY
from pyNastran.dev.bdf_vectorized3.cards.elements.thermal import CHBDYE, CHBDYP, CHBDYG, CONV, PCONV, CONVM, PCONVM, PHBDY
from pyNastran.dev.bdf_vectorized3.cards.elements.plot import PLOTEL, PLOTEL3, PLOTEL4, PLOTEL6, PLOTEL8

from pyNastran.dev.bdf_vectorized3.cards.loads.static_loads import (
Expand Down Expand Up @@ -439,20 +439,20 @@ def __init__(self):
self.nsml1 = NSML1(self)

# thermal
#self.bdyor = None
#self.chbdye = CHBDYE(self)
#self.chbdyp = CHBDYP(self)
#self.chbdyg = CHBDYG(self)
#self.phbdy = PHBDY(self)
self.bdyor = None
self.chbdye = CHBDYE(self)
self.chbdyp = CHBDYP(self)
self.chbdyg = CHBDYG(self)
self.phbdy = PHBDY(self)

#self.chacab = CHACAB(self)
#self.chacbr = CHACBR(self)

# thermal boundary conditions
#self.conv = CONV(self)
#self.pconv = PCONV(self)
#self.convm = CONVM(self)
#self.pconvm = PCONVM(self)
self.conv = CONV(self)
self.pconv = PCONV(self)
self.convm = CONVM(self)
self.pconvm = PCONVM(self)

# loads
self.load = LOAD(self)
Expand Down Expand Up @@ -925,16 +925,16 @@ def nonstructural_mass_cards(self) -> list[Any]:
@property
def thermal_element_cards(self) -> list[Any]:
thermal_elements = [
#self.chbdye, self.chbdyg, self.chbdyp, self.phbdy,
self.chbdye, self.chbdyg, self.chbdyp, self.phbdy,
]
return thermal_elements

@property
def thermal_boundary_condition_cards(self) -> list[Any]:
boundary_conditions = [
#self.conv, self.pconv,
#self.convm, self.pconvm,
#self.tempbc,
self.conv, self.pconv,
self.convm, self.pconvm,
self.tempbc,
self.radbc, self.radm, self.radset,
]
return boundary_conditions
Expand Down Expand Up @@ -1647,7 +1647,7 @@ def quality(self, cards_to_read: Optional[Set[str]]=None):
cards_to_read : set[str]
cards that won't be included in element_ids
"""
assert len(self.grid), 'No grids'
#assert len(self.grid), 'No grids'
# list of elements that have no quality results
NO_QUALITY = {
'CELAS1', 'CELAS2', 'CELAS3', 'CELAS4',
Expand Down
38 changes: 19 additions & 19 deletions pyNastran/dev/bdf_vectorized3/bdf_interface/write_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,22 +772,22 @@ def _write_thermal(self, bdf_file: TextIOLike, size: int=8, is_double: bool=Fals
is_thermal = any([card.n > 0 for card in model.thermal_element_cards])
if is_thermal:
bdf_file.write('$THERMAL_ELEMENTS\n')
bdf_file.write(model.chbdye.write(size=size))
bdf_file.write(model.chbdyp.write(size=size))
bdf_file.write(model.chbdyg.write(size=size))
bdf_file.write(model.phbdy.write(size=size))
model.chbdye.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.chbdyp.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.chbdyg.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.phbdy.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)

is_thermal = any([card.n > 0 for card in model.thermal_boundary_condition_cards])
if is_thermal and 0:
bdf_file.write(model.conv.write(size=size))
bdf_file.write(model.pconv.write(size=size))
bdf_file.write(model.convm.write(size=size))
bdf_file.write(model.pconvm.write(size=size))
if is_thermal:
model.conv.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.pconv.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.convm.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.pconvm.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)

bdf_file.write(model.tempbc.write(size=size))
bdf_file.write(model.radbc.write(size=size))
bdf_file.write(model.radm.write(size=size))
bdf_file.write(model.radset.write(size=size))
model.radbc.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.radm.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.radset.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.tempbc.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)

def _write_thermal_materials(self, bdf_file: TextIOLike,
size: int=8, is_double: bool=False,
Expand Down Expand Up @@ -829,12 +829,12 @@ def _write_aero_control(self, bdf_file: TextIOLike,
#for (unused_id, aecomp) in sorted(model.aecomps.items()):
#bdf_file.write(aecomp.write_card(size, is_double))

bdf_file.write(model.aeparm.write(size, is_double))
bdf_file.write(model.aestat.write(size, is_double))
bdf_file.write(model.aesurf.write(size, is_double))
bdf_file.write(model.aesurfs.write(size, is_double))
bdf_file.write(model.aefact.write(size=size))
bdf_file.write(model.aelink.write(size=size))
model.aeparm.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.aestat.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.aesurf.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.aesurfs.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.aefact.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)
model.aelink.write_file(bdf_file, size=size, is_double=is_double, write_card_header=False)

def _write_static_aero(self, bdf_file: TextIOLike,
size: int=8, is_double: bool=False,
Expand Down
Loading

0 comments on commit 9ea8541

Please sign in to comment.