@@ -804,32 +804,63 @@ namespace fluid_assembly {
804804 }
805805 };
806806
807- // Helper functions for equation terms
807+ // / @brief Interpolate field variables from nodes to integration point
808+ // /
809+ // / Computes velocities, accelerations, pressure gradients, and second derivatives
810+ // / at the current integration point using element shape functions.
808811 void interpolate_fields (const FluidData& data, const Vector<double >& Nw, const Vector<double >& Nq,
809812 const Array<double >& Nwx, const Array<double >& Nqx, const Array<double >& Nwxx,
810813 const Array<double >& al, const Array<double >& yl, const Array<double >& bfl,
811814 int eNoNw, int eNoNq, FluidData& result);
812815
816+ // / @brief Compute strain rate tensor and shear rate
817+ // /
818+ // / Calculates the symmetric strain rate tensor (2*e_ij) and the scalar shear rate (gamma)
819+ // / from the velocity gradient tensor, as required for viscosity models.
813820 void compute_strain_rate_tensor (FluidData& data);
814821
822+ // / @brief Compute viscosity and viscosity gradients
823+ // /
824+ // / Evaluates the viscosity model (Newtonian, Carreau-Yasuda, etc.) based on shear rate
825+ // / and computes spatial gradients of viscosity for non-Newtonian flow stabilization.
815826 void compute_viscosity_terms (ComMod& com_mod, const dmnType& dmn, FluidData& data);
816827
828+ // / @brief Compute VMS stabilization parameters
829+ // /
830+ // / Calculates tau_M, tau_C, and other stabilization parameters for
831+ // / Variational Multiscale method based on element metrics and flow properties.
817832 void compute_stabilization_parameters (const FluidData& data, const Array<double >& Kxi,
818833 bool vmsFlag, FluidData& result);
819834
835+ // / @brief Compute VMS fine-scale velocity terms
836+ // /
837+ // / Calculates the fine-scale velocity (u') and related VMS terms for
838+ // / stabilized finite element formulation.
820839 void compute_vms_terms (const FluidData& data, const Array<double >& Nwx, const Array<double >& Nwxx,
821840 int eNoNw, FluidData& result);
822841
842+ // / @brief Assemble local residual contributions for continuity equation
843+ // /
844+ // / Computes the weak form residual for the incompressibility constraint (∇·u = 0).
823845 void compute_continuity_residual (const FluidData& data, const Vector<double >& Nq,
824846 const Array<double >& Nqx, int eNoNq, double w, Array<double >& lR);
825847
848+ // / @brief Assemble local residual contributions for momentum equations
849+ // /
850+ // / Computes the weak form residual for the momentum conservation equations.
826851 void compute_momentum_residual (const FluidData& data, const Vector<double >& Nw,
827852 const Array<double >& Nwx, int eNoNw, double wr, double w, Array<double >& lR);
828853
854+ // / @brief Assemble local tangent matrix contributions for continuity equation
855+ // /
856+ // / Computes the linearized tangent matrix terms for the continuity equation.
829857 void compute_continuity_tangent (const FluidData& data, const Vector<double >& Nw, const Vector<double >& Nq,
830858 const Array<double >& Nwx, const Array<double >& Nqx,
831859 int eNoNw, int eNoNq, double wl, bool vmsFlag, Array3<double >& lK);
832860
861+ // / @brief Assemble local tangent matrix contributions for momentum equations
862+ // /
863+ // / Computes the linearized tangent matrix terms for the momentum equations.
833864 void compute_momentum_tangent (const FluidData& data, const Vector<double >& Nw, const Vector<double >& Nq,
834865 const Array<double >& Nwx, const Array<double >& Nqx, const Array<double >& Nwxx,
835866 int eNoNw, int eNoNq, double wl, double amd, bool vmsFlag, Array3<double >& lK);
@@ -1104,7 +1135,34 @@ namespace fluid_assembly {
11041135
11051136} // namespace fluid_assembly
11061137
1107- // / @brief Unified fluid assembly function for both 2D and 3D continuity equation.
1138+ // / @brief Assemble continuity residual and tangent contributions for a Gauss integration point (unified 2D/3D).
1139+ // /
1140+ // / This unified function handles both 2D and 3D cases, implementing the continuity equation
1141+ // / from the incompressible Navier-Stokes equations with VMS stabilization.
1142+ // /
1143+ // / Args:
1144+ // / com_mod - ComMod object containing simulation parameters and domain information
1145+ // / vmsFlag - Flag to indicate if VMS (Variational Multiscale) stabilization is enabled
1146+ // / eNoNw - Number of nodes in element for velocity field
1147+ // / eNoNq - Number of nodes in element for pressure field
1148+ // / w - Weight of the quadrature point (includes Jacobian)
1149+ // / Kxi - Summed gradients of parametric coordinates with respect to physical coordinates.
1150+ // / G tensor in https://www.sciencedirect.com/science/article/pii/S0045782507003027#sec4 Eq. 65. Size: (nsd,nsd)
1151+ // / Nw - Shape function values for velocity at integration point. Size: (eNoNw)
1152+ // / Nq - Shape function values for pressure at integration point. Size: (eNoNq)
1153+ // / Nwx - Gradient of shape functions for velocity. Size: (nsd,eNoNw)
1154+ // / Nqx - Gradient of shape functions for pressure. Size: (nsd,eNoNq)
1155+ // / Nwxx - Second order gradient of shape functions for velocity (for VMS). Size: (nsd*(nsd+1)/2,eNoNw)
1156+ // / al - Acceleration array for current element nodes
1157+ // / yl - Solution array (velocity, pressure) for current element nodes
1158+ // / bfl - Body force array for current element nodes
1159+ // / K_inverse_darcy_permeability - Inverse of the Darcy permeability for porous media
1160+ // / DDir - Dirac Delta function for URIS (unfitted Robin-type interface surface)
1161+ // / lR - Local residual array for current element
1162+ // / lK - Local stiffness matrix for current element
1163+ // / Modifies:
1164+ // / lR(dof,eNoN) - Residual contributions for continuity equation
1165+ // / lK(dof*dof,eNoN,eNoN) - Tangent matrix contributions for continuity equation
11081166//
11091167void fluid_unified_c (ComMod& com_mod, const int vmsFlag, const int eNoNw, const int eNoNq, const double w,
11101168 const Array<double >& Kxi, const Vector<double >& Nw, const Vector<double >& Nq, const Array<double >& Nwx,
@@ -1243,7 +1301,41 @@ void fluid_unified_c(ComMod& com_mod, const int vmsFlag, const int eNoNw, const
12431301 }
12441302}
12451303
1246- // / @brief Unified fluid assembly function for both 2D and 3D momentum equation.
1304+ // / @brief Assemble momentum residual and tangent contributions for a Gauss integration point (unified 2D/3D).
1305+ // /
1306+ // / This unified function handles both 2D and 3D cases, implementing the momentum equations
1307+ // / from the incompressible Navier-Stokes equations with VMS stabilization, including:
1308+ // / - Inertial terms (acceleration and convection)
1309+ // / - Viscous stress terms (with non-Newtonian viscosity models)
1310+ // / - Pressure gradient terms
1311+ // / - Body force terms
1312+ // / - Darcy porous media terms
1313+ // / - VMS stabilization terms
1314+ // / - URIS interface terms
1315+ // /
1316+ // / Args:
1317+ // / com_mod - ComMod object containing simulation parameters and domain information
1318+ // / vmsFlag - Flag to indicate if VMS (Variational Multiscale) stabilization is enabled
1319+ // / eNoNw - Number of nodes in element for velocity field
1320+ // / eNoNq - Number of nodes in element for pressure field
1321+ // / w - Weight of the quadrature point (includes Jacobian)
1322+ // / Kxi - Summed gradients of parametric coordinates with respect to physical coordinates.
1323+ // / G tensor in https://www.sciencedirect.com/science/article/pii/S0045782507003027#sec4 Eq. 65. Size: (nsd,nsd)
1324+ // / Nw - Shape function values for velocity at integration point. Size: (eNoNw)
1325+ // / Nq - Shape function values for pressure at integration point. Size: (eNoNq)
1326+ // / Nwx - Gradient of shape functions for velocity. Size: (nsd,eNoNw)
1327+ // / Nqx - Gradient of shape functions for pressure. Size: (nsd,eNoNq)
1328+ // / Nwxx - Second order gradient of shape functions for velocity (for VMS). Size: (nsd*(nsd+1)/2,eNoNw)
1329+ // / al - Acceleration array for current element nodes
1330+ // / yl - Solution array (velocity, pressure, mesh velocity if ALE) for current element nodes
1331+ // / bfl - Body force array for current element nodes
1332+ // / K_inverse_darcy_permeability - Inverse of the Darcy permeability for porous media
1333+ // / DDir - Dirac Delta function for URIS (unfitted Robin-type interface surface)
1334+ // / lR - Local residual array for current element
1335+ // / lK - Local stiffness matrix for current element
1336+ // / Modifies:
1337+ // / lR(dof,eNoN) - Residual contributions for momentum equations
1338+ // / lK(dof*dof,eNoN,eNoN) - Tangent matrix contributions for momentum equations
12471339//
12481340void fluid_unified_m (ComMod& com_mod, const int vmsFlag, const int eNoNw, const int eNoNq, const double w,
12491341 const Array<double >& Kxi, const Vector<double >& Nw, const Vector<double >& Nq, const Array<double >& Nwx,
0 commit comments