Skip to content
Snippets Groups Projects
Commit 9256de54 authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Adapt API to new MshCrack/Deform

parent ddda1874
No related branches found
No related tags found
No related merge requests found
Pipeline #6861 passed
...@@ -122,17 +122,21 @@ def initDart(cfg, scenario='aerodynamic', task='analysis'): ...@@ -122,17 +122,21 @@ def initDart(cfg, scenario='aerodynamic', task='analysis'):
if _dim == 2: if _dim == 2:
mshCrck = tbox.MshCrack(_msh, _dim) mshCrck = tbox.MshCrack(_msh, _dim)
mshCrck.setCrack(cfg['Wake']) mshCrck.setCrack(cfg['Wake'])
mshCrck.addBoundaries([cfg['Fluid'], cfg['Farfield'][-1], cfg['Wing']]) mshCrck.addBoundary(cfg['Fluid'])
mshCrck.addBoundary(cfg['Farfield'][-1])
mshCrck.addBoundary(cfg['Wing'])
mshCrck.run() mshCrck.run()
else: else:
for i in range(len(cfg['Wakes'])): for i in range(len(cfg['Wakes'])):
mshCrck = tbox.MshCrack(_msh, _dim) mshCrck = tbox.MshCrack(_msh, _dim)
mshCrck.setCrack(cfg['Wakes'][i]) mshCrck.setCrack(cfg['Wakes'][i])
mshCrck.addBoundaries([cfg['Fluid'], cfg['Farfield'][-1], cfg['Wings'][i]]) mshCrck.addBoundary(cfg['Fluid'])
mshCrck.addBoundary(cfg['Farfield'][-1])
mshCrck.addBoundary(cfg['Wings'][i])
if 'Fuselage' in cfg: if 'Fuselage' in cfg:
mshCrck.addBoundaries([cfg['Fuselage']]) mshCrck.addBoundary(cfg['Fuselage'])
if 'Symmetry' in cfg: if 'Symmetry' in cfg:
mshCrck.addBoundaries([cfg['Symmetry']]) mshCrck.addBoundary(cfg['Symmetry'])
if 'WakeTips' in cfg: if 'WakeTips' in cfg:
mshCrck.setExcluded(cfg['WakeTips'][i]) # 3D computations (not excluded for 2.5D) mshCrck.setExcluded(cfg['WakeTips'][i]) # 3D computations (not excluded for 2.5D)
mshCrck.run() mshCrck.run()
...@@ -146,20 +150,22 @@ def initDart(cfg, scenario='aerodynamic', task='analysis'): ...@@ -146,20 +150,22 @@ def initDart(cfg, scenario='aerodynamic', task='analysis'):
if scenario == 'aerostructural' or task == 'optimization': if scenario == 'aerostructural' or task == 'optimization':
_mrf = tbox.MshDeform(_msh, tbox.Gmres(1, 1e-6, 30, 1e-8), _dim, nthrds=nthrd, vrb=verb) _mrf = tbox.MshDeform(_msh, tbox.Gmres(1, 1e-6, 30, 1e-8), _dim, nthrds=nthrd, vrb=verb)
_mrf.setField(cfg['Fluid']) _mrf.setField(cfg['Fluid'])
_mrf.addFixed(cfg['Farfield']) for tag in cfg['Farfield']:
_mrf.addFixed(tag)
if _dim == 2: if _dim == 2:
_mrf.addMoving([cfg['Wing']]) _mrf.addMoving(cfg['Wing'])
_mrf.addInternal([cfg['Wake'], cfg['Wake']+'_']) _mrf.addInternal(cfg['Wake'], cfg['Wake']+'_')
else: else:
if 'Fuselage' in cfg: if 'Fuselage' in cfg:
_mrf.addFixed(cfg['Fuselage']) _mrf.addFixed(cfg['Fuselage'])
_mrf.setSymmetry(cfg['Symmetry'], 1) if 'Symmetry' in cfg:
_mrf.setSymmetry(cfg['Symmetry'], 1)
for i in range(len(cfg['Wings'])): for i in range(len(cfg['Wings'])):
if i == 0: if i == 0:
_mrf.addMoving([cfg['Wings'][i]]) # TODO body of interest (FSI/OPT) is always first given body _mrf.addMoving(cfg['Wings'][i]) # TODO body of interest (FSI/OPT) is always first given body
else: else:
_mrf.addFixed([cfg['Wings'][i]]) _mrf.addFixed(cfg['Wings'][i])
_mrf.addInternal([cfg['Wakes'][i], cfg['Wakes'][i]+'_']) _mrf.addInternal(cfg['Wakes'][i], cfg['Wakes'][i]+'_')
_mrf.initialize() _mrf.initialize()
else: else:
_mrf = None _mrf = None
......
...@@ -23,7 +23,7 @@ from fwk.wutils import parseargs ...@@ -23,7 +23,7 @@ from fwk.wutils import parseargs
import dart import dart
import tbox import tbox
def mesh(dim, file, pars, bnd, wk = 'wake', wktp = None): def mesh(dim, file, pars, bnds, wk = 'wake', wktp = None):
"""Initialize mesh and mesh writer """Initialize mesh and mesh writer
Parameters Parameters
...@@ -34,7 +34,7 @@ def mesh(dim, file, pars, bnd, wk = 'wake', wktp = None): ...@@ -34,7 +34,7 @@ def mesh(dim, file, pars, bnd, wk = 'wake', wktp = None):
file contaning mesh (w/o extention) file contaning mesh (w/o extention)
pars : dict pars : dict
parameters for mesh parameters for mesh
bnd : array of str bnds : array of str
names of crack (wake) boundaries physical tag names of crack (wake) boundaries physical tag
wk : str (optional) wk : str (optional)
name of crack (wake) physical tag name of crack (wake) physical tag
...@@ -47,7 +47,8 @@ def mesh(dim, file, pars, bnd, wk = 'wake', wktp = None): ...@@ -47,7 +47,8 @@ def mesh(dim, file, pars, bnd, wk = 'wake', wktp = None):
# crack the mesh # crack the mesh
mshCrck = tbox.MshCrack(msh, dim) mshCrck = tbox.MshCrack(msh, dim)
mshCrck.setCrack(wk) mshCrck.setCrack(wk)
mshCrck.addBoundaries(bnd) for bnd in bnds:
mshCrck.addBoundary(bnd)
if dim == 3 and wktp is not None: if dim == 3 and wktp is not None:
mshCrck.setExcluded(wktp) mshCrck.setExcluded(wktp)
mshCrck.run() mshCrck.run()
...@@ -189,11 +190,12 @@ def morpher(msh, dim, mov, fxd = ['upstream', 'farfield', 'downstream'], fld = ' ...@@ -189,11 +190,12 @@ def morpher(msh, dim, mov, fxd = ['upstream', 'farfield', 'downstream'], fld = '
args = parseargs() args = parseargs()
mshDef = tbox.MshDeform(msh, tbox.Gmres(1, 1e-6, 30, 1e-8), dim, nthrds=args.k) mshDef = tbox.MshDeform(msh, tbox.Gmres(1, 1e-6, 30, 1e-8), dim, nthrds=args.k)
mshDef.setField(fld) mshDef.setField(fld)
mshDef.addFixed(fxd) for tag in fxd:
mshDef.addFixed(tag)
mshDef.addMoving(mov) mshDef.addMoving(mov)
if dim == 3: if dim == 3:
mshDef.setSymmetry(sym, 1) mshDef.setSymmetry(sym, 1)
mshDef.addInternal([wk, wk+'_']) mshDef.addInternal(wk, wk+'_')
mshDef.initialize() mshDef.initialize()
return mshDef return mshDef
......
...@@ -50,7 +50,7 @@ def main(): ...@@ -50,7 +50,7 @@ def main():
pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.0075, 'msLe' : 0.0075} pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.0075, 'msLe' : 0.0075}
msh, gmshWriter = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream']) msh, gmshWriter = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream'])
# create mesh deformation handler # create mesh deformation handler
morpher = floD.morpher(msh, dim, ['airfoil']) morpher = floD.morpher(msh, dim, 'airfoil')
tms['msh'].stop() tms['msh'].stop()
# set the problem and add fluid, initial/boundary conditions # set the problem and add fluid, initial/boundary conditions
......
...@@ -55,7 +55,7 @@ def main(): ...@@ -55,7 +55,7 @@ def main():
pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.01, 'msLe' : 0.01} pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.01, 'msLe' : 0.01}
msh, gmshWriter = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream']) msh, gmshWriter = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream'])
# create mesh deformation handler # create mesh deformation handler
morpher = floD.morpher(msh, dim, ['airfoil']) morpher = floD.morpher(msh, dim, 'airfoil')
# mesh the reference geometry # mesh the reference geometry
pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.01, 'msLe' : 0.01, 'angle' : alfa, 'xRot' : xc} pars = {'xLgt' : 5, 'yLgt' : 5, 'msF' : 1., 'msTe' : 0.01, 'msLe' : 0.01, 'angle' : alfa, 'xRot' : xc}
msh_ref, gmshWriter_ref = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream']) msh_ref, gmshWriter_ref = floD.mesh(dim, 'models/n0012.geo', pars, ['field', 'airfoil', 'downstream'])
......
...@@ -56,7 +56,7 @@ def main(): ...@@ -56,7 +56,7 @@ def main():
tms["msh"].start() tms["msh"].start()
pars = {'spn' : spn, 'lgt' : lgt, 'wdt' : wdt, 'hgt' : hgt, 'msN' : nms, 'msF' : fms} pars = {'spn' : spn, 'lgt' : lgt, 'wdt' : wdt, 'hgt' : hgt, 'msN' : nms, 'msF' : fms}
msh, gmshWriter = floD.mesh(dim, 'models/rae_25.geo', pars, ['field', 'wing', 'symmetry', 'downstream']) msh, gmshWriter = floD.mesh(dim, 'models/rae_25.geo', pars, ['field', 'wing', 'symmetry', 'downstream'])
morpher = floD.morpher(msh, dim, ['wing']) morpher = floD.morpher(msh, dim, 'wing')
tms["msh"].stop() tms["msh"].stop()
# set the problem and add fluid, initial/boundary conditions # set the problem and add fluid, initial/boundary conditions
......
...@@ -61,7 +61,7 @@ def main(): ...@@ -61,7 +61,7 @@ def main():
tms["msh"].start() tms["msh"].start()
pars = {'spn' : spn, 'lgt' : lgt, 'wdt' : wdt, 'hgt' : hgt, 'msN' : nms, 'msF' : fms} pars = {'spn' : spn, 'lgt' : lgt, 'wdt' : wdt, 'hgt' : hgt, 'msN' : nms, 'msF' : fms}
msh, gmshWriter = floD.mesh(dim, 'models/rae_3.geo', pars, ['field', 'wing', 'symmetry', 'downstream'], wktp = 'wakeTip') msh, gmshWriter = floD.mesh(dim, 'models/rae_3.geo', pars, ['field', 'wing', 'symmetry', 'downstream'], wktp = 'wakeTip')
morpher = floD.morpher(msh, dim, ['wing']) morpher = floD.morpher(msh, dim, 'wing')
tms["msh"].stop() tms["msh"].stop()
# set the problem and add fluid, initial/boundary conditions # set the problem and add fluid, initial/boundary conditions
......
...@@ -84,7 +84,7 @@ def main(): ...@@ -84,7 +84,7 @@ def main():
tms['post'].start() tms['post'].start()
if canPost: if canPost:
floU.writeSlices(msh.name,[0.01, 0.37, 0.75],5) floU.writeSlices(msh.name,[0.01, 0.37, 0.75],5)
data = tbxU.read('slice_1.dat') data = tbxU.read('agard445_slice_1.dat')
tbxU.plot(data[:,3], data[:,4], 'x', 'Cp', 'Pressure distribution at MAC', True) tbxU.plot(data[:,3], data[:,4], 'x', 'Cp', 'Pressure distribution at MAC', True)
tms['post'].stop() tms['post'].stop()
......
...@@ -82,7 +82,7 @@ def main(): ...@@ -82,7 +82,7 @@ def main():
tms['post'].start() tms['post'].start()
if canPost: if canPost:
floU.writeSlices(msh.name,[0.01, 0.239, 0.526, 0.777, 0.957, 1.076, 1.136, 1.184],5) floU.writeSlices(msh.name,[0.01, 0.239, 0.526, 0.777, 0.957, 1.076, 1.136, 1.184],5)
data = tbxU.read('slice_2.dat') data = tbxU.read('oneraM6_slice_2.dat')
tbxU.plot(data[:,3], data[:,4], 'x', 'Cp', 'Pressure distribution at MAC', True) tbxU.plot(data[:,3], data[:,4], 'x', 'Cp', 'Pressure distribution at MAC', True)
tms['post'].stop() tms['post'].stop()
......
Subproject commit 7dbafd30acd41e369b54962af8a0994af1aa55e8 Subproject commit 7a60afc9668ac6793c98f76ef79835158769c662
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment