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

#include <averaged_fan_base.h>

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

Public Member Functions

 AveragedFanBase (const std::string &physics_name, const GetPot &input)
 
 ~AveragedFanBase ()
 
bool compute_force (const libMesh::Point &point, const libMesh::Real time, const libMesh::NumberVectorValue &U, libMesh::NumberVectorValue &F, libMesh::NumberTensorValue *dFdU=NULL)
 
- 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 set_time_evolving_vars (libMesh::FEMSystem *system)
 Sets velocity variables to be time-evolving. More...
 
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 void init_variables (libMesh::FEMSystem *)
 Initialize variables for this physics. More...
 
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 preassembly (MultiphysicsSystem &)
 Perform any necessary setup before element assembly begins. More...
 
virtual void reinit (MultiphysicsSystem &)
 Any reinitialization that needs to be done. More...
 
virtual void element_time_derivative (bool, AssemblyContext &)
 Time dependent part(s) of physics for element interiors. More...
 
virtual void side_time_derivative (bool, AssemblyContext &)
 Time dependent part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_time_derivative (bool, AssemblyContext &)
 Time dependent part(s) of physics for scalar variables. More...
 
virtual void element_constraint (bool, AssemblyContext &)
 Constraint part(s) of physics for element interiors. More...
 
virtual void side_constraint (bool, AssemblyContext &)
 Constraint part(s) of physics for boundaries of elements on the domain boundary. More...
 
virtual void nonlocal_constraint (bool, AssemblyContext &)
 Constraint part(s) of physics for scalar variables. More...
 
virtual void damping_residual (bool, AssemblyContext &)
 Damping matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void mass_residual (bool, AssemblyContext &)
 Mass matrix part(s) for element interiors. All boundary terms lie within the time_derivative part. More...
 
virtual void nonlocal_mass_residual (bool, AssemblyContext &)
 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 (AssemblyContext &)
 
virtual void compute_side_time_derivative_cache (AssemblyContext &)
 
virtual void compute_nonlocal_time_derivative_cache (AssemblyContext &)
 
virtual void compute_element_constraint_cache (AssemblyContext &)
 
virtual void compute_side_constraint_cache (AssemblyContext &)
 
virtual void compute_nonlocal_constraint_cache (AssemblyContext &)
 
virtual void compute_damping_residual_cache (AssemblyContext &)
 
virtual void compute_mass_residual_cache (AssemblyContext &)
 
virtual void compute_nonlocal_mass_residual_cache (AssemblyContext &)
 
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 > chord_function
 
libMesh::ParsedFunction< libMesh::Number > area_swept_function
 
libMesh::ParsedFunction< libMesh::Number > aoa_function
 
- Protected Attributes inherited from GRINS::IncompressibleNavierStokesBase< Viscosity >
VelocityVariable_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...
 
 AveragedFanBase ()
 

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)
 
void check_var_subdomain_consistency (const FEVariablesBase &var) const
 Check that var is enabled on at least the subdomains this Physics is. More...
 
- 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::AveragedFanBase< Viscosity >

Definition at line 45 of file averaged_fan_base.h.

Constructor & Destructor Documentation

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

Definition at line 38 of file averaged_fan_base.C.

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

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

Definition at line 51 of file averaged_fan_base.h.

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

Member Function Documentation

template<class Mu >
bool GRINS::AveragedFanBase< Mu >::compute_force ( const libMesh::Point &  point,
const libMesh::Real  time,
const libMesh::NumberVectorValue &  U,
libMesh::NumberVectorValue &  F,
libMesh::NumberTensorValue *  dFdU = NULL 
)

Definition at line 113 of file averaged_fan_base.C.

