v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ConvectiveMassElement::OpVelocityJacobian Struct Reference

#include <users_modules/basic_finite_elements/src/ConvectiveMassElement.hpp>

Inheritance diagram for ConvectiveMassElement::OpVelocityJacobian:
[legend]
Collaboration diagram for ConvectiveMassElement::OpVelocityJacobian:
[legend]

Public Member Functions

 OpVelocityJacobian (const std::string field_name, BlockData &data, CommonData &common_data, int tag, bool jacobian=true)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
int tAg
 
bool jAcobian
 
bool fieldDisp
 
VectorBoundedArray< adouble, 3 > a_res
 
VectorBoundedArray< adouble, 3 > v
 
VectorBoundedArray< adouble, 3 > dot_w
 
VectorBoundedArray< adouble, 3 > dot_W
 
VectorBoundedArray< adouble, 3 > dot_u
 
MatrixBoundedArray< adouble, 9 > h
 
MatrixBoundedArray< adouble, 9 > H
 
MatrixBoundedArray< adouble, 9 > invH
 
MatrixBoundedArray< adouble, 9 > F
 
adouble detH
 
std::vector< doubleactive
 

Detailed Description

Definition at line 279 of file ConvectiveMassElement.hpp.

Constructor & Destructor Documentation

◆ OpVelocityJacobian()

ConvectiveMassElement::OpVelocityJacobian::OpVelocityJacobian ( const std::string  field_name,
BlockData data,
CommonData common_data,
int  tag,
bool  jacobian = true 
)

Definition at line 788 of file ConvectiveMassElement.cpp.

791 : VolumeElementForcesAndSourcesCore::UserDataOperator(
792 field_name, ForcesAndSourcesCore::UserDataOperator::OPROW),
793 dAta(data), commonData(common_data), tAg(tag), jAcobian(jacobian),
794 fieldDisp(false) {}
constexpr auto field_name

Member Function Documentation

◆ doWork()

MoFEMErrorCode ConvectiveMassElement::OpVelocityJacobian::doWork ( int  row_side,
EntityType  row_type,
EntitiesFieldData::EntData row_data 
)

Definition at line 796 of file ConvectiveMassElement.cpp.

797 {
799
800 if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
801 dAta.tEts.end()) {
803 }
804
805 // do it only once, no need to repeat this for edges,faces or tets
806 if (row_type != MBVERTEX)
808
809 int nb_dofs = row_data.getIndices().size();
810 if (nb_dofs == 0)
812
813 {
814
815 v.resize(3);
816 dot_w.resize(3);
817 h.resize(3, 3);
818 h.clear();
819 F.resize(3, 3);
820 dot_W.resize(3);
821 dot_W.clear();
822 H.resize(3, 3);
823 H.clear();
824 invH.resize(3, 3);
825 invH.clear();
826 dot_u.resize(3);
827 for (int dd = 0; dd < 3; dd++) {
828 H(dd, dd) = 1;
829 invH(dd, dd) = 1;
830 }
831
832 a_res.resize(3);
833 int nb_gauss_pts = row_data.getN().size1();
834 commonData.valVel.resize(nb_gauss_pts);
835 commonData.jacVelRowPtr.resize(nb_gauss_pts);
836 commonData.jacVel.resize(nb_gauss_pts);
837
838 int nb_active_vars = 0;
839 for (int gg = 0; gg < nb_gauss_pts; gg++) {
840
841 if (gg == 0) {
842
843 trace_on(tAg);
844
845 for (int nn1 = 0; nn1 < 3; nn1++) { // 0
846 v[nn1] <<=
848 nb_active_vars++;
849 }
850 for (int nn1 = 0; nn1 < 3; nn1++) { // 3
851 dot_w[nn1] <<=
853 [gg][nn1];
854 nb_active_vars++;
855 }
857 .size() > 0) {
858 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3 = 6
859 for (int nn2 = 0; nn2 < 3; nn2++) {
860 h(nn1, nn2) <<=
862 nn1, nn2);
863 if (fieldDisp) {
864 if (nn1 == nn2) {
865 h(nn1, nn2) += 1;
866 }
867 }
868 nb_active_vars++;
869 }
870 }
871 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9
872 dot_W[nn1] <<=
874 .dataAtGaussPts["DOT_" + commonData.meshPositions][gg][nn1];
875 nb_active_vars++;
876 }
877 }
879 for (int nn1 = 0; nn1 < 3; nn1++) { // 3+3+9+3
880 for (int nn2 = 0; nn2 < 3; nn2++) {
881 H(nn1, nn2) <<=
883 nn2);
884 nb_active_vars++;
885 }
886 }
887 }
888 detH = 1;
889
893
898 auto t_dot_u =
900 auto t_dot_w =
902 auto t_dot_W =
904 auto t_v = FTensor::Tensor1<adouble *, 3>{&v[0], &v[1], &v[2]};
905 auto t_a_res =
907
911 t_F(i, j) = t_h(i, k) * t_invH(k, j);
912 } else {
913 t_F(i, j) = t_h(i, j);
914 }
915
916 t_dot_u(i) = t_dot_w(i) + t_F(i, j) * t_dot_W(j);
917 t_a_res(i) = t_v(i) - t_dot_u(i);
918 t_a_res(i) *= detH;
919
920 // dependant
921 VectorDouble &res = commonData.valVel[gg];
922 res.resize(3);
923 for (int rr = 0; rr < 3; rr++) {
924 a_res[rr] >>= res[rr];
925 }
926 trace_off();
927 }
928
929 active.resize(nb_active_vars);
930 int aa = 0;
931 for (int nn1 = 0; nn1 < 3; nn1++) {
932 active[aa++] =
934 }
935 for (int nn1 = 0; nn1 < 3; nn1++) {
936 active[aa++] =
938 .dataAtGaussPts["DOT_" + commonData.spatialPositions][gg][nn1];
939 }
941 0) {
942 for (int nn1 = 0; nn1 < 3; nn1++) {
943 for (int nn2 = 0; nn2 < 3; nn2++) {
944 if (fieldDisp && nn1 == nn2) {
945 active[aa++] =
947 nn1, nn2) +
948 1;
949 } else {
950 active[aa++] =
952 nn1, nn2);
953 }
954 }
955 }
956 for (int nn1 = 0; nn1 < 3; nn1++) {
957 active[aa++] =
959 .dataAtGaussPts["DOT_" + commonData.meshPositions][gg][nn1];
960 }
961 }
963 for (int nn1 = 0; nn1 < 3; nn1++) {
964 for (int nn2 = 0; nn2 < 3; nn2++) {
965 active[aa++] =
967 nn2);
968 }
969 }
970 }
971
972 if (!jAcobian) {
973 VectorDouble &res = commonData.valVel[gg];
974 if (gg > 0) {
975 res.resize(3);
976 int r;
977 r = ::function(tAg, 3, nb_active_vars, &active[0], &res[0]);
978 if (r != 3) {
979 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
980 "ADOL-C function evaluation with error");
981 }
982 }
983 double val = getVolume() * getGaussPts()(3, gg);
984 res *= val;
985 } else {
986 commonData.jacVelRowPtr[gg].resize(3);
987 commonData.jacVel[gg].resize(3, nb_active_vars);
988 for (int nn1 = 0; nn1 < 3; nn1++) {
989 (commonData.jacVelRowPtr[gg])[nn1] = &(commonData.jacVel[gg](nn1, 0));
990 }
991 int r;
992 r = jacobian(tAg, 3, nb_active_vars, &active[0],
993 &(commonData.jacVelRowPtr[gg])[0]);
994 if (r != 3) {
995 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
996 "ADOL-C function evaluation with error");
997 }
998 double val = getVolume() * getGaussPts()(3, gg);
999 commonData.jacVel[gg] *= val;
1000 // std::cerr << gg << " : " << commonData.jacVel[gg] << std::endl;
1001 }
1002 }
1003 }
1005}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
Definition: Templates.hpp:1363
auto getFTensor2FromArray3by3(ublas::matrix< T, L, A > &data, const FTensor::Number< S > &, const size_t rr, const size_t cc=0)
Definition: Templates.hpp:1131
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1352
int r
Definition: sdf.py:5
std::map< std::string, std::vector< VectorDouble > > dataAtGaussPts
std::vector< std::vector< double * > > jacVelRowPtr
std::map< std::string, std::vector< MatrixDouble > > gradAtGaussPts
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of dofs on entity.

