@@ -663,37 +663,39 @@ void FESolidSolver2::UpdateIncrements(vector<double>& Ui, vector<double>& ui, bo
663663 m_rigidSolver.UpdateIncrements (Ui, ui, emap);
664664
665665 // update flexible nodes
666- int n;
667- for (int i=0 ; i<mesh.Nodes (); ++i)
666+ int NN = mesh.Nodes ();
667+ #pragma omp parallel for
668+ for (int i=0 ; i<NN ; ++i)
668669 {
669670 FENode& node = mesh.Node (i);
671+ const std::vector<int >& id = node.m_ID ;
672+ int n;
670673
671674 // displacement dofs
672675 // current position = initial + total at prev conv step + total increment so far + current increment
673- if ((n = node. m_ID [m_dofU[0 ]]) >= 0 ) Ui[n] += ui[n];
674- if ((n = node. m_ID [m_dofU[1 ]]) >= 0 ) Ui[n] += ui[n];
675- if ((n = node. m_ID [m_dofU[2 ]]) >= 0 ) Ui[n] += ui[n];
676+ if ((n = id [m_dofU[0 ]]) >= 0 ) Ui[n] += ui[n];
677+ if ((n = id [m_dofU[1 ]]) >= 0 ) Ui[n] += ui[n];
678+ if ((n = id [m_dofU[2 ]]) >= 0 ) Ui[n] += ui[n];
676679
677680 // beam rotations
681+ if ((id[m_dofQ[0 ]] >= 0 ) || (id[m_dofQ[1 ]] >= 0 ) || (id[m_dofQ[2 ]] >= 0 ))
678682 {
679683 vec3d ri, Ri;
680- if ((n = node. m_ID [m_dofQ[0 ]]) >= 0 ) { ri.x = ui[n]; Ri.x = Ui[n]; }
681- if ((n = node. m_ID [m_dofQ[1 ]]) >= 0 ) { ri.y = ui[n]; Ri.y = Ui[n]; }
682- if ((n = node. m_ID [m_dofQ[2 ]]) >= 0 ) { ri.z = ui[n]; Ri.z = Ui[n]; }
684+ if ((n = id [m_dofQ[0 ]]) >= 0 ) { ri.x = ui[n]; Ri.x = Ui[n]; }
685+ if ((n = id [m_dofQ[1 ]]) >= 0 ) { ri.y = ui[n]; Ri.y = Ui[n]; }
686+ if ((n = id [m_dofQ[2 ]]) >= 0 ) { ri.z = ui[n]; Ri.z = Ui[n]; }
683687 quatd qi (ri), Qi (Ri);
684688 quatd Qn = qi * Qi;
685689 vec3d rn = Qn.GetRotationVector ();
686- if ((n = node. m_ID [m_dofQ[0 ]]) >= 0 ) { Ui[n] = rn.x ; }
687- if ((n = node. m_ID [m_dofQ[1 ]]) >= 0 ) { Ui[n] = rn.y ; }
688- if ((n = node. m_ID [m_dofQ[2 ]]) >= 0 ) { Ui[n] = rn.z ; }
690+ if ((n = id [m_dofQ[0 ]]) >= 0 ) { Ui[n] = rn.x ; }
691+ if ((n = id [m_dofQ[1 ]]) >= 0 ) { Ui[n] = rn.y ; }
692+ if ((n = id [m_dofQ[2 ]]) >= 0 ) { Ui[n] = rn.z ; }
689693 }
690694
691695 // shell dofs
692- {
693- if ((n = node.m_ID [m_dofSU[0 ]]) >= 0 ) Ui[n] += ui[n];
694- if ((n = node.m_ID [m_dofSU[1 ]]) >= 0 ) Ui[n] += ui[n];
695- if ((n = node.m_ID [m_dofSU[2 ]]) >= 0 ) Ui[n] += ui[n];
696- }
696+ if ((n = id[m_dofSU[0 ]]) >= 0 ) Ui[n] += ui[n];
697+ if ((n = id[m_dofSU[1 ]]) >= 0 ) Ui[n] += ui[n];
698+ if ((n = id[m_dofSU[2 ]]) >= 0 ) Ui[n] += ui[n];
697699 }
698700
699701 for (int i = 0 ; i < fem.NonlinearConstraints (); ++i)
@@ -727,23 +729,26 @@ void FESolidSolver2::UpdateIncrements(vector<double>& Ui, vector<double>& ui, bo
727729// ! Updates the current state of the model
728730void FESolidSolver2::Update (vector<double >& ui)
729731{
730- FEModel& fem = *GetFEModel ();
731- FETimeInfo& tp = fem.GetTime ();
732- tp.currentIteration = m_niter;
733-
734- // update EAS
735- UpdateEAS (ui);
736- UpdateIncrementsEAS (ui, true );
732+ {
733+ TRACK_TIME (Timer_Update)
734+ FEModel& fem = *GetFEModel ();
735+ FETimeInfo& tp = fem.GetTime ();
736+ tp.currentIteration = m_niter;
737737
738- // update kinematics
739- UpdateKinematics (ui);
738+ // update EAS
739+ UpdateEAS (ui);
740+ UpdateIncrementsEAS (ui, true );
740741
741- // update domains
742- FEMesh& mesh = fem.GetMesh ();
743- for (int i = 0 ; i < mesh.Domains (); ++i)
744- {
745- FEDomain& dom = mesh.Domain (i);
746- dom.IncrementalUpdate (ui, false );
742+ // update kinematics
743+ UpdateKinematics (ui);
744+
745+ // update domains
746+ FEMesh& mesh = fem.GetMesh ();
747+ for (int i = 0 ; i < mesh.Domains (); ++i)
748+ {
749+ FEDomain& dom = mesh.Domain (i);
750+ dom.IncrementalUpdate (ui, false );
751+ }
747752 }
748753
749754 // update model state
@@ -864,7 +869,9 @@ void FESolidSolver2::PrepStep()
864869
865870 // store previous mesh state
866871 // we need them for velocity and acceleration calculations
867- for (int i = 0 ; i < mesh.Nodes (); ++i)
872+ int NN = mesh.Nodes ();
873+ #pragma omp parallel for
874+ for (int i = 0 ; i < NN ; ++i)
868875 {
869876 FENode& ni = mesh.Node (i);
870877 ni.m_rp = ni.m_rt ;
@@ -1616,25 +1623,27 @@ void FESolidSolver2::ExternalForces(FEGlobalVector& RHS)
16161623
16171624 // set the nodal reaction forces
16181625 // TODO: Is this a good place to do this?
1619- for (int i = 0 ; i<mesh.Nodes (); ++i)
1626+ int NN = mesh.Nodes ();
1627+ #pragma omp parallel for
1628+ for (int i = 0 ; i<NN ; ++i)
16201629 {
16211630 FENode& node = mesh.Node (i);
1622- node.set_load (m_dofU[0 ], 0 );
1623- node.set_load (m_dofU[1 ], 0 );
1624- node.set_load (m_dofU[2 ], 0 );
16251631
16261632 int n;
16271633 if ((n = node.m_ID [m_dofU[0 ]]) >= 0 ) node.set_load (m_dofU[0 ], -m_Fr[n]);
1628- if ((n = -node.m_ID [m_dofU[0 ]] - 2 ) >= 0 ) node.set_load (m_dofU[0 ], -m_Fr[n]);
1634+ else if ((n = -node.m_ID [m_dofU[0 ]] - 2 ) >= 0 ) node.set_load (m_dofU[0 ], -m_Fr[n]);
1635+ else node.set_load (m_dofU[0 ], 0 );
16291636
16301637 if ((n = node.m_ID [m_dofU[1 ]]) >= 0 ) node.set_load (m_dofU[1 ], -m_Fr[n]);
1631- if ((n = -node.m_ID [m_dofU[1 ]] - 2 ) >= 0 ) node.set_load (m_dofU[1 ], -m_Fr[n]);
1638+ else if ((n = -node.m_ID [m_dofU[1 ]] - 2 ) >= 0 ) node.set_load (m_dofU[1 ], -m_Fr[n]);
1639+ else node.set_load (m_dofU[1 ], 0 );
16321640
16331641 if ((n = node.m_ID [m_dofU[2 ]]) >= 0 ) node.set_load (m_dofU[2 ], -m_Fr[n]);
1634- if ((n = -node.m_ID [m_dofU[2 ]] - 2 ) >= 0 ) node.set_load (m_dofU[2 ], -m_Fr[n]);
1642+ else if ((n = -node.m_ID [m_dofU[2 ]] - 2 ) >= 0 ) node.set_load (m_dofU[2 ], -m_Fr[n]);
1643+ else node.set_load (m_dofU[2 ], 0 );
16351644
16361645 // add nodal loads
1637- double s = (m_arcLength>0 ? m_al_lam : 1.0 );
1646+ // double s = (m_arcLength>0 ? m_al_lam : 1.0);
16381647// if ((n = node.m_ID[m_dofU[0]]) >= 0) node.set_load(m_dofU[0], -m_Fn[n]*s);
16391648// if ((n = node.m_ID[m_dofU[1]]) >= 0) node.set_load(m_dofU[1], -m_Fn[n]*s);
16401649// if ((n = node.m_ID[m_dofU[2]]) >= 0) node.set_load(m_dofU[2], -m_Fn[n]*s);
0 commit comments