Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move mach wrappers out #98

Merged
merged 7 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ dist/
tests/input_files/*.xyz

.ropeproject

# n2s that might be generated under examples
examples/**/*.html
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to do the same for the tests? I find that I have many n2 diagrams in the tests directories too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that is fine for me. Those N2s are used for the documentation I think but we are not tracking them so might be a good idea to add them to gitignore

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import openmdao.api as om
from mphys.multipoint import Multipoint
from mphys.solver_builders.mphys_adflow import ADflowBuilder
from adflow.mphys import ADflowBuilder
from baseclasses import AeroProblem
from mphys.scenario_aerodynamic import ScenarioAerodynamic

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import openmdao.api as om
from mphys.multipoint import Multipoint
from mphys.solver_builders.mphys_adflow import ADflowBuilder
from baseclasses import AeroProblem
from mphys.scenario_aerodynamic import ScenarioAerodynamic
from mphys.solver_builders.mphys_dvgeo import OM_DVGEOCOMP
from adflow.mphys import ADflowBuilder
from baseclasses import AeroProblem
from pygeo.mphys import OM_DVGEOCOMP

import argparse

Expand Down Expand Up @@ -127,12 +127,12 @@ def twist(val, geo):
teList = [[4.99, 0, 0.001], [8.99, 0, 13.99]]
self.geometry.nom_addThicknessConstraints2D("thickcon", leList, teList, nSpan=10, nChord=10)
self.geometry.nom_addVolumeConstraint("volcon", leList, teList, nSpan=20, nChord=20)
nLECon = self.geometry.nom_add_LETEConstraint(
self.geometry.nom_add_LETEConstraint(
"lecon",
0,
"iLow",
)
nTECon = self.geometry.nom_add_LETEConstraint("tecon", 0, "iHigh")
self.geometry.nom_add_LETEConstraint("tecon", 0, "iHigh")
# add dvs to ivc and connect
self.dvs.add_output("aoa", val=aoa, units="deg")
self.dvs.add_output("local", val=np.array([0] * nLocal))
Expand Down Expand Up @@ -177,11 +177,11 @@ def twist(val, geo):
# 'Difference interval':1.0e-6,
# 'Hessian full memory':None,
"Hessian frequency": 200,
#'Linesearch tolerance':0.99,
# 'Linesearch tolerance':0.99,
"Print file": "SNOPT_print.out",
"Summary file": "SNOPT_summary.out",
"Problem Type": "Minimize",
#'New superbasics limit':500,
# 'New superbasics limit':500,
"Penalty parameter": 1.0,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import openmdao.api as om
from mphys.multipoint import Multipoint
from mphys.solver_builders.mphys_adflow import ADflowBuilder
from baseclasses import AeroProblem
from mphys.scenario_aerodynamic import ScenarioAerodynamic
from mphys.solver_builders.mphys_dvgeo import OM_DVGEOCOMP
from adflow.mphys import ADflowBuilder
from baseclasses import AeroProblem
from pygeo.mphys import OM_DVGEOCOMP

import argparse

Expand Down Expand Up @@ -178,11 +178,11 @@ def twist(val, geo):
# 'Difference interval':1.0e-6,
# 'Hessian full memory':None,
"Hessian frequency": 200,
#'Linesearch tolerance':0.99,
# 'Linesearch tolerance':0.99,
"Print file": "SNOPT_print.out",
"Summary file": "SNOPT_summary.out",
"Problem Type": "Minimize",
#'New superbasics limit':500,
# 'New superbasics limit':500,
"Penalty parameter": 1.0,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import numpy as np
from mpi4py import MPI

import openmdao.api as om
from mphys.multipoint import MultipointParallel
from mphys.solver_builders.mphys_adflow import ADflowBuilder
from baseclasses import AeroProblem
from mphys.scenario_aerodynamic import ScenarioAerodynamic
from mphys.solver_builders.mphys_dvgeo import OM_DVGEOCOMP
from adflow.mphys import ADflowBuilder
from baseclasses import AeroProblem

import argparse

Expand Down Expand Up @@ -192,11 +190,11 @@ def configure(self):
# 'Difference interval':1.0e-6,
# 'Hessian full memory':None,
"Hessian frequency": 200,
#'Linesearch tolerance':0.99,
# 'Linesearch tolerance':0.99,
"Print file": "SNOPT_print.out",
"Summary file": "SNOPT_summary.out",
"Problem Type": "Minimize",
#'New superbasics limit':500,
# 'New superbasics limit':500,
"Penalty parameter": 1.0,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
from mphys import Multipoint
from mphys.scenario_aerostructural import ScenarioAeroStructural

# these imports will be from the respective codes' repos rather than mphys
from mphys.solver_builders.mphys_adflow import ADflowBuilder

from adflow.mphys import ADflowBuilder
from tacs.mphys import TacsBuilder
from mphys.solver_builders.mphys_meld import MeldBuilder
from mphys.solver_builders.mphys_rlt import RltBuilder

# TODO RLT needs to be updated with the new tacs wrapper
# from rlt.mphys import RltBuilder

from baseclasses import AeroProblem

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#rst Imports
# rst Imports
from __future__ import print_function, division
import numpy as np
from mpi4py import MPI
Expand All @@ -16,8 +16,8 @@
comm = MPI.COMM_WORLD
rank = comm.rank

class Top(om.Group):

class Top(om.Group):
def setup(self):

################################################################################
Expand All @@ -44,7 +44,7 @@ def element_callback(dvNum, compID, compDescript, elemDescripts, specialDVs, **k
con = constitutive.IsoShellConstitutive(prop, t=t, tNum=dvNum)

# Define reference axis for local shell stresses
if 'SKIN' in compDescript: # USKIN + LSKIN
if "SKIN" in compDescript: # USKIN + LSKIN
sweep = 35.0 / 180.0 * np.pi
refAxis = np.array([np.sin(sweep), np.cos(sweep), 0])
else: # RIBS + SPARS + ENGINE_MOUNT
Expand All @@ -63,19 +63,20 @@ def problem_setup(scenario_name, fea_assembler, problem):
"""

# Add TACS Functions
problem.addFunction('mass', functions.StructuralMass)
problem.addFunction('ks_vmfailure', functions.KSFailure, safetyFactor=1.0,
ksWeight=100.0)
problem.addFunction("mass", functions.StructuralMass)
problem.addFunction("ks_vmfailure", functions.KSFailure, safetyFactor=1.0, ksWeight=100.0)

# Add forces to static problem
F = fea_assembler.createVec()
ndof = fea_assembler.getVarsPerNode()
F[2::ndof] = 100.0
problem.addLoadToRHS(F)

tacs_options = {'element_callback': element_callback,
'problem_setup': problem_setup,
'mesh_file': 'wingbox.bdf'}
tacs_options = {
"element_callback": element_callback,
"problem_setup": problem_setup,
"mesh_file": "wingbox.bdf",
}

tacs_builder = TacsBuilder(tacs_options, coupled=False)
tacs_builder.initialize(self.comm)
Expand All @@ -85,25 +86,22 @@ def problem_setup(scenario_name, fea_assembler, problem):
################################################################################

# ivc to keep the top level DVs
dvs = self.add_subsystem('dvs', om.IndepVarComp(), promotes=['*'])
dvs = self.add_subsystem("dvs", om.IndepVarComp(), promotes=["*"])

# create the multiphysics multipoint group.
mp = self.add_subsystem(
'mp_group',
Multipoint()
)
mp = self.add_subsystem("mp_group", Multipoint())

# add the structural thickness DVs
ndv_struct = tacs_builder.get_ndv()
self.dvs.add_output('dv_struct', np.array(ndv_struct * [0.01]))
self.dvs.add_output("dv_struct", np.array(ndv_struct * [0.01]))

mp.add_subsystem('mesh', tacs_builder.get_mesh_coordinate_subsystem())
mp.add_subsystem("mesh", tacs_builder.get_mesh_coordinate_subsystem())
# this is the method that needs to be called for every point in this mp_group
mp.mphys_add_scenario('s0',
ScenarioStructural(struct_builder=tacs_builder))
mp.mphys_connect_scenario_coordinate_source('mesh', 's0', 'struct')
mp.mphys_add_scenario("s0", ScenarioStructural(struct_builder=tacs_builder))
mp.mphys_connect_scenario_coordinate_source("mesh", "s0", "struct")

self.connect("dv_struct", "mp_group.s0.dv_struct")

self.connect('dv_struct', 'mp_group.s0.dv_struct')

################################################################################
# OpenMDAO setup
Expand All @@ -112,7 +110,7 @@ def problem_setup(scenario_name, fea_assembler, problem):
prob.model = Top()
model = prob.model
prob.setup()
om.n2(prob, show_browser=False, outfile='mphys_struct.html')
om.n2(prob, show_browser=False, outfile="mphys_struct.html")
prob.run_model()
# prob.model.list_outputs()
if MPI.COMM_WORLD.rank == 0:
Expand Down
Loading