Member Data Documentation

◆ a_res

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpVelocityJacobian::a_res

Definition at line 291 of file ConvectiveMassElement.hpp.

◆ active

std::vector<double> ConvectiveMassElement::OpVelocityJacobian::active

Definition at line 295 of file ConvectiveMassElement.hpp.

◆ commonData

CommonData& ConvectiveMassElement::OpVelocityJacobian::commonData

Definition at line 284 of file ConvectiveMassElement.hpp.

◆ dAta

BlockData& ConvectiveMassElement::OpVelocityJacobian::dAta

Definition at line 283 of file ConvectiveMassElement.hpp.

◆ detH

adouble ConvectiveMassElement::OpVelocityJacobian::detH

Definition at line 293 of file ConvectiveMassElement.hpp.

◆ dot_u

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpVelocityJacobian::dot_u

Definition at line 291 of file ConvectiveMassElement.hpp.

◆ dot_w

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpVelocityJacobian::dot_w

Definition at line 291 of file ConvectiveMassElement.hpp.

◆ dot_W

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpVelocityJacobian::dot_W

Definition at line 291 of file ConvectiveMassElement.hpp.

◆ F

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpVelocityJacobian::F

Definition at line 292 of file ConvectiveMassElement.hpp.

◆ fieldDisp

bool ConvectiveMassElement::OpVelocityJacobian::fieldDisp

Definition at line 286 of file ConvectiveMassElement.hpp.

◆ h

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpVelocityJacobian::h

Definition at line 292 of file ConvectiveMassElement.hpp.

◆ H

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpVelocityJacobian::H

Definition at line 292 of file ConvectiveMassElement.hpp.

◆ invH

MatrixBoundedArray<adouble, 9> ConvectiveMassElement::OpVelocityJacobian::invH

Definition at line 292 of file ConvectiveMassElement.hpp.

◆ jAcobian

bool ConvectiveMassElement::OpVelocityJacobian::jAcobian

Definition at line 286 of file ConvectiveMassElement.hpp.

◆ tAg

int ConvectiveMassElement::OpVelocityJacobian::tAg

Definition at line 285 of file ConvectiveMassElement.hpp.

◆ v

VectorBoundedArray<adouble, 3> ConvectiveMassElement::OpVelocityJacobian::v

Definition at line 291 of file ConvectiveMassElement.hpp.


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