diff --git a/funtofem/mphys/mphys_meld.py b/funtofem/mphys/mphys_meld.py index e5620091..72fb150f 100644 --- a/funtofem/mphys/mphys_meld.py +++ b/funtofem/mphys/mphys_meld.py @@ -2,10 +2,18 @@ import numpy as np import openmdao.api as om -from mphys import Builder +from mphys import Builder, MPhysVariables from funtofem import TransferScheme +# Set MPhys variable names +X_STRUCT0 = MPhysVariables.Structures.COORDINATES +X_AERO0 = MPhysVariables.Aerodynamics.Surface.COORDINATES_INITIAL +U_STRUCT = MPhysVariables.Structures.DISPLACEMENTS +U_AERO = MPhysVariables.Aerodynamics.Surface.DISPLACEMENTS +F_AERO = MPhysVariables.Aerodynamics.Surface.LOADS +F_STRUCT = MPhysVariables.Structures.Loads.AERODYNAMIC + class MeldDispXfer(om.ExplicitComponent): """ @@ -35,21 +43,21 @@ def setup(self): # inputs self.add_input( - "x_struct0", + X_STRUCT0, shape_by_conn=True, distributed=True, desc="initial structural node coordinates", tags=["mphys_coordinates"], ) self.add_input( - "x_aero0", + X_AERO0, shape_by_conn=True, distributed=True, desc="initial aero surface node coordinates", tags=["mphys_coordinates"], ) self.add_input( - "u_struct", + U_STRUCT, shape_by_conn=True, distributed=True, desc="structural node displacements", @@ -58,7 +66,7 @@ def setup(self): # outputs self.add_output( - "u_aero", + U_AERO, shape=self.aero_nnodes * 3, distributed=True, val=np.zeros(self.aero_nnodes * 3), @@ -67,24 +75,24 @@ def setup(self): ) # partials - # self.declare_partials('u_aero',['x_struct0','x_aero0','u_struct']) + # self.declare_partials(U_AERO,[X_STRUCT0,X_AERO0,U_STRUCT]) def compute(self, inputs, outputs): for body in self.bodies: x_s0 = np.array( - inputs["x_struct0"][body.struct_coord_indices], + inputs[X_STRUCT0][body.struct_coord_indices], dtype=TransferScheme.dtype, ) x_a0 = np.array( - inputs["x_aero0"][body.aero_coord_indices], dtype=TransferScheme.dtype + inputs[X_AERO0][body.aero_coord_indices], dtype=TransferScheme.dtype ) u_a = np.array( - outputs["u_aero"][body.aero_coord_indices], dtype=TransferScheme.dtype + outputs[U_AERO][body.aero_coord_indices], dtype=TransferScheme.dtype ) u_s = np.zeros(len(body.struct_coord_indices), dtype=TransferScheme.dtype) for i in range(3): - u_s[i::3] = inputs["u_struct"][ + u_s[i::3] = inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] @@ -97,7 +105,7 @@ def compute(self, inputs, outputs): body.meld.transferDisps(u_s, u_a) - outputs["u_aero"][body.aero_coord_indices] = u_a + outputs[U_AERO][body.aero_coord_indices] = u_a def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): """ @@ -111,42 +119,42 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): for body in self.bodies: if self.check_partials: x_s0 = np.array( - inputs["x_struct0"][body.struct_coord_indices], + inputs[X_STRUCT0][body.struct_coord_indices], dtype=TransferScheme.dtype, ) x_a0 = np.array( - inputs["x_aero0"][body.aero_coord_indices], + inputs[X_AERO0][body.aero_coord_indices], dtype=TransferScheme.dtype, ) body.meld.setStructNodes(x_s0) body.meld.setAeroNodes(x_a0) u_s = np.zeros(len(body.struct_coord_indices), dtype=TransferScheme.dtype) for i in range(3): - u_s[i::3] = inputs["u_struct"][ + u_s[i::3] = inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] u_a = np.zeros(len(body.aero_coord_indices), dtype=TransferScheme.dtype) body.meld.transferDisps(u_s, u_a) if mode == "fwd": - if "u_aero" in d_outputs: - if "u_struct" in d_inputs: + if U_AERO in d_outputs: + if U_STRUCT in d_inputs: d_in = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) for i in range(3): - d_in[i::3] = d_inputs["u_struct"][ + d_in[i::3] = d_inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] prod = np.zeros( len(body.aero_coord_indices), dtype=TransferScheme.dtype ) body.meld.applydDduS(d_in, prod) - d_outputs["u_aero"][body.aero_coord_indices] -= np.array( + d_outputs[U_AERO][body.aero_coord_indices] -= np.array( prod, dtype=float ) - if "x_aero0" in d_inputs: + if X_AERO0 in d_inputs: if self.check_partials: pass else: @@ -154,7 +162,7 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): "MELD forward mode requested but not implemented" ) - if "x_struct0" in d_inputs: + if X_STRUCT0 in d_inputs: if self.check_partials: pass else: @@ -163,39 +171,39 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): ) if mode == "rev": - if "u_aero" in d_outputs: + if U_AERO in d_outputs: du_a = np.array( - d_outputs["u_aero"][body.aero_coord_indices], + d_outputs[U_AERO][body.aero_coord_indices], dtype=TransferScheme.dtype, ) - if "u_struct" in d_inputs: + if U_STRUCT in d_inputs: # du_a/du_s^T * psi = - dD/du_s^T psi prod = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) body.meld.applydDduSTrans(du_a, prod) for i in range(3): - d_inputs["u_struct"][ + d_inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] -= np.array(prod[i::3], dtype=np.float64) # du_a/dx_a0^T * psi = - psi^T * dD/dx_a0 in F2F terminology - if "x_aero0" in d_inputs: + if X_AERO0 in d_inputs: prod = np.zeros( - d_inputs["x_aero0"][body.aero_coord_indices].size, + d_inputs[X_AERO0][body.aero_coord_indices].size, dtype=TransferScheme.dtype, ) body.meld.applydDdxA0(du_a, prod) - d_inputs["x_aero0"][body.aero_coord_indices] -= np.array( + d_inputs[X_AERO0][body.aero_coord_indices] -= np.array( prod, dtype=float ) - if "x_struct0" in d_inputs: + if X_STRUCT0 in d_inputs: prod = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) body.meld.applydDdxS0(du_a, prod) - d_inputs["x_struct0"][body.struct_coord_indices] -= np.array( + d_inputs[X_STRUCT0][body.struct_coord_indices] -= np.array( prod, dtype=float ) @@ -231,28 +239,28 @@ def setup(self): # inputs self.add_input( - "x_struct0", + X_STRUCT0, shape_by_conn=True, distributed=True, desc="initial structural node coordinates", tags=["mphys_coordinates"], ) self.add_input( - "x_aero0", + X_AERO0, shape_by_conn=True, distributed=True, desc="initial aero surface node coordinates", tags=["mphys_coordinates"], ) self.add_input( - "u_struct", + U_STRUCT, shape_by_conn=True, distributed=True, desc="structural node displacements", tags=["mphys_coupling"], ) self.add_input( - "f_aero", + F_AERO, shape_by_conn=True, distributed=True, desc="aerodynamic force vector", @@ -261,7 +269,7 @@ def setup(self): # outputs self.add_output( - "f_struct", + F_STRUCT, shape=struct_nnodes * struct_ndof, distributed=True, desc="structural force vector", @@ -269,34 +277,34 @@ def setup(self): ) # partials - # self.declare_partials('f_struct',['x_struct0','x_aero0','u_struct','f_aero']) + # self.declare_partials('F_STRUCT',['X_STRUCT0','X_AERO0','U_STRUCT','F_AERO']) def compute(self, inputs, outputs): - outputs["f_struct"][:] = 0.0 + outputs[F_STRUCT][:] = 0.0 for body in self.bodies: if self.check_partials: x_s0 = np.array( - inputs["x_struct0"][body.struct_coord_indices], + inputs[X_STRUCT0][body.struct_coord_indices], dtype=TransferScheme.dtype, ) x_a0 = np.array( - inputs["x_aero0"][body.aero_coord_indices], + inputs[X_AERO0][body.aero_coord_indices], dtype=TransferScheme.dtype, ) body.meld.setStructNodes(x_s0) body.meld.setAeroNodes(x_a0) f_a = np.array( - inputs["f_aero"][body.aero_coord_indices], dtype=TransferScheme.dtype + inputs[F_AERO][body.aero_coord_indices], dtype=TransferScheme.dtype ) f_s = np.zeros(len(body.struct_coord_indices), dtype=TransferScheme.dtype) u_s = np.zeros(len(body.struct_coord_indices), dtype=TransferScheme.dtype) for i in range(3): - u_s[i::3] = inputs["u_struct"][ + u_s[i::3] = inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] u_a = np.zeros( - inputs["f_aero"][body.aero_coord_indices].size, + inputs[F_AERO][body.aero_coord_indices].size, dtype=TransferScheme.dtype, ) body.meld.transferDisps(u_s, u_a) @@ -304,9 +312,9 @@ def compute(self, inputs, outputs): body.meld.transferLoads(f_a, f_s) for i in range(3): - outputs["f_struct"][body.struct_dof_indices[i :: self.struct_ndof]] = ( - f_s[i::3] - ) + outputs[F_STRUCT][body.struct_dof_indices[i :: self.struct_ndof]] = f_s[ + i::3 + ] def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): """ @@ -320,40 +328,40 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): for body in self.bodies: if self.check_partials: x_s0 = np.array( - inputs["x_struct0"][body.struct_coord_indices], + inputs[X_STRUCT0][body.struct_coord_indices], dtype=TransferScheme.dtype, ) x_a0 = np.array( - inputs["x_aero0"][body.aero_coord_indices], + inputs[X_AERO0][body.aero_coord_indices], dtype=TransferScheme.dtype, ) body.meld.setStructNodes(x_s0) body.meld.setAeroNodes(x_a0) f_a = np.array( - inputs["f_aero"][body.aero_coord_indices], dtype=TransferScheme.dtype + inputs[F_AERO][body.aero_coord_indices], dtype=TransferScheme.dtype ) f_s = np.zeros(len(body.struct_coord_indices), dtype=TransferScheme.dtype) u_s = np.zeros(len(body.struct_coord_indices), dtype=TransferScheme.dtype) for i in range(3): - u_s[i::3] = inputs["u_struct"][ + u_s[i::3] = inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] u_a = np.zeros( - inputs["f_aero"][body.aero_coord_indices].size, + inputs[F_AERO][body.aero_coord_indices].size, dtype=TransferScheme.dtype, ) body.meld.transferDisps(u_s, u_a) body.meld.transferLoads(f_a, f_s) if mode == "fwd": - if "f_struct" in d_outputs: - if "u_struct" in d_inputs: + if F_STRUCT in d_outputs: + if U_STRUCT in d_inputs: d_in = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) for i in range(3): - d_in[i::3] = d_inputs["u_struct"][ + d_in[i::3] = d_inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] prod = np.zeros( @@ -361,26 +369,26 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): ) body.meld.applydLduS(d_in, prod) for i in range(3): - d_outputs["f_struct"][ + d_outputs[F_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] -= np.array(prod[i::3], dtype=float) - if "f_aero" in d_inputs: + if F_AERO in d_inputs: # df_s/df_a psi = - dL/df_a * psi = -dD/du_s^T * psi prod = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) df_a = np.array( - d_inputs["f_aero"][body.aero_coord_indices], + d_inputs[F_AERO][body.aero_coord_indices], dtype=TransferScheme.dtype, ) body.meld.applydDduSTrans(df_a, prod) for i in range(3): - d_outputs["f_struct"][ + d_outputs[F_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] -= np.array(prod[i::3], dtype=float) - if "x_aero0" in d_inputs: + if X_AERO0 in d_inputs: if self.check_partials: pass else: @@ -388,7 +396,7 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): "forward mode requested but not implemented" ) - if "x_struct0" in d_inputs: + if X_STRUCT0 in d_inputs: if self.check_partials: pass else: @@ -397,16 +405,16 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): ) if mode == "rev": - if "f_struct" in d_outputs: + if F_STRUCT in d_outputs: d_out = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) for i in range(3): - d_out[i::3] = d_outputs["f_struct"][ + d_out[i::3] = d_outputs[F_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] - if "u_struct" in d_inputs: + if U_STRUCT in d_inputs: d_in = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) @@ -414,37 +422,37 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): body.meld.applydLduSTrans(d_out, d_in) for i in range(3): - d_inputs["u_struct"][ + d_inputs[U_STRUCT][ body.struct_dof_indices[i :: self.struct_ndof] ] -= np.array(d_in[i::3], dtype=float) - if "f_aero" in d_inputs: + if F_AERO in d_inputs: # df_s/df_a^T psi = - dL/df_a^T * psi = -dD/du_s * psi prod = np.zeros( len(body.aero_coord_indices), dtype=TransferScheme.dtype ) body.meld.applydDduS(d_out, prod) - d_inputs["f_aero"][body.aero_coord_indices] -= np.array( + d_inputs[F_AERO][body.aero_coord_indices] -= np.array( prod, dtype=float ) - if "x_aero0" in d_inputs: + if X_AERO0 in d_inputs: # df_s/dx_a0^T * psi = - psi^T * dL/dx_a0 in F2F terminology prod = np.zeros( len(body.aero_coord_indices), dtype=TransferScheme.dtype ) body.meld.applydLdxA0(d_out, prod) - d_inputs["x_aero0"][body.aero_coord_indices] -= np.array( + d_inputs[X_AERO0][body.aero_coord_indices] -= np.array( prod, dtype=float ) - if "x_struct0" in d_inputs: + if X_STRUCT0 in d_inputs: # df_s/dx_s0^T * psi = - psi^T * dL/dx_s0 in F2F terminology prod = np.zeros( len(body.struct_coord_indices), dtype=TransferScheme.dtype ) body.meld.applydLdxS0(d_out, prod) - d_inputs["x_struct0"][body.struct_coord_indices] -= np.array( + d_inputs[X_STRUCT0][body.struct_coord_indices] -= np.array( prod, dtype=float ) diff --git a/funtofem/mphys/mphys_meldthermal.py b/funtofem/mphys/mphys_meldthermal.py index ae36edb7..c40fca44 100644 --- a/funtofem/mphys/mphys_meldthermal.py +++ b/funtofem/mphys/mphys_meldthermal.py @@ -3,11 +3,19 @@ import numpy as np import openmdao.api as om from funtofem import TransferScheme -from mphys import Builder +from mphys import Builder, MPhysVariables """ builder and components to wrap meld thermal to transfert temperature and heat transfer rate between the convective and conductive analysis.""" +# Set MPhys variable names +X_THERMAL0 = MPhysVariables.Thermal.Mesh.COORDINATES +X_AERO_SURFACE0 = MPhysVariables.Aerodynamics.Surface.COORDINATES_INITIAL +T_THERMAL = MPhysVariables.Thermal.TEMPERATURE +T_AERO = MPhysVariables.Aerodynamics.Surface.TEMPERATURE +Q_AERO = MPhysVariables.Aerodynamics.Surface.HEAT_FLOW +Q_THERMAL = MPhysVariables.Thermal.HeatFlow.AERODYNAMIC + class MeldTempXfer(om.ExplicitComponent): """ @@ -39,16 +47,16 @@ def setup(self): self.check_partials = self.options["check_partials"] aero_nnodes = self.aero_nnodes - # intialization inputs + # initialization inputs self.add_input( - "x_thermal_surface0", + X_THERMAL0, distributed=True, shape_by_conn=True, desc="initial thermal node coordinates", tags=["mphys_coordinates"], ) self.add_input( - "x_aero_surface0", + X_AERO_SURFACE0, distributed=True, shape_by_conn=True, desc="initial aerodynamic surface node coordinates", @@ -56,7 +64,7 @@ def setup(self): ) # inputs self.add_input( - "T_conduct", + T_THERMAL, distributed=True, shape_by_conn=True, desc="thermalive node displacements", @@ -66,7 +74,7 @@ def setup(self): # outputs self.add_output( - "T_convect", + T_AERO, shape_by_conn=True, distributed=True, desc="aero surface temperatures", @@ -76,24 +84,20 @@ def setup(self): def compute(self, inputs, outputs): if not self.meld_initialized: - x_thermal_surface0 = np.array( - inputs["x_thermal_surface0"], dtype=TransferScheme.dtype - ) - x_aero_surface0 = np.array( - inputs["x_aero_surface0"], dtype=TransferScheme.dtype - ) + x_t0 = np.array(inputs[X_THERMAL0], dtype=TransferScheme.dtype) + x_a0 = np.array(inputs[X_AERO_SURFACE0], dtype=TransferScheme.dtype) - self.meldThermal.setStructNodes(x_thermal_surface0) - self.meldThermal.setAeroNodes(x_aero_surface0) + self.meldThermal.setStructNodes(x_t0) + self.meldThermal.setAeroNodes(x_a0) self.meldThermal.initialize() self.meld_initialized = True - T_conduct = np.array(inputs["T_conduct"], dtype=TransferScheme.dtype) - T_convect = np.array(outputs["T_convect"], dtype=TransferScheme.dtype) + T_t = np.array(inputs[T_THERMAL], dtype=TransferScheme.dtype) + T_a = np.array(outputs[T_AERO], dtype=TransferScheme.dtype) - self.meldThermal.transferTemp(T_conduct, T_convect) - outputs["T_convect"] = T_convect + self.meldThermal.transferTemp(T_t, T_a) + outputs[T_AERO] = T_a def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): """ @@ -106,46 +110,42 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): meld = self.meldThermal if mode == "fwd": - if "T_convect" in d_outputs: - if "T_conduct" in d_inputs: - d_T_conduct = np.array( - d_inputs["T_conduct"], dtype=TransferScheme.dtype + if T_AERO in d_outputs: + if T_THERMAL in d_inputs: + d_T_thermal = np.array( + d_inputs[T_THERMAL], dtype=TransferScheme.dtype ) - prod = np.zeros( - d_outputs["T_convect"].size, dtype=TransferScheme.dtype - ) + prod = np.zeros(d_outputs[T_AERO].size, dtype=TransferScheme.dtype) - meld.applydTdtS(d_T_conduct, prod) - d_outputs["T_convect"] += np.array(prod, dtype=float) + meld.applydTdtS(d_T_thermal, prod) + d_outputs[T_AERO] += np.array(prod, dtype=float) - if "x_aero_surface0" in d_inputs: + if X_AERO_SURFACE0 in d_inputs: if self.check_partials: pass else: raise ValueError("forward mode requested but not implemented") - if "x_thermal_surface0" in d_inputs: + if X_THERMAL0 in d_inputs: if self.check_partials: pass else: raise ValueError("forward mode requested but not implemented") if mode == "rev": - if "T_convect" in d_outputs: - dT_convect = np.array( - d_outputs["T_convect"], dtype=TransferScheme.dtype - ) - if "T_conduct" in d_inputs: - # dT_convect/dT_conduct^T * psi = - dD/dT_conduct^T psi + if T_AERO in d_outputs: + dT_aero = np.array(d_outputs[T_AERO], dtype=TransferScheme.dtype) + if T_THERMAL in d_inputs: + # dT_aero/dT_THERMAL^T * psi = - dD/dT_THERMAL^T psi prod = np.zeros( - d_inputs["T_conduct"].size, dtype=TransferScheme.dtype + d_inputs[T_THERMAL].size, dtype=TransferScheme.dtype ) - meld.applydTdtSTrans(dT_convect, prod) + meld.applydTdtSTrans(dT_aero, prod) - d_inputs["T_conduct"] -= np.array(prod, dtype=np.float64) + d_inputs[T_THERMAL] -= np.array(prod, dtype=np.float64) class MeldHeatXfer(om.ExplicitComponent): @@ -180,14 +180,14 @@ def setup(self): # initialization inputs self.add_input( - "x_thermal_surface0", + X_THERMAL0, distributed=True, shape_by_conn=True, desc="initial thermal node coordinates", tags=["mphys_coordinates"], ) self.add_input( - "x_aero_surface0", + X_AERO_SURFACE0, distributed=True, shape_by_conn=True, desc="initial aerodynamic surface node coordinates", @@ -196,7 +196,7 @@ def setup(self): # inputs self.add_input( - "q_convect", + Q_AERO, distributed=True, shape_by_conn=True, desc="initial aero heat transfer rate", @@ -205,7 +205,7 @@ def setup(self): # outputs self.add_output( - "q_conduct", + Q_THERMAL, distributed=True, shape_by_conn=True, desc="heat transfer rate on the thermalion mesh at the interface", @@ -216,23 +216,19 @@ def setup(self): def compute(self, inputs, outputs): if not self.meld_initialized: - x_thermal_surface0 = np.array( - inputs["x_thermal_surface0"], dtype=TransferScheme.dtype - ) - x_aero_surface0 = np.array( - inputs["x_aero_surface0"], dtype=TransferScheme.dtype - ) + x_t0 = np.array(inputs[X_THERMAL0], dtype=TransferScheme.dtype) + x_a0 = np.array(inputs[X_AERO_SURFACE0], dtype=TransferScheme.dtype) - self.meldThermal.setStructNodes(x_thermal_surface0) - self.meldThermal.setAeroNodes(x_aero_surface0) + self.meldThermal.setStructNodes(x_t0) + self.meldThermal.setAeroNodes(x_a0) self.meldThermal.initialize() self.meld_initialized = True - heat_convect = np.array(inputs["q_convect"], dtype=TransferScheme.dtype) - heat_conduct = np.array(outputs["q_conduct"], dtype=TransferScheme.dtype) - self.meldThermal.transferFlux(heat_convect, heat_conduct) - outputs["q_conduct"] = heat_conduct + heaT_AERO = np.array(inputs[Q_AERO], dtype=TransferScheme.dtype) + heaT_THERMAL = np.array(outputs[Q_THERMAL], dtype=TransferScheme.dtype) + self.meldThermal.transferFlux(heaT_AERO, heaT_THERMAL) + outputs[Q_THERMAL] = heaT_THERMAL def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): """ @@ -245,44 +241,38 @@ def compute_jacvec_product(self, inputs, d_inputs, d_outputs, mode): meld = self.meldThermal if mode == "fwd": - if "q_conduct" in d_outputs: - if "q_convect" in d_inputs: - d_q_convect = np.array( - d_inputs["q_convect"], dtype=TransferScheme.dtype - ) + if Q_THERMAL in d_outputs: + if Q_AERO in d_inputs: + d_q_aero = np.array(d_inputs[Q_AERO], dtype=TransferScheme.dtype) prod = np.zeros( - d_outputs["q_conduct"].size, dtype=TransferScheme.dtype + d_outputs[Q_THERMAL].size, dtype=TransferScheme.dtype ) - meld.applydQdqA(d_q_convect, prod) - d_outputs["q_conduct"] += np.array(prod, dtype=np.float64) + meld.applydQdqA(d_q_aero, prod) + d_outputs[Q_THERMAL] += np.array(prod, dtype=np.float64) - if "x_aero_surface0" in d_inputs: + if X_AERO_SURFACE0 in d_inputs: if self.check_partials: pass else: raise ValueError("forward mode requested but not implemented") - if "x_thermal_surface0" in d_inputs: + if X_THERMAL0 in d_inputs: if self.check_partials: pass else: raise ValueError("forward mode requested but not implemented") if mode == "rev": - if "q_conduct" in d_outputs: - dq_conduct = np.array( - d_outputs["q_conduct"], dtype=TransferScheme.dtype - ) - if "q_convect" in d_inputs: - prod = np.zeros( - d_inputs["q_convect"].size, dtype=TransferScheme.dtype - ) + if Q_THERMAL in d_outputs: + dq_thermal = np.array(d_outputs[Q_THERMAL], dtype=TransferScheme.dtype) + if Q_AERO in d_inputs: + prod = np.zeros(d_inputs[Q_AERO].size, dtype=TransferScheme.dtype) - meld.applydQdqATrans(dq_conduct, prod) + meld.applydQdqATrans(dq_thermal, prod) - d_inputs["q_convect"] -= np.array(prod, dtype=np.float64) + d_inputs[Q_AERO] -= np.array(prod, dtype=np.float64) class MeldThermalBuilder(Builder): diff --git a/setup.py b/setup.py index 45043067..fd15506d 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ def get_mpi_flags(): optional_dependencies = { "testing": ["testflo>=1.4.7"], "docs": ["sphinx"], - "mphys": ["mphys>=1.1.0", "openmdao>=3.25.0"], + "mphys": ["mphys>=2.0.0", "openmdao>=3.25.0"], "plots": ["niceplots"], }