GRINS-0.7.0
List of all members | Public Member Functions | Protected Attributes | Private Member Functions
GRINS::AveragedTurbineBase< Viscosity > Class Template Reference

#include <averaged_turbine_base.h>

Inheritance diagram for GRINS::AveragedTurbineBase< Viscosity >:
Inheritance graph
[legend]
Collaboration diagram for GRINS::AveragedTurbineBase< Viscosity >:
Collaboration graph
[legend]

Public Member Functions

 AveragedTurbineBase (const std::string &physics_name, const GetPot &input)
 
 ~AveragedTurbineBase ()
 
virtual void init_variables (libMesh::FEMSystem *system)
 Initialization of variables. More...
 
virtual void set_time_evolving_vars (libMesh::FEMSystem *system)
 Sets turbine_speed and velocity variables to be time-evolving. More...
 
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)
 
VariableIndex fan_speed_var () const
 
- Public Member Functions inherited from GRINS::IncompressibleNavierStokesBase< Viscosity >
 IncompressibleNavierStokesBase (const std::string &my_physics_name, const std::string &core_physics_name, const GetPot &input)
 
 ~IncompressibleNavierStokesBase ()
 
virtual void init_context (AssemblyContext &context)
 Initialize context for added physics variables. More...
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 
libMesh::Real get_viscosity_value (AssemblyContext &context, unsigned int qp) const
 
- Public Member Functions inherited from GRINS::Physics
 Physics (const GRINS::PhysicsName &physics_name, const GetPot &input)
 
virtual ~Physics ()
 
virtual bool enabled_on_elem (const libMesh::Elem *elem)
 Find if current physics is active on supplied element. More...
 
void set_is_steady (bool is_steady)
 Sets whether this physics is to be solved with a steady solver or not. More...
 
bool is_steady () const
 Returns whether or not this physics is being solved with a steady solver. More...
 
virtual void auxiliary_init (MultiphysicsSystem &system)
 Any auxillary initialization a Physics class may need. More...
 
virtual void register_postprocessing_vars (const GetPot &input, PostProcessedQuantities< libMesh::Real > &postprocessing)
 Register name of postprocessed quantity with PostProcessedQuantities. More...
 
virtual void element_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for element interiors. More...
 