118  {
119  // Find base velocity of moving fan at this point
120  libMesh::DenseVector<libMesh::Number> output_vec(3);
121 
122  base_velocity_function(point, time,
123  output_vec);
124 
125  const libMesh::NumberVectorValue U_B(output_vec(0),
126  output_vec(1),
127  output_vec(2));
128 
129  const libMesh::Number U_B_size = U_B.norm();
130 
131  // If there's no base velocity there's no fan
132  if (!U_B_size)
133  return false;
134 
135  // Normal in fan velocity direction
136  const libMesh::NumberVectorValue N_B =
137  libMesh::NumberVectorValue(U_B/U_B_size);
138 
139  local_vertical_function(point, time,
140  output_vec);
141 
142  // Normal in fan vertical direction
143  const libMesh::NumberVectorValue N_V(output_vec(0),
144  output_vec(1),
145  output_vec(2));
146 
147  // Normal in radial direction (or opposite radial direction,
148  // for fans turning clockwise!)
149  const libMesh::NumberVectorValue N_R = N_B.cross(N_V);
150 
151  // Fan-wing-plane component of local relative velocity
152  const libMesh::NumberVectorValue U_P = U - (U*N_R)*N_R - U_B;
153 
154  const libMesh::Number U_P_size = U_P.norm();
155 
156  // If there's no flow in the fan's frame of reference, there's no
157  // lift or drag. FIXME - should we account for drag in the
158  // out-of-plane direction?
159  if (!U_P_size)
160  return false;
161 
162  // Direction opposing drag
163  const libMesh::NumberVectorValue N_drag =
164  libMesh::NumberVectorValue(-U_P/U_P_size);
165 
166  // Direction opposing lift
167  const libMesh::NumberVectorValue N_lift = N_drag.cross(N_R);
168 
169  // "Forward" velocity
170  const libMesh::Number u_fwd = -(U_P * N_B);
171 
172  // "Upward" velocity
173  const libMesh::Number u_up = U_P * N_V;
174 
175  // If there's no forward or upward velocity we should have already
176  // returned false
177  libmesh_assert (u_up || u_fwd);
178 
179  // Angle WRT fan velocity direction
180  const libMesh::Number part_angle = std::atan2(u_up, u_fwd);
181 
182  // Angle WRT fan chord
183  const libMesh::Number angle = part_angle +
184  aoa_function(point, time);
185 
186  const libMesh::Number C_lift = lift_function(point, angle);
187  const libMesh::Number C_drag = drag_function(point, angle);
188 
189  const libMesh::Number chord = chord_function(point, time);
190  const libMesh::Number area = area_swept_function(point, time);
191 
192  const libMesh::Number v_sq = U_P*U_P;
193 
194  const libMesh::Number LDfactor = 0.5 * this->_rho * v_sq * chord / area;
195  const libMesh::Number lift = C_lift * LDfactor;
196  const libMesh::Number drag = C_drag * LDfactor;
197 
198  // Force
199  F = lift * N_lift + drag * N_drag;
200 
201  if (dFdU)
202  {
203  // FIXME: Jacobians here are very inexact!
204  // Dropping all AoA dependence on U terms!
205  const libMesh::NumberVectorValue LDderivfactor =
206  (N_lift*C_lift+N_drag*C_drag) *
207  this->_rho * chord / area;
208 
209  for (unsigned int i=0; i != 3; ++i)
210  for (unsigned int j=0; j != 3; ++j)
211  (*dFdU)(i,j) = LDderivfactor(i) * U_P(j);
212  }
213 
214  return true;
215  }
libMesh::ParsedFunction< libMesh::Number > drag_function
libMesh::ParsedFunction< libMesh::Number > local_vertical_function
libMesh::Number _rho
Material parameters, read from input.
libMesh::ParsedFunction< libMesh::Number > chord_function
libMesh::ParsedFunction< libMesh::Number > base_velocity_function
libMesh::ParsedFunction< libMesh::Number > area_swept_function
libMesh::ParsedFunction< libMesh::Number > lift_function
libMesh::ParsedFunction< libMesh::Number > aoa_function
template<class Mu >
void GRINS::AveragedFanBase< Mu >::read_input_options ( const GetPot &  input)
private

Read options from GetPot input file.

Definition at line 54 of file averaged_fan_base.C.

References GRINS::PhysicsNaming::averaged_fan().

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

55  {
57  "Physics/"+PhysicsNaming::averaged_fan()+"/base_velocity",
58  this->zero_vector_function);
59 
60  if (base_velocity_function.expression() == this->zero_vector_function)
61  libmesh_error_msg("Error! Zero AveragedFan specified!" <<
62  std::endl);
63 
65  "Physics/"+PhysicsNaming::averaged_fan()+"/local_vertical",
66  this->zero_vector_function);
67 
68  if (local_vertical_function.expression() == this->zero_vector_function)
69  libmesh_error_msg("Error! Zero LocalVertical specified!" <<
70  std::endl);
71 
72  this->set_parameter(lift_function, input,
73  "Physics/"+PhysicsNaming::averaged_fan()+"/lift",
74  "0");
75 
76  if (lift_function.expression() == "0")
77  std::cout << "Warning! Zero lift function specified!" << std::endl;
78 
79  this->set_parameter(drag_function, input,
80  "Physics/"+PhysicsNaming::averaged_fan()+"/drag",
81  "0");
82 
83  if (drag_function.expression() == "0")
84  std::cout << "Warning! Zero drag function specified!" << std::endl;
85 
86  this->set_parameter(chord_function, input,
87  "Physics/"+PhysicsNaming::averaged_fan()+"/chord_length",
88  "0");
89 
90  if (chord_function.expression() == "0")
91  libmesh_error_msg("Error! Zero chord function specified!" <<
92  std::endl);
93 
95  "Physics/"+PhysicsNaming::averaged_fan()+"/area_swept",
96  "0");
97 
98  if (area_swept_function.expression() == "0")
99  libmesh_error_msg("Error! Zero area_swept_function specified!" <<
100  std::endl);
101 
102  this->set_parameter(aoa_function, input,
103  "Physics/"+PhysicsNaming::averaged_fan()+"/angle_of_attack",
104  "00000");
105 
106  if (aoa_function.expression() == "00000")
107  libmesh_error_msg("Error! No angle-of-attack specified!" <<
108  std::endl);
109  }
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 > drag_function
static PhysicsName averaged_fan()
libMesh::ParsedFunction< libMesh::Number > local_vertical_function
static std::string zero_vector_function
A parseable function string with LIBMESH_DIM components, all 0.
libMesh::ParsedFunction< libMesh::Number > chord_function
libMesh::ParsedFunction< libMesh::Number > base_velocity_function
libMesh::ParsedFunction< libMesh::Number > area_swept_function
libMesh::ParsedFunction< libMesh::Number > lift_function
libMesh::ParsedFunction< libMesh::Number > aoa_function

Member Data Documentation

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

Definition at line 90 of file averaged_fan_base.h.

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

Definition at line 85 of file averaged_fan_base.h.

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

Definition at line 64 of file averaged_fan_base.h.

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

Definition at line 80 of file averaged_fan_base.h.

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

Definition at line 76 of file averaged_fan_base.h.

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

Definition at line 75 of file averaged_fan_base.h.

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

Definition at line 68 of file averaged_fan_base.h.


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

Generated on Tue Dec 19 2017 12:47:30 for GRINS-0.8.0 by  doxygen 1.8.9.1