1 #ifndef VERTEXCFD_BOUNDARYCONDITION_INCOMPRESSIBLELSVOFBOUNDARYFLUX_IMPL_HPP
2 #define VERTEXCFD_BOUNDARYCONDITION_INCOMPRESSIBLELSVOFBOUNDARYFLUX_IMPL_HPP
4 #include "VertexCFD_BoundaryState_ViscousGradient.hpp"
5 #include "VertexCFD_BoundaryState_ViscousPenaltyParameter.hpp"
6 #include "VertexCFD_Integrator_BoundaryGradBasisDotVector.hpp"
8 #include "incompressible_lsvof_solver/boundary_conditions/VertexCFD_IncompressibleLSVOFBoundaryState_Factory.hpp"
9 #include "incompressible_lsvof_solver/closure_models/VertexCFD_Closure_IncompressibleLSVOFConvectiveFlux.hpp"
10 #include "incompressible_lsvof_solver/closure_models/VertexCFD_Closure_IncompressibleLSVOFNthPhaseFraction.hpp"
11 #include "incompressible_lsvof_solver/closure_models/VertexCFD_Closure_IncompressibleLSVOFScalarConvectiveFlux.hpp"
12 #include "incompressible_lsvof_solver/closure_models/VertexCFD_Closure_IncompressibleLSVOFVariableProperties.hpp"
13 #include "incompressible_lsvof_solver/closure_models/VertexCFD_Closure_IncompressibleLSVOFViscousFlux.hpp"
15 #include "utils/VertexCFD_Utils_PhaseIndex.hpp"
16 #include "utils/VertexCFD_Utils_ScalarToVector.hpp"
18 #include <Panzer_DOF.hpp>
19 #include <Panzer_DOFGradient.hpp>
20 #include <Panzer_DotProduct.hpp>
21 #include <Panzer_Integrator_BasisTimesScalar.hpp>
22 #include <Panzer_Normals.hpp>
23 #include <Panzer_Sum.hpp>
25 #include <Phalanx_DataLayout.hpp>
26 #include <Phalanx_DataLayout_MDALayout.hpp>
27 #include <Phalanx_MDField.hpp>
35 namespace BoundaryCondition
38 template<
class EvalType,
int NumSpaceDim>
39 IncompressibleLSVOFBoundaryFlux<EvalType, NumSpaceDim>::IncompressibleLSVOFBoundaryFlux(
40 const panzer::BC& bc,
const Teuchos::RCP<panzer::GlobalData>& global_data)
41 : BoundaryFluxBase<EvalType, NumSpaceDim>(bc, global_data)
46 template<
class EvalType,
int NumSpaceDim>
48 const panzer::PhysicsBlock& side_pb,
49 const Teuchos::ParameterList& )
52 _bc_params = *(this->m_bc.params());
53 this->getModelID(_bc_params, side_pb, _model_id, _side_pb_list);
56 _lsvof_params = side_pb.getParameterList()->sublist(_model_id).sublist(
61 = _lsvof_params.isType<
bool>(
"Build LSVOF Navier-Stokes Equations")
62 ? _lsvof_params.get<
bool>(
"Build LSVOF Navier-Stokes Equations")
68 _equ_dof_ns_pair.insert({
"continuity",
"lagrange_pressure"});
70 for (
int d = 0; d < num_space_dim; ++d)
72 const std::string ds = std::to_string(d);
73 _equ_dof_ns_pair.insert({
"momentum_" + ds,
"velocity_" + ds});
77 const std::string lsvof_model_name
78 = _lsvof_params.get<std::string>(
"LSVOF Model");
80 const int num_phases = _lsvof_params.get<
int>(
"Number of Phases");
83 if (lsvof_model_name ==
"VOF")
85 for (
int n = 1; n <= num_phases; ++n)
87 const std::string list_name =
"Phase " + std::to_string(n);
89 Teuchos::ParameterList phase_list
90 = _lsvof_params.sublist(list_name);
92 const std::string phase_name
93 = phase_list.get<std::string>(
"Phase Name");
95 const std::string phase_fraction_name =
"alpha_" + phase_name;
97 _all_phase_names.push_back(phase_fraction_name);
101 _equ_dof_lsvof_pair.insert(
102 {phase_fraction_name +
"_equation", phase_fraction_name});
104 _dof_phase_names.push_back(phase_fraction_name);
111 this->initialize(side_pb, _equ_dof_lsvof_pair);
115 template<
class EvalType,
int NumSpaceDim>
117 PHX::FieldManager<panzer::Traits>& fm,
118 const panzer::PhysicsBlock& side_pb,
119 const panzer::ClosureModelFactory_TemplateManager<panzer::Traits>&,
120 const Teuchos::ParameterList&,
121 const Teuchos::ParameterList& user_data)
const
124 std::unordered_map<std::string, std::vector<std::string>> eq_vct_map;
127 const auto ir = this->integrationRule();
130 for (
auto& pair : _equ_dof_ns_pair)
132 this->registerDOFsGradient(fm, side_pb, pair.second);
136 for (
auto& pair : _equ_dof_lsvof_pair)
138 this->registerDOFsGradient(fm, side_pb, pair.second);
142 const bool include_time_deriv =
false;
143 const bool include_grads =
false;
145 const auto phase_vec_op
146 = Utils::ScalarToVector<EvalType, PhaseIndex>::createFromList(
153 this->
template registerEvaluator<EvalType>(fm, phase_vec_op);
156 const auto nth_phase_op = Teuchos::rcp(
157 new ClosureModel::IncompressibleLSVOFNthPhaseFraction<EvalType,
159 *ir, _all_phase_names));
161 this->
template registerEvaluator<EvalType>(fm, nth_phase_op);
164 this->registerSideNormals(fm, side_pb);
167 const auto bc_params = *(this->m_bc.params());
169 auto incomp_lsvof_boundary_state_op
170 = IncompressibleLSVOFBoundaryStateFactory<EvalType,
173 create(*ir, _all_phase_names, bc_params, _lsvof_params, user_data);
174 this->
template registerEvaluator<EvalType>(fm,
175 incomp_lsvof_boundary_state_op);
178 auto var_prop_op = Teuchos::rcp(
179 new ClosureModel::IncompressibleLSVOFVariableProperties<EvalType,
181 *ir, _lsvof_params, _all_phase_names,
false,
"BOUNDARY_"));
183 this->
template registerEvaluator<EvalType>(fm, var_prop_op);
190 auto convective_flux_op = Teuchos::rcp(
191 new ClosureModel::IncompressibleLSVOFConvectiveFlux<EvalType,
194 *ir,
"BOUNDARY_",
"BOUNDARY_"));
195 this->
template registerEvaluator<EvalType>(fm, convective_flux_op);
197 for (
auto& pair : _equ_dof_ns_pair)
199 this->registerConvectionTypeFluxOperator(
200 pair, eq_vct_map,
"CONVECTIVE", fm, side_pb, 1.0);
206 for (
auto& pair : _equ_dof_lsvof_pair)
208 const auto& equ_name = pair.first;
209 const auto& dof_name = pair.second;
211 Teuchos::ParameterList conv_flux_params;
212 conv_flux_params.set(
"Field Name", dof_name);
213 conv_flux_params.set(
"Equation Name", equ_name);
215 auto lsvof_convective_flux_op = Teuchos::rcp(
216 new ClosureModel::IncompressibleLSVOFScalarConvectiveFlux<
221 _dof_phase_names.size(),
226 this->
template registerEvaluator<EvalType>(fm,
227 lsvof_convective_flux_op);
229 this->registerConvectionTypeFluxOperator(
230 pair, eq_vct_map,
"CONVECTIVE", fm, side_pb, 1.0);
240 for (
auto& pair : _equ_dof_ns_pair)
242 this->registerPenaltyAndViscousGradientOperator(
243 pair, fm, side_pb, user_data);
247 for (
auto& pair : this->bnd_prefix)
250 const std::string flux_prefix = pair.first;
251 const std::string gradient_prefix = pair.second;
252 const std::string field_prefix =
"BOUNDARY_";
254 auto viscous_flux_op = Teuchos::rcp(
255 new ClosureModel::IncompressibleLSVOFViscousFlux<EvalType,
263 this->
template registerEvaluator<EvalType>(fm, viscous_flux_op);
267 for (
auto& pair : _equ_dof_ns_pair)
269 this->registerViscousTypeFluxOperator(
270 pair, eq_vct_map,
"VISCOUS", fm, side_pb, 1.0);
274 for (
auto& pair : _equ_dof_ns_pair)
276 this->registerResidual(pair, eq_vct_map, fm, side_pb);
281 for (
auto& pair : _equ_dof_lsvof_pair)
283 this->registerResidual(pair, eq_vct_map, fm, side_pb);
288 template<
class EvalType,
int NumSpaceDim>
289 void IncompressibleLSVOFBoundaryFlux<EvalType, NumSpaceDim>::
290 buildAndRegisterScatterEvaluators(
291 PHX::FieldManager<panzer::Traits>& fm,
292 const panzer::PhysicsBlock& side_pb,
293 const panzer::LinearObjFactory<panzer::Traits>& lof,
294 const Teuchos::ParameterList& )
const
296 for (
auto& pair : _equ_dof_ns_pair)
298 this->registerScatterOperator(pair, fm, side_pb, lof);
301 for (
auto& pair : _equ_dof_lsvof_pair)
303 this->registerScatterOperator(pair, fm, side_pb, lof);
308 template<
class EvalType,
int NumSpaceDim>
309 void IncompressibleLSVOFBoundaryFlux<EvalType, NumSpaceDim>::
310 buildAndRegisterGatherAndOrientationEvaluators(
311 PHX::FieldManager<panzer::Traits>& fm,
312 const panzer::PhysicsBlock& side_pb,
313 const panzer::LinearObjFactory<panzer::Traits>& lof,
314 const Teuchos::ParameterList& user_data)
const
316 side_pb.buildAndRegisterGatherAndOrientationEvaluators(fm, lof, user_data);
320 template<
class EvalType,
int NumSpaceDim>
321 void IncompressibleLSVOFBoundaryFlux<EvalType, NumSpaceDim>::postRegistrationSetup(
322 typename panzer::Traits::SetupData, PHX::FieldManager<panzer::Traits>&)
327 template<
class EvalType,
int NumSpaceDim>
328 void IncompressibleLSVOFBoundaryFlux<EvalType, NumSpaceDim>::evaluateFields(
329 typename panzer::Traits::EvalData)