getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Konstantinos Poulios
Subject: [Getfem-commits] (no subject)
Date: Fri, 3 Apr 2020 20:46:09 -0400 (EDT)

branch: master
commit 47ea7f9dd6904fe317a3955ae2c8712cf5a025f7
Author: Konstantinos Poulios <address@hidden>
AuthorDate: Sat Feb 1 11:23:55 2020 +0100

    Fix model class for internal variable condensation
---
 src/getfem_models.cc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 477a1b3..950257b 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -2625,8 +2625,11 @@ namespace getfem {
       if (version & BUILD_RHS) approx_external_load_ += brick.external_load;
     }
 
-    if (gmm::vect_size(full_rrhs)) { // i.e. if has_internal_variables()
+    if (version & BUILD_RHS && version & BUILD_WITH_INTERNAL) {
+      GMM_ASSERT1(gmm::vect_size(full_rrhs) > 0 && has_internal_variables(),
+                  "Internal error");
       gmm::sub_interval IP(0,gmm::vect_size(rrhs));
+      gmm::fill(full_rrhs, 0.);
       gmm::copy(rrhs, gmm::sub_vector(full_rrhs, IP)); // TICTIC
     }
 
@@ -2684,14 +2687,12 @@ namespace getfem {
             if (with_internal) { // Condensation reads from/writes to rhs
               gmm::copy(res0_distro.get(), res1_distro.get());
               gmm::add(gmm::scaled(full_rrhs, scalar_type(-1)),
-                       res1_distro.get()); // TIC: initial value residual=-rhs
+                       res1_distro.get()); // initial value residual=-rhs 
(actually only the internal variables residual is needed)
               workspace.set_assembled_vector(res1_distro);
               workspace.set_internal_coupling_matrix(intern_mat_distro);
             }
             workspace.set_assembled_matrix(tangent_matrix_distro);
             workspace.assembly(2, with_internal);
-            if (with_internal) // TOC: diff from initial value, hack to make 
OMP work
-              gmm::add(full_rrhs, res1_distro.get());
           ) // end GETFEM_OMP_PARALLEL
         } // end of res0_distro scope
         else { // only BUILD_MATRIX
@@ -2700,14 +2701,12 @@ namespace getfem {
             add_assignments_and_expressions_to_workspace(workspace);
             if (with_internal) { // Condensation reads from/writes to rhs
               gmm::copy(gmm::scaled(full_rrhs, scalar_type(-1)),
-                        res1_distro.get()); // TIC: initial value residual=-rhs
+                        res1_distro.get()); // initial value residual=-rhs 
(actually only the internal variables residual is needed)
               workspace.set_assembled_vector(res1_distro);
               workspace.set_internal_coupling_matrix(intern_mat_distro);
             }
             workspace.set_assembled_matrix(tangent_matrix_distro);
             workspace.assembly(2, with_internal);
-            if (with_internal) // TOC: diff from initial value, hack to make 
OMP work
-              gmm::add(full_rrhs, res1_distro.get());
           ) // end GETFEM_OMP_PARALLEL
         }
       } // end of tangent_matrix_distro, intern_mat_distro, res1_distro scope



reply via email to

[Prev in Thread] Current Thread [Next in Thread]