78 f_jac_x = RealMatrixX::Zero( n2, n2),
79 fm_jac_xdot = RealMatrixX::Zero( n2, n2);
91 local_jac = ComplexMatrixX::Zero( n2, n2);
97 local_f = RealVectorX::Zero(n2);
125 local_jac = (f_jac_x.cast<
Complex>() * b_V +
126 iota * omega * fm_jac_xdot.cast<
Complex>());
128 if (request_jacobian)
133 return request_jacobian;
143 bool request_jacobian,
158 f_jac_x = RealMatrixX::Zero( n2, n2),
159 fm_jac_xdot = RealMatrixX::Zero( n2, n2);
171 local_jac = ComplexMatrixX::Zero( n2, n2),
172 local_jac_sens = ComplexMatrixX::Zero( n2, n2);
178 local_f = RealVectorX::Zero(n2);
209 local_jac = (f_jac_x.cast<
Complex>() * b_V +
210 iota * omega * fm_jac_xdot.cast<
Complex>());
212 local_jac_sens = (iota * domega * fm_jac_xdot.cast<
Complex>());
215 if (request_jacobian)
216 jac += local_jac_sens;
220 return request_jacobian;
231 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
244 f_jac_x = RealMatrixX::Zero(n2, n2);
247 local_f = RealVectorX::Zero(n2);
254 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
257 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
261 for ( ; it != end; it++) {
263 std::vector<MAST::BoundaryConditionBase*>::const_iterator
264 bc_it = it->second.begin(),
265 bc_end = it->second.end();
267 for ( ; bc_it != bc_end; bc_it++) {
270 switch ((*bc_it)->type()) {
288 if (request_jacobian)
289 jac += f_jac_x.cast<
Complex>() * b_V;
323 if (request_jacobian)
324 jac += f_jac_x.cast<
Complex>() * b_V;
343 return request_jacobian;
354 bool request_jacobian,
357 std::multimap<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>& bc) {
370 f_jac_x = RealMatrixX::Zero(n2, n2);
373 local_f = RealVectorX::Zero(n2);
379 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>> loads;
382 std::map<unsigned int, std::vector<MAST::BoundaryConditionBase*>>::const_iterator
386 for ( ; it != end; it++) {
388 std::vector<MAST::BoundaryConditionBase*>::const_iterator
389 bc_it = it->second.begin(),
390 bc_end = it->second.end();
392 for ( ; bc_it != bc_end; bc_it++) {
395 switch ((*bc_it)->type()) {
467 return request_jacobian;
480 const unsigned int s,
492 const std::vector<Real> &JxW = fe->get_JxW();
493 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
494 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
499 n2 = fe->n_shape_functions()*n1;
502 vec1_n1 = RealVectorX::Zero(n1),
503 uvec = RealVectorX::Zero(3),
504 dwdot_i = RealVectorX::Zero(3),
505 ni = RealVectorX::Zero(3),
506 dni = RealVectorX::Zero(3),
507 tmp = RealVectorX::Zero(6);
510 Dw_i = ComplexVectorX::Zero(3),
511 Dni = ComplexVectorX::Zero(3),
512 Duvec = ComplexVectorX::Zero(3),
513 vec2_n1 = ComplexVectorX::Zero(n1),
514 vec2_n2 = ComplexVectorX::Zero(n2),
515 flux = ComplexVectorX::Zero(n1),
516 tmp_c = ComplexVectorX::Zero(6);
519 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
520 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
521 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
532 Dvi_ni_freq_indep = 0.,
533 Dvi_ni_freq_dep = 0.;
548 *displ_perturb =
nullptr;
550 *n_rot_perturb =
nullptr;
555 if (bc.
contains(
"normal_rotation")) {
562 if (bc.
contains(
"frequency_domain_displacement")) {
566 libmesh_assert(bc.
contains(
"frequency_domain_normal_rotation"));
580 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
588 primitive_sol.
zero();
589 primitive_sol.
init(dim,
596 sd_primitive_sol.
zero();
623 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
624 ni(i_dim) = normals[qp](i_dim);
639 (*vel)(qpoint[qp],
_time, tmp);
640 dwdot_i = tmp.topRows(3);
644 (*n_rot)(qpoint[qp], normals[qp],
_time, dni);
646 ui_ni_steady = dwdot_i.dot(ni+dni) - uvec.dot(dni);
648 flux += ui_ni_steady * b_V * vec2_n1;
649 flux(n1-1) += ui_ni_steady * b_V * sd_primitive_sol.
dp;
656 (*displ_perturb)(qpoint[qp],
_time, tmp_c);
657 Dw_i = tmp_c.topRows(3);
658 (*n_rot_perturb)(qpoint[qp], normals[qp],
_time, Dni);
661 Dvi_ni_freq_dep = Dw_i.dot(ni+dni) * iota * omega;
662 Dvi_ni_freq_indep = (dwdot_i.cast<
Complex>().dot(Dni) -
663 uvec.cast<
Complex>().dot(Dni) -
667 flux += (Dvi_ni_freq_indep * b_V +
668 Dvi_ni_freq_dep) * vec1_n1;
669 flux(n1-1) += (Dvi_ni_freq_indep * b_V +
670 Dvi_ni_freq_dep) * primitive_sol.
p;
673 flux.segment(1, dim) += ((sd_primitive_sol.
dp * b_V) *
674 ni.segment(0,dim).cast<
Complex>());
677 f += JxW[qp] * vec2_n2;
679 if ( request_jacobian ) {
692 jac += (JxW[qp] * b_V) * mat3_n2n2.cast<
Complex>() ;
696 return request_jacobian;
707 bool request_jacobian,
710 const unsigned int s,
722 const std::vector<Real> &JxW = fe->get_JxW();
723 const std::vector<libMesh::Point>& normals = fe->get_normals_for_reference_coordinate();
724 const std::vector<libMesh::Point>& qpoint = fe->get_xyz();
729 n2 = fe->n_shape_functions()*n1;
732 vec1_n1 = RealVectorX::Zero(n1),
733 uvec = RealVectorX::Zero(3),
734 ni = RealVectorX::Zero(3),
735 dni = RealVectorX::Zero(3),
736 dwdot_i = RealVectorX::Zero(3),
737 tmp = RealVectorX::Zero(6);
740 vec2_n1 = ComplexVectorX::Zero(n1),
741 vec2_n2 = ComplexVectorX::Zero(n2),
742 flux = ComplexVectorX::Zero(n1),
743 tmp_c = ComplexVectorX::Zero(6),
744 Dw_i = ComplexVectorX::Zero(3),
745 Dni = ComplexVectorX::Zero(3);
748 mat1_n1n1 = RealMatrixX::Zero( n1, n1),
749 mat2_n1n2 = RealMatrixX::Zero( n1, n2),
750 mat3_n2n2 = RealMatrixX::Zero( n2, n2);
761 Dvi_ni_freq_indep = 0.,
762 Dvi_ni_freq_dep = 0.;
777 *displ_perturb =
nullptr;
779 *n_rot_perturb =
nullptr;
786 libmesh_assert( bc.
contains(
"normal_rotation"));
794 if (bc.
contains(
"frequency_domain_displacement")) {
798 libmesh_assert( bc.
contains(
"frequency_domain_normal_rotation"));
811 for (
unsigned int qp=0; qp<JxW.size(); qp++) {
819 primitive_sol.
zero();
820 primitive_sol.
init(dim,
827 sd_primitive_sol.
zero();
852 for (
unsigned int i_dim=0; i_dim<
dim; i_dim++)
853 ni(i_dim) = normals[qp](i_dim);
864 (*displ) (qpoint[qp],
_time, tmp);
865 dwdot_i = tmp.topRows(3);
866 (*n_rot)(qpoint[qp], normals[qp],
_time, dni);
874 (*displ_perturb)(qpoint[qp],
_time, tmp_c);
875 Dw_i = tmp_c.topRows(3);
876 (*n_rot_perturb)(qpoint[qp], normals[qp],
_time, Dni);
880 Dvi_ni_freq_dep = Dw_i.dot(ni+dni) * iota * domega;
883 flux += Dvi_ni_freq_dep * vec1_n1;
884 flux(n1-1) += Dvi_ni_freq_dep * primitive_sol.
p;
888 f += JxW[qp] * vec2_n2;
890 if ( request_jacobian ) {
891 libmesh_assert(
false);
896 return request_jacobian;
void vector_mult_transpose(T &res, const T &v) const
res = v^T * [this]
This class provides the necessary functionality for spatial discretization of the conservative fluid ...
Class defines basic operations and calculation of the small disturbance primitive variables...
virtual bool internal_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac)
sensitivity of internal force contribution to system residual.
const MAST::GeomElem & _elem
geometric element for which the computations are performed
void calculate_advection_flux_jacobian_for_moving_solid_wall_boundary(const MAST::PrimitiveSolution &sol, const Real ui_ni, const libMesh::Point &nvec, const RealVectorX &dnvec, RealMatrixX &mat)
bool side_external_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
side external force contribution to system residual
Class defines the conversion and some basic operations on primitive fluid variables used in calculati...
void init(const MAST::PrimitiveSolution &sol, const typename VectorType< ValType >::return_type &delta_sol, bool if_viscous)
virtual bool internal_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac)
internal force contribution to system residual
ComplexVectorX _complex_sol
local solution used for frequency domain analysis
Matrix< Complex, Dynamic, 1 > ComplexVectorX
void right_multiply(T &r, const T &m) const
[R] = [this] * [M]
virtual bool velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual
MAST::FrequencyFunction * freq
frequency function that provides the frequency for computations.
const MAST::FlightCondition * flight_condition
This defines the surface motion for use with the nonlinear fluid solver.
virtual bool symmetry_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
virtual void derivative(const MAST::FunctionBase &f, Real &v) const
calculates the value of the function derivative and returns it in v.
void nondimensionalizing_factor(Real &v)
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Complex, Dynamic, Dynamic > ComplexMatrixX
ComplexVectorX _complex_sol_sens
local solution used for frequency domain analysis
void get_uvec(RealVectorX &u) const
Matrix< Real, Dynamic, 1 > RealVectorX
virtual ~FrequencyDomainLinearizedConservativeFluidElem()
void get_duvec(typename VectorType< ValType >::return_type &du) const
virtual std::unique_ptr< MAST::FEBase > init_side_fe(unsigned int s, bool init_grads, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object for the side with the order of qu...
RealVectorX _sol
local solution
virtual bool internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual
void init(const unsigned int dim, const RealVectorX &conservative_sol, const Real cp_val, const Real cv_val, bool if_viscous)
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
void _initialize_fem_interpolation_operator(const unsigned int qp, const unsigned int dim, const MAST::FEBase &fe, MAST::FEMOperatorMatrix &Bmat)
GasProperty gas_property
Ambient air properties.
virtual void external_side_loads_for_quadrature_elem(std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc, std::map< unsigned int, std::vector< MAST::BoundaryConditionBase * >> &loads) const
From the given list of boundary loads, this identifies the sides of the quadrature element and the lo...
void right_multiply_transpose(T &r, const T &m) const
[R] = [this]^T * [M]
virtual bool slip_wall_surface_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
sensitivity of residual of the slip wall that may be oscillating.
void left_multiply(T &r, const T &m) const
[R] = [M] * [this]
FrequencyDomainLinearizedConservativeFluidElem(MAST::SystemInitialization &sys, MAST::AssemblyBase &assembly, const MAST::GeomElem &elem, const MAST::FlightCondition &f)
virtual bool far_field_surface_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
const ValType & get(const std::string &nm) const
returns a constant reference to the specified function
const Real & _time
time for which system is being assembled
virtual bool side_external_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
sensitivity of internal force contribution to system residual.
virtual bool slip_wall_surface_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, const unsigned int s, MAST::BoundaryConditionBase &bc)
residual of the slip wall that may be oscillating.
bool contains(const std::string &nm) const
checks if the card contains the specified property value