160 std::vector<unsigned>& p,
161 std::vector<doublereal>& ub,
162 std::vector<const c81_data *>& d,
165 profiles(p), upper_bounds(ub), data(d)
182 out <<
"C81, multiple";
183 for (
unsigned i = 0; i <
profiles.size(); i++) {
199 ASSERT(abscissa >= -1. && abscissa <= 1.);
204 for (
int i =
profiles.size() - 1; i--; ) {
247 std::vector<unsigned>& p,
248 std::vector<doublereal>& ub,
249 std::vector<const c81_data *>& d,
254 profiles(p), upper_bounds(ub), data(d),
274 for (
int b = 0; b < i_dim; b++) {
280 doublereal bl = bs[i_dim - 1][b + 1] - bs[i_dim - 1][b];
281 doublereal bm = bs[i_dim - 1][b + 1] + bs[i_dim - 1][b];
282 dCsi = (bm + dCsi*bl)/2.;
285 dCsi, dcltol, &
i_data[i_point]))
298 for (
unsigned i = 0; i <
i_data.size(); i++) {
306 out <<
"C81, interpolated";
307 for (
unsigned i = 0; i <
profiles.size(); i++) {
323 ASSERT(abscissa >= -1. && abscissa <= 1.);
359 { 0.165, 0.335, 0.0455, 0.3 },
360 { 0.165, 0.335, 0.041, 0.32 }
367 :
AeroData(i_p, i_dim, STEADY, ptime),
372 A1(0.), A2(0.), b1(0.), b2(0.),
373 alpha_pivot(0), dot_alpha_pivot(0), dot_alpha(0), ddot_alpha(0),
374 cfx_0(0), cfy_0(0), cmz_0(0), clalpha(0),
375 prev_alpha_pivot(0), prev_dot_alpha(0),
376 prev_time(pTime->dGet()),
449 #else // ! HAVE_MEMSET
453 #endif // ! HAVE_MEMSET
485 if (std::abs(
d34 -
d14) < std::numeric_limits<doublereal>::epsilon()) {
486 silent_cerr(
"TheodorsenAeroData::AssRes() [#" << i <<
"]: aerodynamic center and boundary condition point are almost coincident" << std::endl);
516 WW[
VY] = -WW[
VX]*tan_y1 - d34*W[
WZ];
526 if (qD > std::numeric_limits<doublereal>::epsilon()) {
547 dot_alpha[i] = Uinf*((u1 - u2)/(d34 - d14));
553 if (Delta_t > std::numeric_limits<doublereal>::epsilon()) {
571 v[1] = W[1] + d34*W[5];
572 v[2] = W[2] - d34*W[4];
573 vp =
sqrt(v[0]*v[0] + v[1]*v[1]);
574 TNG[0] = -qD*
chord*(cl*v[1] + cd*v[0])/vp;
575 TNG[1] = qD*
chord*(cl*v[0] - cd*v[1])/vp;
594 WorkVec.
PutCoef(iFirstSubIndex + 1, -q1p + q2);
595 WorkVec.
PutCoef(iFirstSubIndex + 2, -q2p -
b1*b2*d*d*q1 - (
b1 + b2)*d*q2 + u2);
607 #ifdef DEBUG_JACOBIAN_UNSTEADY
610 #endif // DEBUG_JACOBIAN_UNSTEADY
614 #ifdef DEBUG_JACOBIAN_UNSTEADY
616 #endif // DEBUG_JACOBIAN_UNSTEADY
622 #ifdef DEBUG_JACOBIAN_UNSTEADY
624 #endif // DEBUG_JACOBIAN_UNSTEADY
631 WorkMat.
IncCoef(iFirstSubIndex + 1, iFirstSubIndex + 1, 1.);
632 WorkMat.
IncCoef(iFirstSubIndex + 2, iFirstSubIndex + 2, 1.);
634 WorkMat.
IncCoef(iFirstSubIndex + 1, iFirstSubIndex + 2, -dCoef);
635 WorkMat.
IncCoef(iFirstSubIndex + 2, iFirstSubIndex + 1, dCoef*
b1*b2*d*d);
636 WorkMat.
IncCoef(iFirstSubIndex + 2, iFirstSubIndex + 2, dCoef*(
b1 + b2)*d);
646 dU_V_11 = (W[
VY] + W[
WZ]*
d34)/dDen34;
647 dU_V_12 = -W[
VX]/dDen34;
658 dU_W_13 = - W[
VX]*d34/dDen34;
668 for (iIndexColumn = 1; iIndexColumn <= vx.
iGetNumCols(); iIndexColumn++){
669 WorkMat.
IncCoef(iFirstSubIndex+2, iIndexColumn, dG_V_21*vx(1,iIndexColumn) + dG_V_22*vx(2,iIndexColumn));
670 WorkMat.
IncCoef(iFirstSubIndex+2, iIndexColumn, dG_W_23*wx(3,iIndexColumn));
685 WW[
VY] = -W[
VX]*tan_y1 - d34*W[
WZ];
693 if (qD > std::numeric_limits<doublereal>::epsilon()) {
725 fq.
Put(1, 1, (-L_q1*sin_alpha -D_q1*cos_alpha));
726 fq.
Put(1, 2, (-L_q2*sin_alpha -D_q2*cos_alpha));
727 fq.
Put(2, 1, (L_q1*cos_alpha -D_q1*sin_alpha));
728 fq.
Put(2, 2, (L_q2*cos_alpha -D_q2*sin_alpha));
730 cq.
Put(3, 1, (M_q1 +
d14*fq(2,1)));
731 cq.
Put(3, 2, (M_q2 +
d14*fq(2,2)));
738 dY_V_11 = (((
A1+
A2)*
b1*b2*d*(4./chord)*q1 + (
A1*
b1+
A2*
b2)*(2./chord)*q2)*W[VX]/Uinf) + ((1-
A1-
A2)*dU_V_11);
739 dY_V_12 = (((
A1+
A2)*
b1*b2*d*(4./chord)*q1 + (
A1*
b1+
A2*
b2)*(2./chord)*q2)*W[VY]/Uinf) + ((1-
A1-
A2)*dU_V_12);
747 Jaero(1,1) = rho*chord*
cfx_0[i]*W[
VX] + qDc*( dCd_alpha*dY_V_11);
748 Jaero(1,2) = rho*chord*
cfx_0[i]*W[
VY] + qDc*( dCd_alpha*dY_V_12);
749 Jaero(1,3) = rho*chord*
cfx_0[i]*W[
VZ];
750 Jaero(2,1) = rho*chord*cy*W[
VX] + qDc*( dCl_alpha*dY_V_11 + dCfy_Uinf*W[
VX]/Uinf);
751 Jaero(2,2) = rho*chord*cy*W[
VY] + qDc*( dCl_alpha*dY_V_12 + dCfy_Uinf*W[
VY]/Uinf );
752 Jaero(2,3) = rho*chord*cy*W[
VZ];
753 Jaero(3,1) = rho*chord*cfz_0*W[
VX];
754 Jaero(3,1) = rho*chord*cfz_0*W[
VY];
755 Jaero(3,3) = rho*chord*cfz_0*W[
VZ];
758 Jaero(1,6) = qDc*dCd_alpha*(1.-
A1-
A2)*dU_W_13;
759 Jaero(2,6) = qDc*dCl_alpha*(1.-
A1-
A2)*dU_W_13;
766 Jaero(4,1) = rho*chord*chord*cmx_0*W[
VX];
767 Jaero(4,2) = rho*chord*chord*cmx_0*W[
VY];
768 Jaero(4,3) = rho*chord*chord*cmx_0*W[
VZ];
769 Jaero(5,1) = rho*chord*chord*cmy_0*W[
VX];
770 Jaero(5,2) = rho*chord*chord*cmy_0*W[
VY];
771 Jaero(5,3) = rho*chord*chord*cmy_0*W[
VZ];
772 Jaero(6,1) = rho*chord*chord*cmz*W[
VX] +qDc*chord*( dCm_alpha*dY_V_11 + dCmz_Uinf*W[
VX]/Uinf );
773 Jaero(6,2) = rho*chord*chord*cmz*W[
VY] +qDc*chord*( dCm_alpha*dY_V_12 + dCmz_Uinf*W[
VY]/Uinf );
774 Jaero(6,3) = rho*chord*chord*cmz*W[
VZ];
777 Jaero(6,6) = qDc*chord*dCm_alpha*(1.-
A1-
A2)*dU_W_13;
794 J(1,1) = -Jaero(2,1)*sin_alpha -Jaero(1,1)*cos_alpha - Lift*sin_alpha_vx - Drag*cos_alpha_vx;
795 J(1,2) = -Jaero(2,2)*sin_alpha -Jaero(1,2)*cos_alpha - Lift*sin_alpha_vy - Drag*cos_alpha_vy;
796 J(1,3) = -Jaero(2,3)*sin_alpha -Jaero(1,3)*cos_alpha;
797 J(1,6) = -Jaero(2,6)*sin_alpha -Jaero(1,6)*cos_alpha - Lift*sin_alpha_wz;
799 J(2,1) = Jaero(2,1)*cos_alpha -Jaero(1,1)*sin_alpha + Lift*cos_alpha_vx - Drag*sin_alpha_vx;
800 J(2,2) = Jaero(2,2)*cos_alpha -Jaero(1,2)*sin_alpha + Lift*cos_alpha_vy - Drag*sin_alpha_vy;
801 J(2,3) = Jaero(2,3)*cos_alpha -Jaero(1,3)*sin_alpha;
802 J(2,6) = Jaero(2,6)*cos_alpha -Jaero(1,6)*sin_alpha - Drag*sin_alpha_wz;
804 J(6,1) = Jaero(6,1) +
d14*J(2,1);
805 J(6,2) = Jaero(6,2) +
d14*J(2,2);
806 J(6,3) = Jaero(6,3) +
d14*J(2,3);
809 J(6,6) = Jaero(6,6) +
d14*J(2,6);
813 #ifdef DEBUG_JACOBIAN_UNSTEADY
814 printf(
"G/v matrix\n");
815 printf(
"%lf %lf %lf\n", 0., 0., 0.);
816 printf(
"%lf %lf %lf\n", dG_V_21, dG_V_22, 0.);
818 printf(
"G/w matrix\n");
819 printf(
"%lf %lf %lf\n", 0., 0., 0.);
820 printf(
"%lf %lf %lf\n", 0., 0., dG_W_23);
822 printf(
"f/q matrix\n");
823 printf(
"%lf %lf \n", fq(1,1), fq(1,2));
824 printf(
"%lf %lf \n", fq(2,1), fq(2,2));
825 printf(
"%lf %lf \n", 0., 0.);
827 printf(
"c/q matrix\n");
828 printf(
"%lf %lf\n", 0., 0.);
829 printf(
"%lf %lf\n", 0., 0.);
830 printf(
"%lf %lf\n", cq(3,1), cq(3,2));
832 printf(
"J matrix\n");
833 for(
int iii=1; iii<=6; iii++){
834 for(
int jjj=1; jjj<=6; jjj++){
835 printf(
"%lf ", J(iii,jjj));
841 fd = fopen(
"X.mat",
"w");
843 for(
int iii=1; iii<=2; iii++){
844 printf(
"%lf ", XCurr(iFirstIndex+iii));
845 fprintf(fd,
"%15.7e ", XCurr(iFirstIndex+iii));
848 fd = fopen(
"XP.mat",
"w");
851 for(
int iii=1; iii<=2; iii++){
852 printf(
"%lf ", XPrimeCurr(iFirstIndex+iii));
853 fprintf(fd,
"%15.7e ", XPrimeCurr(iFirstIndex+iii));
857 fd = fopen(
"W.mat",
"w");
859 printf(
"%lf %lf %lf %lf %lf %lf", W[VX], W[VY], W[
VZ], W[
WX], W[
WY], W[
WZ]);
860 fprintf(fd,
"%15.7e %15.7e %15.7e %15.7e %15.7e %15.7e", W[VX], W[VY], W[VZ], W[WX], W[WY], W[WZ]);
863 printf(
"PARAMETRI \n");
864 printf(
"d14 %lf ",
d14);
865 printf(
"\nd34 %lf ", d34);
866 printf(
"\nA1 %lf ",
A1);
867 printf(
"\nA2 %lf ",
A2);
868 printf(
"\nb1 %lf ",
b1);
869 printf(
"\nb2 %lf ", b2);
870 printf(
"\nchord %lf ",
chord);
871 printf(
"\na %lf ",
a);
872 printf(
"\nrho %lf ", rho);
873 printf(
"\ncfx_0 %lf ",
cfx_0[i]);
874 fd = fopen(
"cfx_0.mat",
"w");
875 fprintf(fd,
"%15.7e",
cfx_0[i]);
877 printf(
"\ncfy_0 %lf ",
cfy_0[i]);
878 fd = fopen(
"cfy_0.mat",
"w");
879 fprintf(fd,
"%15.7e ",
cfy_0[i]);
881 printf(
"\ncmz_0 %lf ",
cmz_0[i]);
882 printf(
"\ndCl_alpha %lf ", dCl_alpha);
883 fd = fopen(
"dCl_alpha.mat",
"w");
884 fprintf(fd,
"%15.7e", dCl_alpha);
886 printf(
"\ndCd_alpha %lf", dCd_alpha);
887 fd = fopen(
"dCd_alpha.mat",
"w");
888 fprintf(fd,
"%15.7e", dCd_alpha);
890 printf(
"\ndCm_alpha %lf", dCm_alpha);
891 printf(
"\nclalpha %lf ",
clalpha[i]);
892 printf(
"\n q1 q2 i %lf %lf %d", q1, q2, i);
893 fd = fopen(
"ddot_alpha.mat",
"w");
897 fd = fopen(
"dot_alpha.mat",
"w");
901 fd = fopen(
"dot_alpha_pivot.mat",
"w");
std::ostream & Restart(std::ostream &out) const
virtual DofOrder::Order GetDofType(unsigned int i) const
int GetForcesJac(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
virtual void AfterConvergence(int i, const VectorHandler &X, const VectorHandler &XP)
virtual ~TheodorsenAeroData(void)
virtual int GetForcesJac(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
virtual void SetSectionData(const doublereal &abscissa, const doublereal &chord, const doublereal &forcepoint, const doublereal &velocitypoint, const doublereal &twist, const doublereal &omega=0.)
std::ostream & RestartUnsteady(std::ostream &out) const
GradientExpression< BinaryExpr< FuncPow, LhsExpr, RhsExpr > > pow(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
virtual int GetForcesJac(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
void Put(int i, integer j, const doublereal &d)
#define MBDYN_EXCEPT_ARGS
std::vector< unsigned > profiles
virtual void SetSectionData(const doublereal &abscissa, const doublereal &chord, const doublereal &forcepoint, const doublereal &velocitypoint, const doublereal &twist, const doublereal &omega=0.)
virtual void AssRes(SubVectorHandler &WorkVec, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, integer iFirstIndex, integer iFirstSubIndex, int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
std::vector< doublereal > upper_bounds
std::vector< c81_data > i_data
std::ostream & Restart(std::ostream &out) const
void c81_data_destroy(c81_data *data)
int GetForcesJac(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
flag fGetNext(doublereal &d, integer i=0) const
virtual unsigned int iGetNumDof(void) const
PntWght GetFirst(void) const
#define SAFEDELETEARR(pnt)
virtual int GetForces(int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
STAHRAeroData(int i_p, int i_dim, AeroData::UnsteadyModel u, integer p, DriveCaller *ptime=0)
int GetForces(int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
virtual ~C81AeroData(void)
void SetSectionData(const doublereal &abscissa, const doublereal &chord, const doublereal &forcepoint, const doublereal &velocitypoint, const doublereal &twist, const doublereal &omega=0.)
C81AeroData(int i_p, int i_dim, AeroData::UnsteadyModel u, integer p, const c81_data *d, DriveCaller *ptime=0)
int GetForcesJac(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
doublereal * prev_dot_alpha
int c81_aerod2_u(doublereal *W, const vam_t *VAM, doublereal *TNG, outa_t *OUTA, c81_data *data, long unsteadyflag)
virtual std::ostream & Restart(std::ostream &out) const
void IncCoef(integer iRow, integer iCol, const doublereal &dCoef)
virtual void SetAirData(const doublereal &rho, const doublereal &c)
std::vector< unsigned > profiles
doublereal * dot_alpha_pivot
virtual std::ostream & Restart(std::ostream &out) const =0
AeroData::UnsteadyModel Unsteady(void) const
void Predict(int i, doublereal alpha, doublereal &alf1, doublereal &alf2)
int GetNumPoints(void) const
virtual int GetForces(int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
C81InterpolatedAeroData(int i_p, int i_dim, AeroData::UnsteadyModel u, std::vector< unsigned > &p, std::vector< doublereal > &ub, std::vector< const c81_data * > &d, doublereal dcltol, DriveCaller *ptime=0)
std::vector< doublereal > upper_bounds
doublereal copysign(doublereal x, doublereal y)
int GetForcesJacForwardDiff_int(int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
doublereal force_position
C81MultipleAeroData(int i_p, int i_dim, AeroData::UnsteadyModel u, std::vector< unsigned > &p, std::vector< doublereal > &ub, std::vector< const c81_data * > &d, DriveCaller *ptime=0)
void SetSectionData(const doublereal &abscissa, const doublereal &chord, const doublereal &forcepoint, const doublereal &velocitypoint, const doublereal &twist, const doublereal &omega=0.)
virtual ~STAHRAeroData(void)
std::vector< const c81_data * > data
int GetForces(int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
doublereal * prev_alpha_pivot
UnsteadyModel unsteadyflag
int c81_data_merge(unsigned ndata, const c81_data **data, const doublereal *upper_bounds, doublereal dCsi, doublereal dcltol, c81_data *i_data)
integer iGetNumCols(void) const
std::ostream & Restart(std::ostream &out) const
virtual void SetAirData(const doublereal &rho, const doublereal &c)
~C81MultipleAeroData(void)
#define ASSERT(expression)
GradientExpression< UnaryExpr< FuncSqrt, Expr > > sqrt(const GradientExpression< Expr > &u)
virtual void PutCoef(integer iRow, const doublereal &dCoef)=0
int GetForces(int i, const doublereal *W, doublereal *TNG, outa_t &OUTA)
~C81InterpolatedAeroData(void)
virtual doublereal dGet(const doublereal &dVar) const =0
static std::stack< cleanup * > c
doublereal dGetPnt(void) const
#define SAFENEWARR(pnt, item, sz)
static const doublereal a
std::vector< const c81_data * > data
virtual unsigned int iGetNumDof(void) const
virtual void AssJac(FullSubMatrixHandler &WorkMat, doublereal dCoef, const VectorHandler &XCurr, const VectorHandler &XPrimeCurr, integer iFirstIndex, integer iFirstSubIndex, const Mat3xN &vx, const Mat3xN &wx, Mat3xN &fq, Mat3xN &cq, int i, const doublereal *W, doublereal *TNG, Mat6x6 &J, outa_t &OUTA)
GradientExpression< BinaryExpr< FuncAtan2, LhsExpr, RhsExpr > > atan2(const GradientExpression< LhsExpr > &u, const GradientExpression< RhsExpr > &v)
GradientExpression< UnaryExpr< FuncTan, Expr > > tan(const GradientExpression< Expr > &u)
static const doublereal TheodorsenParams[2][4]
int aerod2(doublereal *w, doublereal *vam, doublereal *tng, doublereal *outa, integer *inst, doublereal *rspeed, integer *ipr)
TheodorsenAeroData(int i_p, int i_dim, AeroData *pa, DriveCaller *ptime=0)
virtual std::ostream & Restart(std::ostream &out) const