virtual void side_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_time_derivative (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void element_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for element interiors. More...
 
virtual void side_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
 Mass matrix part(s) for scalar variables. More...
 
void init_ics (libMesh::FEMSystem *system, libMesh::CompositeFunction< libMesh::Number > &all_ics)
 
virtual void compute_element_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_time_derivative_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_element_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_side_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_constraint_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_damping_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_nonlocal_mass_residual_cache (const AssemblyContext &context, CachedValues &cache)
 
virtual void compute_postprocessed_quantity (unsigned int quantity_index, const AssemblyContext &context, const libMesh::Point &point, libMesh::Real &value)
 
ICHandlingBaseget_ic_handler ()
 
- Public Member Functions inherited from GRINS::ParameterUser
 ParameterUser (const std::string &user_name)
 
virtual ~ParameterUser ()
 
virtual void set_parameter (libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
 Each subclass can simultaneously read a parameter value from. More...
 
virtual void set_parameter (libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void set_parameter (libMesh::ParsedFEMFunction< libMesh::Number > &func, const GetPot &input, const std::string &func_param_name, const std::string &param_default)
 Each subclass can simultaneously read a parsed function from. More...
 
virtual void move_parameter (const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &old_func, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 
virtual void move_parameter (const libMesh::ParsedFEMFunction< libMesh::Number > &old_func, libMesh::ParsedFEMFunction< libMesh::Number > &new_func)
 When cloning an object, we need to update parameter pointers. More...
 

Protected Attributes

libMesh::ParsedFunction< libMesh::Number > base_velocity_function
 
libMesh::ParsedFunction< libMesh::Number > local_vertical_function
 
libMesh::ParsedFunction< libMesh::Number > lift_function
 
libMesh::ParsedFunction< libMesh::Number > drag_function
 
libMesh::ParsedFunction< libMesh::Number > torque_function
 
libMesh::Number moment_of_inertia
 
libMesh::Number initial_speed
 
libMesh::ParsedFunction< libMesh::Number > chord_function
 
libMesh::ParsedFunction< libMesh::Number > area_swept_function
 
libMesh::ParsedFunction< libMesh::Number > aoa_function
 
VariableIndex _fan_speed_var
 
std::string _fan_speed_var_name
 
- Protected Attributes inherited from GRINS::IncompressibleNavierStokesBase< Viscosity >
unsigned int _dim
 Physical dimension of problem. More...
 
VelocityFEVariables _flow_vars
 
PressureFEVariable _press_var
 
libMesh::Number _rho
 Material parameters, read from input. More...
 
Viscosity _mu
 Viscosity object. More...
 
- Protected Attributes inherited from GRINS::Physics
const PhysicsName _physics_name
 Name of the physics object. Used for reading physics specific inputs. More...
 
GRINS::ICHandlingBase_ic_handler
 
std::set< libMesh::subdomain_id_type > _enabled_subdomains
 Subdomains on which the current Physics class is enabled. More...
 

Private Member Functions

void read_input_options (const GetPot &input)
 Read options from GetPot input file. More...
 
 AveragedTurbineBase ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GRINS::Physics
static void set_is_axisymmetric (bool is_axisymmetric)
 Set whether we should treat the problem as axisymmetric. More...
 
static bool is_axisymmetric ()
 
- Static Public Attributes inherited from GRINS::ParameterUser
static std::string zero_vector_function = std::string("{0}")
 A parseable function string with LIBMESH_DIM components, all 0. More...
 
- Protected Member Functions inherited from GRINS::Physics
libMesh::UniquePtr< libMesh::FEGenericBase< libMesh::Real > > build_new_fe (const libMesh::Elem *elem, const libMesh::FEGenericBase< libMesh::Real > *fe, const libMesh::Point p)
 
void parse_enabled_subdomains (const GetPot &input, const std::string &physics_name)
 
- Static Protected Attributes inherited from GRINS::Physics
static bool _is_steady = false
 Caches whether or not the solver that's being used is steady or not. More...
 
static bool _is_axisymmetric = false
 Caches whether we are solving an axisymmetric problem or not. More...
 

Detailed Description

template<class Viscosity>
class GRINS::AveragedTurbineBase< Viscosity >

Definition at line 45 of file averaged_turbine_base.h.

Constructor & Destructor Documentation

template<class Mu >
GRINS::AveragedTurbineBase< Mu >::AveragedTurbineBase ( const std::string &  physics_name,
const GetPot &  input 
)

Definition at line 36 of file averaged_turbine_base.C.

References GRINS::AveragedTurbineBase< Viscosity >::read_input_options().

37  : IncompressibleNavierStokesBase<Mu>(physics_name,
38  PhysicsNaming::incompressible_navier_stokes(), /* "core" Physics name */
39  input),
42  lift_function(""),
43  drag_function(""),
44  torque_function(""),
45  chord_function(""),
47  aoa_function("")
48  {
49  this->read_input_options(input);
50  }
libMesh::ParsedFunction< libMesh::Number > area_swept_function
libMesh::ParsedFunction< libMesh::Number > base_velocity_function
libMesh::ParsedFunction< libMesh::Number > aoa_function
libMesh::ParsedFunction< libMesh::Number > torque_function
libMesh::ParsedFunction< libMesh::Number > local_vertical_function
libMesh::ParsedFunction< libMesh::Number > drag_function
static PhysicsName incompressible_navier_stokes()
libMesh::ParsedFunction< libMesh::Number > lift_function
void read_input_options(const GetPot &input)
Read options from GetPot input file.
libMesh::ParsedFunction< libMesh::Number > chord_function
template<class Viscosity >
GRINS::AveragedTurbineBase< Viscosity >::~AveragedTurbineBase ( )
inline

Definition at line 51 of file averaged_turbine_base.h.

51 {};
template<class Viscosity >
GRINS::AveragedTurbineBase< Viscosity >::AveragedTurbineBase ( )
private

Member Function Documentation

template<class Mu >
bool GRINS::AveragedTurbineBase< Mu >::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 
)

Definition at line 157 of file averaged_turbine_base.C.

165  {
166  // Find base velocity of moving fan at this point
167  libMesh::DenseVector<libMesh::Number> output_vec(3);
168 
169  base_velocity_function(point, time, output_vec);
170 
171  U_B_1(0) = output_vec(0);
172  U_B_1(1) = output_vec(1);
173  U_B_1(2) = output_vec(2);
174 
175  const libMesh::NumberVectorValue U_B = U_B_1 * s;
176 
177  const libMesh::Number U_B_size = U_B.size();
178 
179  // If there's no base velocity there's no fan
180  if (!U_B_size)
181  return false;
182 
183  // Normal in fan velocity direction
184  const libMesh::NumberVectorValue N_B =
185  libMesh::NumberVectorValue(U_B/U_B_size);
186 
187  local_vertical_function(point, time, output_vec);
188 
189  // Normal in fan vertical direction
190  const libMesh::NumberVectorValue N_V(output_vec(0),
191  output_vec(1),
192  output_vec(2));
193 
194  // Normal in radial direction (or opposite radial direction,
195  // for fans turning clockwise!)
196  const libMesh::NumberVectorValue N_R = N_B.cross(N_V);
197 
198  // Fan-wing-plane component of local relative velocity
199  const libMesh::NumberVectorValue U_P = U - (U*N_R)*N_R - U_B;
200 
201  const libMesh::Number U_P_size = U_P.size();
202 
203  // If there's no flow in the fan's frame of reference, there's no
204  // lift or drag. FIXME - should we account for drag in the
205  // out-of-plane direction?
206  if (!U_P_size)
207  return false;
208 
209  // Direction opposing drag
210  const libMesh::NumberVectorValue N_drag =
211  libMesh::NumberVectorValue(-U_P/U_P_size);
212 
213  // Direction opposing lift
214  const libMesh::NumberVectorValue N_lift = N_drag.cross(N_R);
215 
216  // "Forward" velocity
217  const libMesh::Number u_fwd = -(U_P * N_B);
218 
219  // "Upward" velocity
220  const libMesh::Number u_up = U_P * N_V;
221 
222  // If there's no forward or upward velocity we should have already
223  // returned false
224  libmesh_assert (u_up || u_fwd);
225 
226  // Angle WRT fan velocity direction
227  const libMesh::Number part_angle = std::atan2(u_up, u_fwd);
228 
229  // Angle WRT fan chord
230  const libMesh::Number angle = part_angle +
231  aoa_function(point, time);
232 
233  const libMesh::Number C_lift = lift_function(point, angle);
234  const libMesh::Number C_drag = drag_function(point, angle);
235 
236  const libMesh::Number chord = chord_function(point, time);
237  const libMesh::Number area = area_swept_function(point, time);
238 
239  const libMesh::Number v_sq = U_P*U_P;
240 
241  const libMesh::Number LDfactor = 0.5 * this->_rho * v_sq * chord / area;
242  const libMesh::Number lift = C_lift * LDfactor;
243  const libMesh::Number drag = C_drag * LDfactor;
244 
245  // Force
246  F = lift * N_lift + drag * N_drag;
247 
248  if (dFdU)
249  {
250  const libMesh::NumberVectorValue LDderivfactor =
251  (N_lift*C_lift+N_drag*C_drag) *
252  this->_rho * chord / area;
253 
254  const libMesh::Number sfactor = -(U_P*U_B_1);
255 
256  (*dFds) = LDderivfactor * sfactor;
257 
258  for (unsigned int i=0; i != 3; ++i)
259  for (unsigned int j=0; j != 3; ++j)
260  (*dFdU)(i,j) = LDderivfactor(i) * U_P(j);
261  }
262 
263  return true;
264  }
libMesh::ParsedFunction< libMesh::Number > area_swept_function
libMesh::ParsedFunction< libMesh::Number > base_velocity_function
libMesh::Number _rho
Material parameters, read from input.
libMesh::ParsedFunction< libMesh::Number > aoa_function
libMesh::ParsedFunction< libMesh::Number > local_vertical_function
libMesh::ParsedFunction< libMesh::Number > drag_function
libMesh::ParsedFunction< libMesh::Number > lift_function
libMesh::ParsedFunction< libMesh::Number > chord_function
template<class Viscosity >
VariableIndex GRINS::AveragedTurbineBase< Viscosity >::fan_speed_var ( ) const
inline
template<class Mu >
void GRINS::AveragedTurbineBase< Mu >::init_variables ( libMesh::FEMSystem *  system)
virtual

Initialization of variables.

Add turbine_speed variable to system; call base function to initialize Navier-Stokes variables.

Reimplemented from GRINS::IncompressibleNavierStokesBase< Viscosity >.

Definition at line 53 of file averaged_turbine_base.C.

References GRINS::IncompressibleNavierStokesBase< Viscosity >::init_variables().

54  {
55  this->_fan_speed_var = system->add_variable(_fan_speed_var_name,
56  libMesh::FIRST,
57  libMesh::SCALAR);
58 
60  }
virtual void init_variables(libMesh::FEMSystem *system)
Initialization of Navier-Stokes variables.
template<class Mu >
void GRINS::AveragedTurbineBase< Mu >::read_input_options ( const GetPot &  input)
private

Read options from GetPot input file.

Definition at line 72 of file averaged_turbine_base.C.

References GRINS::PhysicsNaming::averaged_turbine(), and GRINS::fan_speed_var_name_default.

Referenced by GRINS::AveragedTurbineBase< Viscosity >::AveragedTurbineBase().

73  {
75  "Physics/"+PhysicsNaming::averaged_turbine()+"/base_velocity",
76  this->zero_vector_function);
77 
78  if (base_velocity_function.expression() == this->zero_vector_function)
79  libmesh_error_msg("Error! Zero AveragedTurbine specified!" <<
80  std::endl);
81 
83  "Physics/"+PhysicsNaming::averaged_turbine()+"/local_vertical",
84  this->zero_vector_function);
85 
86  if (local_vertical_function.expression() == this->zero_vector_function)
87  libmesh_error_msg("Error! Zero LocalVertical specified!" <<
88  std::endl);
89 
90  this->set_parameter(lift_function, input,
91  "Physics/"+PhysicsNaming::averaged_turbine()+"/lift",
92  "0");
93 
94  if (lift_function.expression() == "0")
95  std::cout << "Warning! Zero lift function specified!" << std::endl;
96 
97  this->set_parameter(drag_function, input,
98  "Physics/"+PhysicsNaming::averaged_turbine()+"/drag",
99  "0");
100 
101  if (drag_function.expression() == "0")
102  std::cout << "Warning! Zero drag function specified!" << std::endl;
103 
104  this->set_parameter(chord_function, input,
105  "Physics/"+PhysicsNaming::averaged_turbine()+"/chord_length",
106  "0");
107 
108  if (chord_function.expression() == "0")
109  libmesh_error_msg("Error! Zero chord function specified!" <<
110  std::endl);
111 
112  this->set_parameter(area_swept_function, input,
113  "Physics/"+PhysicsNaming::averaged_turbine()+"/area_swept",
114  "0");
115 
116  if (area_swept_function.expression() == "0")
117  libmesh_error_msg("Error! Zero area_swept_function specified!" <<
118  std::endl);
119 
120  this->set_parameter(aoa_function, input,
121  "Physics/"+PhysicsNaming::averaged_turbine()+"/angle_of_attack",
122  "00000");
123 
124  if (aoa_function.expression() == "00000")
125  libmesh_error_msg("Error! No angle-of-attack specified!" <<
126  std::endl);
127 
128  this->set_parameter(torque_function, input,
129  "Physics/"+PhysicsNaming::averaged_turbine()+"/torque",
130  "0");
131 
132  if (torque_function.expression() == "0")
133  std::cout << "Warning! Zero torque function specified!" << std::endl;
134 
135  this->set_parameter
136  (this->moment_of_inertia, input,
137  "Physics/"+PhysicsNaming::averaged_turbine()+"/moment_of_inertia",
138  libMesh::Number(0));
139 
140  if (!moment_of_inertia)
141  libmesh_error_msg(
142  "Error! Zero AveragedTurbine moment of inertia specified!" <<
143  std::endl);
144 
145  this->set_parameter
146  (this->initial_speed, input,
147  "Physics/"+PhysicsNaming::averaged_turbine()+"/initial_speed",
148  libMesh::Number(0));
149 
150  this->_fan_speed_var_name = input("Physics/VariableNames/fan_speed",
152 
153  }
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
libMesh::ParsedFunction< libMesh::Number > area_swept_function
libMesh::ParsedFunction< libMesh::Number > base_velocity_function
const std::string fan_speed_var_name_default
fan speed
static std::string zero_vector_function
A parseable function string with LIBMESH_DIM components, all 0.
libMesh::ParsedFunction< libMesh::Number > aoa_function
libMesh::ParsedFunction< libMesh::Number > torque_function
libMesh::ParsedFunction< libMesh::Number > local_vertical_function
libMesh::ParsedFunction< libMesh::Number > drag_function
static PhysicsName averaged_turbine()
libMesh::ParsedFunction< libMesh::Number > lift_function
libMesh::ParsedFunction< libMesh::Number > chord_function
template<class Mu >
void GRINS::AveragedTurbineBase< Mu >::set_time_evolving_vars ( libMesh::FEMSystem *  system)
virtual

Sets turbine_speed and velocity variables to be time-evolving.

Reimplemented from GRINS::IncompressibleNavierStokesBase< Viscosity >.

Definition at line 63 of file averaged_turbine_base.C.

References GRINS::IncompressibleNavierStokesBase< Viscosity >::set_time_evolving_vars().

64  {
65  system->time_evolving(this->fan_speed_var());
66 
68  }
virtual void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
VariableIndex fan_speed_var() const

Member Data Documentation

template<class Viscosity >
VariableIndex GRINS::AveragedTurbineBase< Viscosity >::_fan_speed_var
protected
template<class Viscosity >
std::string GRINS::AveragedTurbineBase< Viscosity >::_fan_speed_var_name
protected

Definition at line 137 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::aoa_function
protected

Definition at line 133 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::area_swept_function
protected

Definition at line 128 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::base_velocity_function
protected

Definition at line 83 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::chord_function
protected

Definition at line 123 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::drag_function
protected

Definition at line 95 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::Number GRINS::AveragedTurbineBase< Viscosity >::initial_speed
protected

Definition at line 119 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::lift_function
protected

Definition at line 94 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::local_vertical_function
protected

Definition at line 87 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::Number GRINS::AveragedTurbineBase< Viscosity >::moment_of_inertia
protected

Definition at line 115 of file averaged_turbine_base.h.

template<class Viscosity >
libMesh::ParsedFunction<libMesh::Number> GRINS::AveragedTurbineBase< Viscosity >::torque_function
protected

Definition at line 111 of file averaged_turbine_base.h.


The documentation for this class was generated from the following files:

Generated on Thu Jun 2 2016 21:52:30 for GRINS-0.7.0 by  doxygen 1.8.10