void NonlinearPoissonSource<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { // source function for (std::size_t cell = 0; cell < workset.numCells; ++cell) { for (std::size_t qp = 0; qp < num_qps_; ++qp) { MeshScalarT* X = &coord_(cell,qp,0); source_(cell,qp) = -2.0 * X[0]; } } }
void LaserSource<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { // current time const RealType t = workset.current_time; AMP::LaserCenter Val; Val.t = t; RealType x, y, power_fraction; int power; LaserData_.getLaserPosition(t,Val,x,y,power,power_fraction); ScalarT Laser_center_x = x; ScalarT Laser_center_y = y; ScalarT Laser_power_fraction = power_fraction; // source function ScalarT pi = 3.1415926535897932; ScalarT LaserFlux_Max; // laser on or off if ( power == 1 ) { LaserFlux_Max =(3.0/(pi*laser_beam_radius*laser_beam_radius))*laser_power*Laser_power_fraction; } else { LaserFlux_Max = 0.0; } ScalarT beta = 1.5*(1.0 - porosity)/(porosity*particle_dia); // Parameters for the depth profile of the laser heat source: ScalarT lambda = 2.50; ScalarT a = sqrt(1.0 - powder_hemispherical_reflectivity); ScalarT A = (1.0 - pow(powder_hemispherical_reflectivity,2))*exp(-lambda); ScalarT B = 3.0 + powder_hemispherical_reflectivity*exp(-2*lambda); ScalarT b1 = 1 - a; ScalarT b2 = 1 + a; ScalarT c1 = b2 - powder_hemispherical_reflectivity*b1; ScalarT c2 = b1 - powder_hemispherical_reflectivity*b2; ScalarT C = b1*c2*exp(-2*a*lambda) - b2*c1*exp(2*a*lambda); // Following are few factors defined by the coder to be included while defining the depth profile ScalarT f1 = 1.0/(3.0 - 4.0*powder_hemispherical_reflectivity); ScalarT f2 = 2*powder_hemispherical_reflectivity*a*a/C; ScalarT f3 = 3.0*(1.0 - powder_hemispherical_reflectivity); //----------------------------------------------------------------------------------------------- for (std::size_t cell = 0; cell < workset.numCells; ++cell) { for (std::size_t qp = 0; qp < num_qps_; ++qp) { MeshScalarT X = coord_(cell,qp,0); MeshScalarT Y = coord_(cell,qp,1); MeshScalarT Z = coord_(cell,qp,2); ScalarT depth_profile = f1*(f2*(A*(b2*exp(2.0*a*beta*Z)-b1*exp(-2.0*a*beta*Z)) - B*(c2*exp(-2.0*a*(lambda - beta*Z))-c1*exp(2.0*a*(lambda-beta*Z)))) + f3*(exp(-beta*Z)+powder_hemispherical_reflectivity*exp(beta*Z - 2.0*lambda))); MeshScalarT* XX = &coord_(cell,qp,0); ScalarT radius = sqrt((X - Laser_center_x)*(X - Laser_center_x) + (Y - Laser_center_y)*(Y - Laser_center_y)); if (radius < laser_beam_radius && beta*Z <= lambda) laser_source_(cell,qp) = beta*LaserFlux_Max*pow((1.0-(radius*radius)/(laser_beam_radius*laser_beam_radius)),2)*depth_profile; else laser_source_(cell,qp) = 0.0; } } }
void PhaseSource<EvalT, Traits>:: evaluateFields(typename Traits::EvalData workset) { // current time const RealType time = workset.current_time; //source function ScalarT laser_beam_radius = 60.0e-6; ScalarT porosity = 0.60; ScalarT particle_dia = 20.0e-6; ScalarT powder_hemispherical_reflectivity = 0.70; ScalarT lambda =2.50; ScalarT pi = 3.1415926535897932; // ScalarT laser_power = 30; ScalarT LaserFlux_Max =(3.0/(pi*laser_beam_radius*laser_beam_radius))*laser_power; ScalarT beta = 1.5*(1.0 - porosity)/(porosity*particle_dia); // Few parameters: ScalarT a = sqrt(1.0 - powder_hemispherical_reflectivity); ScalarT A = (1.0 - pow(powder_hemispherical_reflectivity,2))*exp(-lambda); ScalarT B = 3.0 + powder_hemispherical_reflectivity*exp(-2*lambda); ScalarT b1 = 1 - a; ScalarT b2 = 1 + a; ScalarT c1 = b2 - powder_hemispherical_reflectivity*b1; ScalarT c2 = b1 - powder_hemispherical_reflectivity*b2; ScalarT C = b1*c2*exp(-2*a*lambda) - b2*c1*exp(2*a*lambda); // Code for heat into substrate ScalarT Absorptivity_substrate = 0.77; ScalarT S1 = 1.0/(3.0-4.0*powder_hemispherical_reflectivity); ScalarT S2 = powder_hemispherical_reflectivity*a/C; ScalarT S3 = (A*b2 + B*c1)*(exp(2.0*a*lambda) - 1.0); ScalarT S4 = (A*b1 + B*c2)*(exp(-2.0*a*lambda) - 1.0); ScalarT S5 = 3.0*(1.0 - powder_hemispherical_reflectivity)*(1.0 - exp(-lambda))*(1.0 + powder_hemispherical_reflectivity*exp(-lambda)); ScalarT I_value = S1*(S2*(S3 + S4) + S5); ScalarT Substrate_Top = 0.00005; ScalarT Substrate_Bot = 0.00012; // source function for (std::size_t cell = 0; cell < workset.numCells; ++cell) { for (std::size_t qp = 0; qp < num_qps_; ++qp) { MeshScalarT X = coord_(cell,qp,0); MeshScalarT Y = coord_(cell,qp,1); MeshScalarT Z = coord_(cell,qp,2); // Code for moving laser point ScalarT LaserVelocity_x = 1.0; ScalarT LaserVelocity_z = 0.0; ScalarT Laser_Init_position_x = 0.0; ScalarT Laser_Init_position_z = 0.0; ScalarT Laser_center_x = Laser_Init_position_x + LaserVelocity_x*time; ScalarT Laser_center_z = Laser_Init_position_z + LaserVelocity_z*time; // Note:(0.0003 -Y) is because of the Y axis for the depth_profile is in the negative direction as per the Gusarov's equation. ScalarT radius = sqrt((X - Laser_center_x)*(X - Laser_center_x) + (Z - Laser_center_z)*(Z - Laser_center_z)); if (radius < laser_beam_radius && (0.0003 - Y) >= Substrate_Top && (0.0003 - Y) <= Substrate_Bot) source_(cell,qp) = beta*LaserFlux_Max*pow((1.0-(radius*radius)/(laser_beam_radius*laser_beam_radius)),2)*(Absorptivity_substrate - I_value); else source_(cell,qp) =0.0; } } }