41 base_velocity_function(
""),
42 local_vertical_function(
""),
47 area_swept_function(
""),
57 system->time_evolving(this->fan_speed_var(), 1);
66 this->set_parameter(base_velocity_function, input,
68 this->zero_vector_function);
70 if (base_velocity_function.expression() == this->zero_vector_function)
71 libmesh_error_msg(
"Error! Zero AveragedTurbine specified!" <<
74 this->set_parameter(local_vertical_function, input,
76 this->zero_vector_function);
78 if (local_vertical_function.expression() == this->zero_vector_function)
79 libmesh_error_msg(
"Error! Zero LocalVertical specified!" <<
82 this->set_parameter(lift_function, input,
86 if (lift_function.expression() ==
"0")
87 std::cout <<
"Warning! Zero lift function specified!" << std::endl;
89 this->set_parameter(drag_function, input,
93 if (drag_function.expression() ==
"0")
94 std::cout <<
"Warning! Zero drag function specified!" << std::endl;
96 this->set_parameter(chord_function, input,
100 if (chord_function.expression() ==
"0")
101 libmesh_error_msg(
"Error! Zero chord function specified!" <<
104 this->set_parameter(area_swept_function, input,
108 if (area_swept_function.expression() ==
"0")
109 libmesh_error_msg(
"Error! Zero area_swept_function specified!" <<
112 this->set_parameter(aoa_function, input,
116 if (aoa_function.expression() ==
"00000")
117 libmesh_error_msg(
"Error! No angle-of-attack specified!" <<
120 this->set_parameter(torque_function, input,
124 if (torque_function.expression() ==
"0")
125 std::cout <<
"Warning! Zero torque function specified!" << std::endl;
128 (this->moment_of_inertia, input,
132 if (!moment_of_inertia)
134 "Error! Zero AveragedTurbine moment of inertia specified!" <<
138 (this->initial_speed, input,
145 (
const libMesh::Point& point,
146 const libMesh::Real time,
147 const libMesh::NumberVectorValue& U,
149 libMesh::NumberVectorValue& U_B_1,
150 libMesh::NumberVectorValue& F,
151 libMesh::NumberTensorValue *dFdU,
152 libMesh::NumberVectorValue *dFds)
155 libMesh::DenseVector<libMesh::Number> output_vec(3);
157 base_velocity_function(point, time, output_vec);
159 U_B_1(0) = output_vec(0);
160 U_B_1(1) = output_vec(1);
161 U_B_1(2) = output_vec(2);
163 const libMesh::NumberVectorValue U_B = U_B_1 * s;
165 const libMesh::Number U_B_size = U_B.norm();
172 const libMesh::NumberVectorValue N_B =
173 libMesh::NumberVectorValue(U_B/U_B_size);
175 local_vertical_function(point, time, output_vec);
178 const libMesh::NumberVectorValue N_V(output_vec(0),
184 const libMesh::NumberVectorValue N_R = N_B.cross(N_V);
187 const libMesh::NumberVectorValue U_P = U - (U*N_R)*N_R - U_B;
189 const libMesh::Number U_P_size = U_P.norm();
198 const libMesh::NumberVectorValue N_drag =
199 libMesh::NumberVectorValue(-U_P/U_P_size);
202 const libMesh::NumberVectorValue N_lift = N_drag.cross(N_R);
205 const libMesh::Number u_fwd = -(U_P * N_B);
208 const libMesh::Number u_up = U_P * N_V;
212 libmesh_assert (u_up || u_fwd);
215 const libMesh::Number part_angle = std::atan2(u_up, u_fwd);
218 const libMesh::Number angle = part_angle +
219 aoa_function(point, time);
221 const libMesh::Number C_lift = lift_function(point, angle);
222 const libMesh::Number C_drag = drag_function(point, angle);
224 const libMesh::Number chord = chord_function(point, time);
225 const libMesh::Number area = area_swept_function(point, time);
227 const libMesh::Number v_sq = U_P*U_P;
229 const libMesh::Number LDfactor = 0.5 * this->_rho * v_sq * chord / area;
230 const libMesh::Number lift = C_lift * LDfactor;
231 const libMesh::Number drag = C_drag * LDfactor;
234 F = lift * N_lift + drag * N_drag;
238 const libMesh::NumberVectorValue LDderivfactor =
239 (N_lift*C_lift+N_drag*C_drag) *
240 this->_rho * chord / area;
242 const libMesh::Number sfactor = -(U_P*U_B_1);
244 (*dFds) = LDderivfactor * sfactor;
246 for (
unsigned int i=0; i != 3; ++i)
247 for (
unsigned int j=0; j != 3; ++j)
248 (*dFdU)(i,j) = LDderivfactor(i) * U_P(j);
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets turbine_speed and velocity variables to be time-evolving.
Physics class for Incompressible Navier-Stokes.
INSTANTIATE_INC_NS_SUBCLASS(AveragedTurbineBase)
static PhysicsName averaged_turbine()
Variables with a single SCALAR component.
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
bool compute_force(const libMesh::Point &point, const libMesh::Real time, const libMesh::NumberVectorValue &U, libMesh::Number s, libMesh::NumberVectorValue &U_B_1, libMesh::NumberVectorValue &F, libMesh::NumberTensorValue *dFdU=NULL, libMesh::NumberVectorValue *dFds=NULL)
void read_input_options(const GetPot &input)
Read options from GetPot input file.