33 #include "libmesh/parsed_fem_function.h"
43 base_physics_name(
"VelocityPenalty"),
44 _quadratic_scaling(false),
62 input(
"Physics/"+base_physics_name+
"/quadratic_scaling",
false);
70 this->normal_vector_function.reset(nvf);
72 this->set_parameter(*nvf, _input,
73 "Physics/"+base_physics_name+
"/penalty_function",
74 this->zero_vector_function);
78 this->base_velocity_function.reset(bvf);
80 this->set_parameter(*bvf, _input,
81 "Physics/"+base_physics_name+
"/base_velocity",
82 this->zero_vector_function);
84 if ((nvf->expression() == this->zero_vector_function) &&
85 (bvf->expression() == this->zero_vector_function))
86 std::cout <<
"Warning! Zero VelocityPenalty specified!" << std::endl;
92 (
const libMesh::Point& point,
94 const libMesh::NumberVectorValue& U,
95 libMesh::NumberVectorValue& F,
96 libMesh::NumberTensorValue *dFdU)
101 libMesh::DenseVector<libMesh::Number> output_vec(3);
103 (*this->normal_vector_function)(context, point, context.time, output_vec);
105 libMesh::NumberVectorValue U_N(output_vec(0),
109 (*this->base_velocity_function)(context, point, context.time, output_vec);
111 const libMesh::NumberVectorValue U_B(output_vec(0),
115 const libMesh::NumberVectorValue U_Rel = U-U_B;
121 const libMesh::Number U_N_mag = std::sqrt(U_N*U_N);
126 const libMesh::NumberVectorValue U_N_unit = U_N/U_N_mag;
128 F = -(U_Rel*U_N)*U_N_unit;
131 for (
unsigned int i=0; i != 3; ++i)
132 for (
unsigned int j=0; j != 3; ++j)
133 (*dFdU)(i,j) = -(U_N(j))*U_N_unit(i);
136 if (_quadratic_scaling)
138 const libMesh::Number U_Rel_mag = std::sqrt(U_Rel * U_Rel);
147 const libMesh::NumberVectorValue U_Rel_unit = U_Rel/U_Rel_mag;
149 (*dFdU) *= U_Rel_mag;
152 for (
unsigned int i=0; i != 3; ++i)
153 for (
unsigned int j=0; j != 3; ++j)
154 (*dFdU)(i,j) += F(i)*U_Rel_unit(j);
161 bool do_correction =
false;
165 libmesh_not_implemented();
167 const libMesh::Number U_Rel_mag_sq = U_Rel * U_Rel;
170 F -= (U_Rel*F)*U_Rel/U_Rel_mag_sq;
Physics class for Incompressible Navier-Stokes.
static PhysicsName velocity_penalty3_adjoint_stab()
bool compute_force(const libMesh::Point &point, const AssemblyContext &context, const libMesh::NumberVectorValue &U, libMesh::NumberVectorValue &F, libMesh::NumberTensorValue *dFdU=NULL)
static PhysicsName velocity_penalty2()
const PhysicsName _physics_name
Name of the physics object. Used for reading physics specific inputs.
INSTANTIATE_INC_NS_SUBCLASS(VelocityPenaltyBase)
void read_input_options(const GetPot &input)
Read options from GetPot input file.
void set_time_evolving_vars(libMesh::FEMSystem *system)
Sets velocity variables to be time-evolving.
static PhysicsName velocity_penalty2_adjoint_stab()
std::string base_physics_name
static PhysicsName velocity_penalty3()