Darry6682
Subscriber

yes, of course. Here it is.nnDEFINE_ADJUST(SrcComp,domain)n/*


*/n/*tttt    tttt    */n/*tttt    tttt    */n/*VersiontDatetNametttRemarkst    t    */n/*
*/n{nn#if !RP_HOSTn int i, count, count_max;n Thread *tc = NULL;n cell_t cc;n real *factor_ptr, sum_area;n real r_pb,psi_pb,r_pb2;n real Ux_pb,Uy_pb,Uz_pb;n real Usc, Utc, Unc, aeps, Utotal, beta;n real theta, chord;n real CL, CD;n real Ftc, Fnc, Fsc;n real FL, FD;n real Fx, Fy, Fz;n real *xsource_ptr, *ysource_ptr, *zsource_ptr;n real *xsource_old_ptr, *ysource_old_ptr, *zsource_old_ptr;n real Re_t, Ma_t, alpha_t;n real thrust, Fz_pb, CT;n real x_pb, y_pb, Mx_pb, My_pb, CMX, CMY;n int flag_jac;n real ct_s, ct_h, ct_l, bcop_l, bcop_s, bcop_h;n real cmx_lc, cmx_ls, cmx_s, cmx_hc, cmx_hs;n real cmy_lc, cmy_ls, cmy_s, cmy_hc, cmy_hs;n real bcyc_l, bcyc_s, bcyc_h, bcys_l, bcys_s, bcys_h;n real ct_lc, ct_ls, ct_hc, ct_hs, cmx_l, cmx_h, cmy_l, cmy_h;n real alpha_tmax, alpha_tmin;n real torque, power, Ft_pb;n real sum_thrust, sum_Mx_pb, sum_My_pb, sum_torque;n real max_alpha_tmax, min_alpha_tmin;nn /*Domain *domain;*/n domain = Get_Domain(1);nnn Message0(%d In DEFINE_ADJUST - SrcComp \,myid);nn /*Loop through all zones*/n i=0;n while (i < nrtz)n {n  Message0(%d Rotor %d \,myid,i+1);nn  tc = Lookup_Thread(domain,czon);n  factor_ptr = Get_Thread_Memory(tc,factor);n  xsource_ptr= Get_Thread_Memory(tc,xsource);n  ysource_ptr= Get_Thread_Memory(tc,ysource);n  zsource_ptr= Get_Thread_Memory(tc,zsource);nn  xsource_old_ptr= Get_Thread_Memory(tc,xsource_old);n  ysource_old_ptr= Get_Thread_Memory(tc,ysource_old);n  zsource_old_ptr= Get_Thread_Memory(tc,zsource_old);nnntcount=0;n  begin_c_loop_int(cc,tc)n   count++;n  end_c_loop_int(cc,tc)n  count_max=count;n  /*Message(count_max %d,count_max);*/nntflag_jac=0;n  LABEL1:nt thrust=0.0;nt torque=0.0;nt Mx_pb=0.0;nt My_pb=0.0;n   sum_area=0.0;nt alpha_tmax=-1000.0;nt alpha_tmin=1000.0;n   count=0;nn   begin_c_loop_int(cc,tc)n    get_radial_position(i,cc,tc,count,count_max,&r_pb,&psi_pb,&r_pb2,ntt           &x_pb,&y_pb);n    /*Message0( r_pb %f   psi_pb %f x_pb %f  y_pb %f \,ntt  t  r_pb, psi_pb*180/M_PI, x_pb, y_pb);*/nnt  vel_xyz_to_blade(i,cc,tc,count,count_max,psi_pb,r_pb2,ntt  t       &Usc,&Utc,&Unc,&aeps,&Utotal,&beta,&Ux_pb,&Uy_pb,&Uz_pb);n    /*Message0( Usc %f Utc %f Unc %f \,Usc, Utc, Unc);*/ntt/*Message0(aeps %f \, aeps*180.0/M_PI);*/nnt  get_pitch(i,cc,tc,count,r_pb,psi_pb,&theta);n    /*Message0( psi_pb %f theta %f \,psi_pb*180/M_PI, theta*180/M_PI);*/nn    get_chord(i,cc,tc,count,r_pb, &chord);ntt/*Message0(%f \,chord);*/nnttget_re(i,cc,tc,count,chord,Utotal,&Re_t);ntt/*Message0(  Re_t %f \,Re_t);*/nnttget_ma(i,cc,tc,count,Utotal,&Ma_t);ntt/*Message0(  Ma_t %f \,Ma_t);*/nnttget_aoa(i,cc,tc,count,aeps,theta,&alpha_t);ntt/*Message0(  alpha_t %f \,alpha_t*180/M_PI);*/nnttget_cl(i,cc,tc,count,r_pb,Ma_t,Re_t,alpha_t,&CL);ntt/*Message0(  CL %f \,CL);*/nn    get_cd(i,cc,tc,count,r_pb,Ma_t,Re_t,alpha_t,&CD);ntt/*Message0(  CD %f \,CD);*/nnttget_force(i,cc,tc,factor_ptr,&sum_area,sum_area,count,count_max,ntt      CL,CD,chord,aeps,Utotal,r_pb,&Ftc,&Fnc,&Fsc,Ux_pb,Uy_pb,Uz_pb,&FL);ntt/*Message0(Ftc=%f Fnc=%f Fsc=%f \,Ftc, Fnc, Fsc);*/nn    force_blade_to_xyz(i,cc,tc,count,Ftc,Fnc,Fsc,beta,psi_pb,ntt  t        &Fx,&Fy,&Fz,&Fz_pb,&Ft_pb,FL);ntt/*Message0(Fx= %f Fy= %f Fz= %f Fz_pb= %f \,Fx, Fy, Fz, Fz_pb, Ft_pb);*/    if (flag_jac == 0) get_source_terms(nttt         i,cc,tc,count,xsource_ptr,ysource_ptr,zsource_ptr,nttt         xsource_old_ptr,ysource_old_ptr,zsource_old_ptr,nttt         Fx, Fy, Fz, urf_source);nnttthrust=thrust+Fz_pb;nttMx_pb=Mx_pb+Fz_pb*y_pb;nttMy_pb=My_pb+Fz_pb*x_pb;n    torque=torque+Ft_pb*sqrt(x_pb*x_pb + y_pb*y_pb);nnttalpha_tmax=max(alpha_tmax,alpha_t);nttalpha_tmin=min(alpha_tmin,alpha_t);nnt  count++;n   end_c_loop_int(cc,tc)nnn   /*Message(  sum_area %f \,sum_area);*/n   sum_thrust = PRF_GRSUM1(thrust);n   sum_Mx_pb = PRF_GRSUM1(Mx_pb);nt sum_My_pb = PRF_GRSUM1(My_pb);nt sum_torque = PRF_GRSUM1(torque);n   max_alpha_tmax = PRF_GRHIGH1(alpha_tmax);n   min_alpha_tmin = PRF_GRLOW1(alpha_tmin);nn   get_ct(i,sum_thrust,&CT);n   get_cmx(i,sum_Mx_pb,&CMX);n   get_cmy(i,sum_My_pb,&CMY);nnnt if (flag_jac == 0)nt {n    power=sum_torque*rspe;nnttMessage0(  %d Rotor %d Thrust %f ct= %f \,myid,i+1,sum_thrust,CT);ntt/*Message(  %d Rotor %d Thrust on node %f \,myid,i+1,thrust);*/n    Message0(  %d Rotor %d Torque %f \,myid,i+1,sum_torque);n    /*Message(  %d Rotor %d Torque on node %f \,myid,i+1,torque);*/nttMessage0(  %d Rotor %d Power %f \,myid,i+1,power);nttMessage0(  %d Rotor %d Mx_pb %f cmx= %f \,myid,i+1,sum_Mx_pb,CMX);n  t/*Message(  %d Rotor %d Mx_pb on node %f \,myid,i+1,Mx_pb);*/nttMessage0(  %d Rotor %d My_pb %f cmy= %f \,myid,i+1,sum_My_pb,CMY);n  t  /*Message(  %d Rotor %d My_pb on node %f \,myid,i+1,My_pb);*/nttMessage0(  %d Rotor %d Max AOA %f \,myid,i+1,max_alpha_tmax*180/M_PI);n tt/*Message(  %d Rotor %d Max AOA on node %f \,myid,i+1,alpha_tmax*180/M_PI);*/nttMessage0(  %d Rotor %d Min AOA %f \,myid,i+1,min_alpha_tmin*180/M_PI);n tt/*Message(  %d Rotor %d Max AOA on node %f \,myid,i+1,alpha_tmin*180/M_PI);*/nt }nnnt update_trimming(i, trufq_co, trufq_cy, trdf_co, trdf_cy,nttt      up_co, up_cy, CT, &flag_jac,ntttttt&ct_l, &ct_s, &ct_h,ntttttt&bcop_l, &bcop_s, &bcop_h,nttttttCMX, CMY,n            &cmx_lc, &cmx_ls, &cmx_s, &cmx_hc, &cmx_hs,ntttttt&cmy_lc, &cmy_ls, &cmy_s, &cmy_hc, &cmy_hs,ntttttt&bcyc_l, &bcyc_s, &bcyc_h,ntttttt&bcys_l, &bcys_s, &bcys_h,nttttt  &ct_lc, &ct_ls, &ct_hc, &ct_hs,ntttttt&cmx_l, &cmx_h, &cmy_l, &cmy_h);nnn   if (flag_jac == 1 || flag_jac == -1 ||ntt flag_jac == 2 || flag_jac == -2 ||ntt flag_jac == 3 || flag_jac == -3) goto LABEL1;nnn  i += 1;nn }n istflag=0;n#endif