53 #ifndef ROL_CYLINDERHEAD_HPP
54 #define ROL_CYLINDERHEAD_HPP
67 Real
warranty(
const Real flatness,
const int deriv = 0)
const {
68 const Real w0(1e5), w1(1.5e4), w2(4),
zero(0);
69 return (deriv==0 ? w0 + w1*(w2 - flatness)
70 :(deriv==1 ? -w1 : zero));
73 Real
horsepower(
const Real dintake,
const int deriv = 0)
const {
74 const Real d0(250), d1(200), d2(1), d3(1.833),
zero(0);
75 return (deriv==0 ? d0 + d1*(dintake/d3 - d2)
76 :(deriv==1 ? d1/d3 : zero));
82 Real
value(
const std::vector<Real> &x, Real &tol ) {
83 const Real w0(1e5), h0(250);
87 void gradient( std::vector<Real> &g,
const std::vector<Real> &x, Real &tol ) {
88 const Real w0(1e5), h0(250);
93 void hessVec( std::vector<Real> &hv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
94 const Real w0(1e5), h0(250);
104 Real
warranty(
const Real flatness,
const int deriv = 0)
const {
105 const Real w0(1e5), w1(1.5e4), w2(4),
zero(0);
106 return (deriv==0 ? w0 + w1*(w2 - flatness)
107 :(deriv==1 ? -w1 : zero));
110 Real
tcycle(
const Real flatness,
const int deriv = 0)
const {
111 const Real t0(45), t1(4.5), t2(4), tpwr(1.5), one(1);
112 return (deriv==0 ? t0 + t1*std::pow(t2 - flatness, tpwr)
113 :(deriv==1 ? -t1*tpwr*std::sqrt(t2 - flatness)
114 : t1*tpwr*(tpwr-one)/std::sqrt(t2 - flatness)));
117 Real
twall(
const Real dintake,
const int deriv = 0)
const {
118 const Real ointake(3.25), oexhaust(1.34), dexhaust(1.556), half(0.5),
zero(0);
119 return (deriv==0 ? ointake - oexhaust - half*(dintake + dexhaust)
120 :(deriv==1 ? -half : zero));
123 Real
smax(
const Real tw,
const int deriv = 0)
const {
124 const Real s0(750), spwr(2.5), one(1), two(2);
125 return (deriv==0 ? s0 + one/std::pow(tw, spwr)
126 :(deriv==1 ? -spwr/std::pow(tw, spwr+one)
127 : spwr*(spwr+one)/std::pow(tw, spwr+two)));
133 void value( std::vector<Real> &c,
const std::vector<Real> &x, Real &tol ) {
134 const Real one(1), two(2), sixty(60), syield(3000), w0(1e5);
135 c[0] = two*
smax(
twall(x[0],0),0)/syield - one;
137 c[2] =
tcycle(x[1],0)/sixty - one;
140 void applyJacobian( std::vector<Real> &jv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
141 const Real two(2), sixty(60), syield(3000), w0(1e5);
143 jv[1] = -
warranty(x[1],1)/w0 * v[1];
144 jv[2] =
tcycle(x[1],1)/sixty * v[1];
147 void applyAdjointJacobian( std::vector<Real> &ajv,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
148 const Real two(2), sixty(60), syield(3000), w0(1e5);
150 ajv[1] = -
warranty(x[1],1)/w0 * v[1] +
tcycle(x[1],1)/sixty * v[2];
153 void applyAdjointHessian( std::vector<Real> &ahuv,
const std::vector<Real> &u,
const std::vector<Real> &v,
const std::vector<Real> &x, Real &tol ) {
154 const Real two(2), sixty(60), syield(3000), w0(1e5);
155 Real tw =
twall(x[0],0);
157 +
smax(tw,1) *
twall(x[0],2))/syield * u[0] * v[0];
158 ahuv[1] = (-
warranty(x[1],2)/w0 * u[1] +
tcycle(x[1],2)/sixty * u[2]) * v[1];
169 return makePtr<Objective_CylinderHead<Real>>();
174 Ptr<std::vector<Real>> scale = makePtr<std::vector<Real>>(n,
static_cast<Real
>(1.0));
175 Ptr<std::vector<Real>> xp = makePtr<std::vector<Real>>(n,
static_cast<Real
>(0.0));
176 (*xp)[0] =
static_cast<Real
>(1.8);
177 (*xp)[1] =
static_cast<Real
>(1.0);
178 return makePtr<PrimalScaledStdVector<Real>>(xp,scale);
183 Ptr<std::vector<Real>> scale = makePtr<std::vector<Real>>(n,
static_cast<Real
>(1.0));
184 Ptr<std::vector<Real>> xp = makePtr<std::vector<Real>>(n,
static_cast<Real
>(0.0));
185 (*xp)[0] =
static_cast<Real
>(2.122);
186 (*xp)[1] =
static_cast<Real
>(1.769);
187 return makePtr<PrimalScaledStdVector<Real>>(xp,scale);
192 Ptr<std::vector<Real>> scale = makePtr<std::vector<Real>>(n,
static_cast<Real
>(1.0));
193 Ptr<std::vector<Real>> lp = makePtr<std::vector<Real>>(n,
static_cast<Real
>(0.0));
194 Ptr<std::vector<Real>> up = makePtr<std::vector<Real>>(n,
static_cast<Real
>(0.0));
195 (*lp)[0] =
static_cast<Real
>(1.5);
196 (*lp)[1] =
static_cast<Real
>(0.0);
197 (*up)[0] =
static_cast<Real
>(2.164);
198 (*up)[1] =
static_cast<Real
>(4.0);
199 Ptr<Vector<Real>> l = makePtr<PrimalScaledStdVector<Real>>(lp,scale);
200 Ptr<Vector<Real>> u = makePtr<PrimalScaledStdVector<Real>>(up,scale);
201 return makePtr<Bounds<Real>>(l,u);
205 return makePtr<Constraint_CylinderHead<Real>>();
209 Ptr<std::vector<Real>> scale = makePtr<std::vector<Real>>(3,
static_cast<Real
>(1.0));
210 Ptr<std::vector<Real>> lp = makePtr<std::vector<Real>>(3,
static_cast<Real
>(0.0));
211 return makePtr<DualScaledStdVector<Real>>(lp,scale);
215 Ptr<std::vector<Real>> scale = makePtr<std::vector<Real>>(3,
static_cast<Real
>(1.0));
216 Ptr<std::vector<Real>> up = makePtr<std::vector<Real>>(3,
static_cast<Real
>(0.0));
217 Ptr<Vector<Real>> u = makePtr<DualScaledStdVector<Real>>(up,scale);
218 return makePtr<Bounds<Real>>(*u,
false);
Real horsepower(const Real dintake, const int deriv=0) const
Real warranty(const Real flatness, const int deriv=0) const
void value(std::vector< Real > &c, const std::vector< Real > &x, Real &tol)
Real smax(const Real tw, const int deriv=0) const
virtual void hessVec(std::vector< Real > &hv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
void gradient(std::vector< Real > &g, const std::vector< Real > &x, Real &tol)
Ptr< Constraint< Real > > getInequalityConstraint(void) const
Defines the equality constraint operator interface for StdVectors.
Ptr< BoundConstraint< Real > > getBoundConstraint(void) const
Constraint_CylinderHead()
Ptr< BoundConstraint< Real > > getSlackBoundConstraint(void) const
Objective_SerialSimOpt(const Ptr< Obj > &obj, const V &ui) z0_ zero()
Ptr< Vector< Real > > getInitialGuess(void) const
Specializes the ROL::Objective interface for objective functions that operate on ROL::StdVector's.
Ptr< Vector< Real > > getInequalityMultiplier(void) const
void applyAdjointHessian(Vector< Real > &ahuv, const Vector< Real > &u, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply the derivative of the adjoint of the constraint Jacobian at to vector in direction ...
Ptr< Vector< Real > > getSolution(const int i=0) const
Contains definitions of test objective functions.
Ptr< Objective< Real > > getObjective(void) const
Real twall(const Real dintake, const int deriv=0) const
Real warranty(const Real flatness, const int deriv=0) const
Real tcycle(const Real flatness, const int deriv=0) const
void applyJacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)
Real value(const std::vector< Real > &x, Real &tol)
void applyAdjointJacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &x, Real &tol)