[Getfem-commits] [getfem-commits] branch master updated: towards release 5.4.2

2022-06-21 Thread Yves Renard
This is an automated email from the git hooks/post-receive script.

renard pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
 new 084f9aed towards release 5.4.2
084f9aed is described below

commit 084f9aed690f6d8184f62637f4b9721787228e21
Author: Yves Renard 
AuthorDate: Tue Jun 21 20:42:42 2022 +0200

towards release 5.4.2
---
 src/getfem/getfem_derivatives.h  | 2 +-
 src/getfem/getfem_mesh_slicers.h | 3 ++-
 src/getfem_interpolation.cc  | 2 +-
 src/getfem_models.cc | 4 ++--
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/getfem/getfem_derivatives.h b/src/getfem/getfem_derivatives.h
index 155b6089..c605454c 100644
--- a/src/getfem/getfem_derivatives.h
+++ b/src/getfem/getfem_derivatives.h
@@ -231,7 +231,7 @@ namespace getfem
 
 GMM_ASSERT1(!mf_vm.is_reduced(), "Sorry, to be done");
 
-scalar_type vm_min, vm_max;
+scalar_type vm_min = 0., vm_max = 0.;
 for (dal::bv_visitor i(mf_vm_dofs); !i.finished(); ++i) {
   VM[i] = 0;
   scalar_type sdiag = 0.;
diff --git a/src/getfem/getfem_mesh_slicers.h b/src/getfem/getfem_mesh_slicers.h
index 1e58fc9b..e69e7078 100644
--- a/src/getfem/getfem_mesh_slicers.h
+++ b/src/getfem/getfem_mesh_slicers.h
@@ -429,7 +429,8 @@ namespace getfem {
   scalar_type Fd = gmm::vect_sp(F,d);
   scalar_type Dd = gmm::vect_sp(D,d);
   scalar_type a = gmm::vect_norm2_sqr(D) - gmm::sqr(Dd);
-  if (a < EPS) return pt_bin.is_in(iA) ? 0. : 1./EPS; assert(a> -EPS);
+  if (a < EPS) return pt_bin.is_in(iA) ? 0. : 1./EPS;
+  assert(a> -EPS);
   scalar_type b = 2*(gmm::vect_sp(F,D) - Fd*Dd);
   scalar_type c = gmm::vect_norm2_sqr(F) - gmm::sqr(Fd) - gmm::sqr(R);
   return slicer_volume::trinom(a,b,c);
diff --git a/src/getfem_interpolation.cc b/src/getfem_interpolation.cc
index cf53ebd7..2c5206d6 100644
--- a/src/getfem_interpolation.cc
+++ b/src/getfem_interpolation.cc
@@ -44,7 +44,7 @@ namespace getfem {
 
   size_type mesh_trans_inv::point_on_convex(size_type cv, size_type i) const {
 set_iterator it = pts_cvx[cv].begin();
-for (size_type j = 0; it != pts_cvx[cv].end() && j < i; ++it, ++j);
+for (size_type j = 0; it != pts_cvx[cv].end() && j < i; ++it, ++j) {}
 GMM_ASSERT1(it != pts_cvx[cv].end(), "internal error");
 return *it;
   }
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 17241752..3ae1927d 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -522,7 +522,7 @@ namespace getfem {
   if (term.is_matrix_term) {
 if (term.is_global) {
   bool varc = false, multc = false;
-  for (const std::string var : brick.vlist) {
+  for (const std::string  : brick.vlist) {
 if (multname.compare(var) == 0) multc = true;
 if (vname.compare(var) == 0) varc = true;
   }
@@ -691,7 +691,7 @@ namespace getfem {
 << vargroup.first;
 if (vargroup.second.size()) {
   bool first(true);
-  for (const std::string vname : vargroup.second) {
+  for (const std::string  : vargroup.second) {
 ost << (first ? " " : ", ") << vname;
 first = false;
   }



[Getfem-commits] [getfem-commits] branch master updated: towards release 5.4.2

2022-06-21 Thread Yves Renard
This is an automated email from the git hooks/post-receive script.

renard pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
 new e29c6e03 towards release 5.4.2
e29c6e03 is described below

commit e29c6e03ba682dcd61237fcb0211564bd58a9fec
Author: Renard Yves 
AuthorDate: Tue Jun 21 11:46:05 2022 +0200

towards release 5.4.2
---
 bin/extract_doc  | 4 ++--
 configure.ac | 4 ++--
 doc/sphinx/source/replaces.txt   | 4 ++--
 interface/src/python/getfem_python.c | 4 ++--
 interface/src/python/setup.py.in | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/bin/extract_doc b/bin/extract_doc
index 4a0dcaa4..e0f72c68 100755
--- a/bin/extract_doc
+++ b/bin/extract_doc
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- python -*-
 #
-# Copyright (C) 2004-2020 Yves Renard, Julien Pommier.
+# Copyright (C) 2004-2022 Yves Renard, Julien Pommier.
 #   
 # This file is a part of GetFEM 
 # 
@@ -1885,7 +1885,7 @@ elif (option == 'python-com' or option == 
'python-com-par'):
 #
 # Python GetFEM interface
 #
-# Copyright (C) 2004-2020 Yves Renard, Julien Pommier.
+# Copyright (C) 2004-2022 Yves Renard, Julien Pommier.
 #
 # This file is a part of GetFEM
 #
diff --git a/configure.ac b/configure.ac
index d9ae16b0..df29c29d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,10 +27,10 @@ dnl thus, updating cache ./config.cache avoided.
 define([AC_CACHE_LOAD], )dnl
 define([AC_CACHE_SAVE], )dnl
 
-AC_INIT(getfem, 5.4.1)
+AC_INIT(getfem, 5.4.2)
 MAJOR_VERSION="5"
 MINOR_VERSION="4"
-PATCH_VERSION="1"
+PATCH_VERSION="2"
 AC_DEFINE_UNQUOTED([MAJOR_VERSION],$MAJOR_VERSION,[Major version number])
 AC_DEFINE_UNQUOTED([MINOR_VERSION],$MINOR_VERSION,[Minor version number])
 AC_DEFINE_UNQUOTED([PATCH_VERSION],$PATCH_VERSION,[Patch version number])
diff --git a/doc/sphinx/source/replaces.txt b/doc/sphinx/source/replaces.txt
index 60df7ba9..2f9f44ac 100644
--- a/doc/sphinx/source/replaces.txt
+++ b/doc/sphinx/source/replaces.txt
@@ -19,8 +19,8 @@
 .. |sLU| replace:: *SuperLU*
 .. |mumps| replace:: *MUMPS*
 .. |sphinx| replace:: *Sphinx*
-.. |version| replace:: 5.4.1
-.. |licyears| replace:: 2004-2020
+.. |version| replace:: 5.4.2
+.. |licyears| replace:: 2004-2022
 .. |gfi| replace:: *getfem-interface*
 .. |m| replace:: `mesh`
 .. |mls| replace:: `mesh_level_set`
diff --git a/interface/src/python/getfem_python.c 
b/interface/src/python/getfem_python.c
index b0020ff1..beeb0cc8 100644
--- a/interface/src/python/getfem_python.c
+++ b/interface/src/python/getfem_python.c
@@ -1,6 +1,6 @@
 /*===
 
- Copyright (C) 2004-2020 Julien Pommier.
+ Copyright (C) 2004-2022 Julien Pommier.
 
  This file is a part of GetFEM++
 
@@ -778,7 +778,7 @@ getfem_env(PyObject *self, PyObject *args) {
 word_out = PyString_FromString("GetFEM");
   } else if (strcmp(word_in,"copyright") == 0) {
 word_out = PyString_FromString
-("2004-2020 GetFEM project");
+("2004-2022 GetFEM project");
   } else if (strcmp(word_in,"authors") == 0) {
 word_out = PyString_FromString
 ("Yves Renard, Julien Pommier, Konstantinos Poulios");
diff --git a/interface/src/python/setup.py.in b/interface/src/python/setup.py.in
index f2e926a8..6a8445bf 100644
--- a/interface/src/python/setup.py.in
+++ b/interface/src/python/setup.py.in
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 # Python GetFEM interface
 #
-# Copyright (C) 2004-2020 Julien Pommier.
+# Copyright (C) 2004-2022 Julien Pommier.
 #
 # This file is a part of GetFEM
 #
@@ -68,7 +68,7 @@ getfemmod = Extension('_getfem',
 
 setup (name = 'getfem-interface',
license='LGPL',
-   version = '5.4.1',
+   version = '5.4.2',
maintainer="Yves Renard",
maintainer_email="yves.ren...@insa-lyon.fr",
description = "This is the getfem-python-interface module",



[Getfem-commits] [getfem-commits] branch master updated: towards release 5.4.2

2022-06-21 Thread Yves Renard
This is an automated email from the git hooks/post-receive script.

renard pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
 new c6524253 towards release 5.4.2
c6524253 is described below

commit c6524253f66ab862259c3440b8060488f53478f7
Author: Renard Yves 
AuthorDate: Tue Jun 21 10:24:47 2022 +0200

towards release 5.4.2
---
 doc/sphinx/source/whatsnew/5.4.2.rst | 17 +
 doc/sphinx/source/whatsnew/index.rst |  1 +
 2 files changed, 18 insertions(+)

diff --git a/doc/sphinx/source/whatsnew/5.4.2.rst 
b/doc/sphinx/source/whatsnew/5.4.2.rst
new file mode 100644
index ..8874cb11
--- /dev/null
+++ b/doc/sphinx/source/whatsnew/5.4.2.rst
@@ -0,0 +1,17 @@
+.. include:: ../replaces.txt
+
+**
+  What's New in |gf| 5.4.1
+**
+
+|gf| 5.4.2 is a patch version.
+
+Released version, 2022/07/01.
+
+The main changes are:
+
+   * Improvements in the vtu format exporting
+ 
+   * Bug and memory leak fixes
+ 
+   * New examples under contrib/continuum_mechanics and interface/tests/python
diff --git a/doc/sphinx/source/whatsnew/index.rst 
b/doc/sphinx/source/whatsnew/index.rst
index aec8c4e8..6eab72cc 100644
--- a/doc/sphinx/source/whatsnew/index.rst
+++ b/doc/sphinx/source/whatsnew/index.rst
@@ -11,6 +11,7 @@ for anyone wishing to stay up-to-date after a new release.
 .. toctree::
:maxdepth: 2
 
+   5.4.2.rst
5.4.1.rst
5.4.rst
5.3.rst



[Getfem-commits] [getfem-commits] branch upgrading_getfem_to_cpp14 deleted (was b998578a)

2022-06-21 Thread Yves Renard
renard pushed a change to branch upgrading_getfem_to_cpp14.

 was b998578a no need for a smart pointer here. Value semantics will do.

This change permanently discards the following revisions:

 discard b998578a no need for a smart pointer here. Value semantics will do.
 discard b93e8190 keyword spelling
 discard e7126d98 Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem into 
upgrading_getfem_to_cpp14
 discard cefabdb8 returning the fix that disappeared after the merge
 discard 8f8b8a22 Merge branch 'debug_assembly_breakage' of 
git.sv.gnu.org:/srv/git/getfem into upgrading_getfem_to_cpp14
 discard cead721a more concise comparison
 discard 0213e2dc Merge branch 'master' of git.sv.gnu.org:/srv/git/getfem into 
upgrading_getfem_to_cpp14
 discard 776b81d5 c++14 as a default compilation standard
 discard 3b66c0cc replacing a local shared pointer that wasn't sharing anything 
with a unique_ptr
 discard 0325c78f c-style keyword register is depreciated in the latest 
standards of C++
 discard 02f74a1c no more boost
 discard 8a7adc6b further eradication of boost
 discard 9b04251b std::toupper doesn't need locale anymore
 discard 7e1cc903 no need for special functions anymore
 discard 169948f7 no need for boost/atomic, as standard atomic is there
 discard 701030ad replacing boost::thread_specific_ptr with thread_local via a 
macro



[Getfem-commits] [getfem-commits] branch making_var_description_copyable deleted (was b8be815b)

2022-06-21 Thread Yves Renard
renard pushed a change to branch making_var_description_copyable.

 was b8be815b changing constness to allow var_description copying

This change permanently discards the following revisions:

 discard b8be815b changing constness to allow var_description copying



[Getfem-commits] [getfem-commits] master updated (1a8c1c22 -> ed420f9d)

2022-06-21 Thread Yves Renard
renard pushed a change to branch master.

from 1a8c1c22 Simple FSI example, still in progress
 add 8a980211 Add VTU(XML) binary option and slices
 add 250861de Merge remote-tracking branch 'origin' into fixmisspell
 add bf38e028 Update urls of translation project and documents
 add ed420f9d Merge remote-tracking branch 'origin/master' into fixmisspell

No new revisions were added by this update.

Summary of changes:
 doc/sphinx/.tx/config  | 572 -
 doc/sphinx/source/project/contribute.rst   |   6 +-
 doc/sphinx/source/tutorial/intro.rst   |   2 +-
 doc/sphinx/source/tutorial/thermo_coupling.rst |   2 +-
 doc/sphinx/source/userdoc/export.rst   |   3 +-
 5 files changed, 292 insertions(+), 293 deletions(-)



[Getfem-commits] [getfem-commits] fixmisspell updated (bf38e028 -> ed420f9d)

2022-06-21 Thread Yves Renard
renard pushed a change to branch fixmisspell.

from bf38e028 Update urls of translation project and documents
 add 3ae01b87 fix a memory leak
 add 8324be3a Remove invalid assertion
 add 91fb8d39 Fix GWFL inconsistency in slicing of tensors with single 
element leading dimensions
 add 1acbf2a3 Code simplifications
 add fb978924 Fix issue with internal variables and reduced fem
 add 4ff15ca9 Add finite strain plasticity examples with linear isotropic 
hardening
 add 7f934b53 Merge branch 'master' of ssh://git.sv.gnu.org:/srv/git/getfem
 add f60023bf Fix redundant integration points in projected_fem
 add 6af44d98 Fix empty response error in exported vtu files
 add 36bcd583 Fix memory leak due to lack of base class virtual destructor
 add dfb5b391 Print model variables categorized as variables, disabled 
variables and data
 add 56d8db12 A attempt for making diff working with interpolate 
transformations
 add 2f17bad1 Making work the directional derivative with interpolate 
transformation in a very special case
 add 4e663f58 Convert the planetary gear example to GWFL
 add 0604f61a minor change
 add 44045b41 minor change
 add 8eab6bfb use region in ref_elt_dim_of_mesh
 add 05989af4 Add projected_fem::projected_target_region() function
 add 9ac4e7f2 Add truss problem example
 add 0241496a Rename brick addition functions and new interface function 
for lumped mass brick
 add 11c409fa Change in the web site upload
 add 066eb842 Just code style changes
 add afd2d94d MPI fixes form model residual assembly
 add c41f5b87 MPI fixes for affine and linear terms in nonlinear model 
residual
 add bc309aa0 Fix the compile error of nbp in ubuntu20.04
 add 2b5bbe33 Add quasi-linear viscoelasticity example (finite strain)
 add 39dc301e Deleting the obsolete class
 add 0e4a5740 More informative error messages
 add 31df9dba Fixing mistake introduced in SHA: 
93ea20ccf0e03d841f600d928764a694a0047ab8
 add 7b9740ef Minor changes
 add a105a274 Fix m4/ac_python_devel.m4 for Python3.10
 add 5bff25b6 adding major and minor version numbers to arch_config
 add 57e5e2d4 Bug fix for fixed size test functions in constant matrices
 add 71eeed57 Minor changes
 add 4bb1fd6e Avoid passing unused references
 add 5f88efb4 Support element_K and element_B interpolates in GWFL
 add f6e4bf85 minor modification
 add 97aac8bf minor fix on matrix_j2 operator
 add baefd5d3 correction of tangent term of matrix_j2
 add 1a8c1c22 Simple FSI example, still in progress
 new ed420f9d Merge remote-tracking branch 'origin/master' into fixmisspell


Summary of changes:
 .gitignore |   3 +
 bin/upload_html|   7 -
 configure.ac   |   4 +
 contrib/Makefile.am|   3 +-
 .../Makefile.am|   7 +-
 contrib/continuum_mechanics/QLV_viscoelasticity.py | 196 +++
 ...ty_finite_strain_linear_hardening_tension_3D.py | 249 +
 ...strain_linear_hardening_tension_axisymmetric.py | 238 +
 ...strain_linear_hardening_tension_plane_strain.py | 236 +
 .../static_contact_planetary.py| 571 +
 doc/sphinx/Makefile.am |   5 +-
 doc/sphinx/source/userdoc/gasm_high.rst|   2 +
 .../source/userdoc/model_linear_elasticity.rst |   4 +-
 interface/src/gf_model_get.cc  |  17 +-
 interface/src/gf_model_set.cc  |  35 +-
 interface/src/matlab/gfm_common.c  |   4 +-
 interface/tests/matlab-octave/demo_elasticity.m|   4 +-
 interface/tests/python/Makefile.am |   2 +
 interface/tests/python/check_export_vtu.py | 120 -
 .../python/demo_fluide_structure_interaction.py| 210 
 .../tests/python/demo_nonlinear_elasticity.py  |  15 +-
 interface/tests/python/demo_truss.py   | 108 
 interface/tests/python/demo_wave_equation.py   |  11 +
 m4/ac_python_devel.m4  |   2 +-
 src/bgeot_geotrans_inv.cc  |  34 +-
 src/getfem/getfem_export.h |   4 +-
 src/getfem/getfem_generic_assembly.h   |   8 +-
 src/getfem/getfem_generic_assembly_semantic.h  |   6 +-
 src/getfem/getfem_generic_assembly_tree.h  |   2 +
 src/getfem/getfem_global_function.h|   2 +-
 src/getfem/getfem_im_list.h|   2 +-
 src/getfem/getfem_models.h |  15 +-
 src/getfem/getfem_projected_fem.h  |   4 +
 src/getfem_export.cc   | 109 ++--
 src/getfem_generic_assembly_compile_and_exec.cc| 101 ++--
 src/getfem_generic_assembly_semantic.cc| 182 +--
 

[Getfem-commits] (no subject)

2022-06-21 Thread Yves Renard
branch: fixmisspell
commit ed420f9d75595c8ec67665f7854f079ffd6d5924
Merge: bf38e028 1a8c1c22
Author: Renard Yves 
AuthorDate: Tue Jun 21 09:02:43 2022 +0200

Merge remote-tracking branch 'origin/master' into fixmisspell

 .gitignore |   3 +
 bin/upload_html|   7 -
 configure.ac   |   4 +
 contrib/Makefile.am|   3 +-
 contrib/{ => continuum_mechanics}/Makefile.am  |  20 +-
 contrib/continuum_mechanics/QLV_viscoelasticity.py | 196 +++
 ...ty_finite_strain_linear_hardening_tension_3D.py | 249 +
 ...strain_linear_hardening_tension_axisymmetric.py | 238 +
 ...strain_linear_hardening_tension_plane_strain.py | 236 +
 .../static_contact_planetary.py| 571 +
 doc/sphinx/Makefile.am |   5 +-
 doc/sphinx/source/userdoc/gasm_high.rst|   2 +
 .../source/userdoc/model_linear_elasticity.rst |   4 +-
 interface/src/gf_model_get.cc  |  17 +-
 interface/src/gf_model_set.cc  |  35 +-
 interface/src/matlab/gfm_common.c  |   4 +-
 interface/tests/matlab-octave/demo_elasticity.m|   4 +-
 interface/tests/python/Makefile.am |   2 +
 interface/tests/python/check_export_vtu.py | 120 -
 .../python/demo_fluide_structure_interaction.py| 210 
 .../tests/python/demo_nonlinear_elasticity.py  |  15 +-
 interface/tests/python/demo_truss.py   | 108 
 interface/tests/python/demo_wave_equation.py   |  11 +
 m4/ac_python_devel.m4  |   2 +-
 src/bgeot_geotrans_inv.cc  |  34 +-
 src/getfem/getfem_export.h |   4 +-
 src/getfem/getfem_generic_assembly.h   |   8 +-
 src/getfem/getfem_generic_assembly_semantic.h  |   6 +-
 src/getfem/getfem_generic_assembly_tree.h  |   2 +
 src/getfem/getfem_global_function.h|   2 +-
 src/getfem/getfem_im_list.h|   2 +-
 src/getfem/getfem_models.h |  15 +-
 src/getfem/getfem_projected_fem.h  |   4 +
 src/getfem_export.cc   | 109 ++--
 src/getfem_generic_assembly_compile_and_exec.cc| 101 ++--
 src/getfem_generic_assembly_semantic.cc| 182 +--
 src/getfem_generic_assembly_tree.cc|  17 +-
 src/getfem_generic_assembly_workspace.cc   |  42 +-
 src/getfem_model_solvers.cc|   4 +-
 src/getfem_models.cc   | 287 ++-
 src/getfem_nonlinear_elasticity.cc |  37 +-
 src/getfem_projected_fem.cc|  25 +-
 42 files changed, 2203 insertions(+), 744 deletions(-)



[Getfem-commits] [getfem-commits] branch master updated: Simple FSI example, still in progress

2022-06-21 Thread Yves Renard
This is an automated email from the git hooks/post-receive script.

renard pushed a commit to branch master
in repository getfem.

The following commit(s) were added to refs/heads/master by this push:
 new 1a8c1c22 Simple FSI example, still in progress
1a8c1c22 is described below

commit 1a8c1c222c1c9cbbefa5844db34426695b809fa5
Author: Renard Yves 
AuthorDate: Tue Jun 21 09:00:49 2022 +0200

Simple FSI example, still in progress
---
 .../python/demo_fluide_structure_interaction.py| 210 +
 1 file changed, 210 insertions(+)

diff --git a/interface/tests/python/demo_fluide_structure_interaction.py 
b/interface/tests/python/demo_fluide_structure_interaction.py
new file mode 100644
index ..0beef9cf
--- /dev/null
+++ b/interface/tests/python/demo_fluide_structure_interaction.py
@@ -0,0 +1,210 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Python GetFEM interface
+#
+# Copyright (C) 2015 Konstantinos Poulios.
+#
+# This file is a part of GetFEM
+#
+# GetFEM  is  free software;  you  can  redistribute  it  and/or modify it
+# under  the  terms  of the  GNU  Lesser General Public License as published
+# by  the  Free Software Foundation;  either version 3 of the License,  or
+# (at your option) any later version along with the GCC Runtime Library
+# Exception either version 3.1 or (at your option) any later version.
+# This program  is  distributed  in  the  hope  that it will be useful,  but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or  FITNESS  FOR  A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License and GCC Runtime Library Exception for more details.
+# You  should  have received a copy of the GNU Lesser General Public License
+# along  with  this program;  if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+
+
+""" Incompressible Navier-Stokes fluid in interaction with a ball in a cavity.
+  Middle point scheme for the fluid, Verlet scheme for the ball (not the
+  best but can of course be changed)
+
+  This program is used to check that python-getfem is working. This is also
+  a good example of use of GetFEM.
+"""
+
+import os
+import numpy as np
+import getfem as gf
+gf.util('trace level', 0)
+
+# TODO
+# 4 - Faire le schéma en temps pour la balle
+# 5 - Nitsche pour le Dirichlet fluide sur le pourtour de la balle
+# (pénalisation de l'intrieur, un peu)
+# 6 - possiblité de couplage total avec schéma implicite ?
+# 7 - Dessin ? couper éventuellement (ou pas). Vorticité ?
+
+# Phisical parameters (à ajuster pour être physique ...)
+nu = 0.002# cinematic viscosity
+rho = 1.  # Fluid density  
+mu = rho * nu # dynamic viscosity
+g = 9.81  # gravity
+in_velocity = 1.  # in velocity at the center bottom
+ball_radius = 0.1
+ball_mass = 0.035 
+ball_init_pos = [0, 0.2]
+
+# Time discretization parameters
+dt = 0.01
+T = 5.
+
+# Geometry and Mesh of the cavity
+W1 = 0.1  #   
+W2 = 0.45 #   H2 |_  _|
+W = W1+2.*W2  #  ||
+H1 = 0.95 #  ||
+H2 = 0.05 #   H1 ||
+H = H2+H1 #  ||
+  #  ||__||
+  #W2  W1  W2
+NH = 40
+NW = 40
+DH = H / NH; DW = W / NW;
+print("Number of elements: ", W1/DW, W2/DW, H1/DH, H2/DH)
+if (abs(W1 / DW - round(W1/DW)) +  abs(W2 / DW - round(W2/DW))
++ abs(H1 / DH - round(H1/DH)) + abs(H2 / DH != round(H2/DH)) > 1E-8) :
+   print("Discretization error"); exit(1)
+   
+out_velocity = W1*in_velocity / (2.*H2); 
+Reynold = rho*in_velocity*H/mu
+print("Reynold = ", Reynold)
+
+geotrans = "GT_QK(2,2)"
+m = gf.Mesh("import", "structured",
+"GT='%s';ORG=[%f,%f];SIZES=[%f,%f];NSUBDIV=[%i,%i]"
+% (geotrans, -W/2., 0., W, H, NW, NH))
+
+# Mesh regions (can be imported from a gmsh file for instance)
+IN_RG = 1
+OUT_RG1 = 2
+OUT_RG2 = 3
+WALL_RG = 4
+in_rg   = m.outer_faces_in_box([-W1/2.-1e-8,-1e-8],[W1/2+1e-8,1e-8])
+out_rg1 = m.outer_faces_in_box([-W/2.-1e-8,H1-1e-8],[-W/2+1e-8,H+1e-8])
+out_rg2 = m.outer_faces_in_box([W/2.-1e-8,H1-1e-8],[W/2+1e-8,H+1e-8])
+wall_rg = m.outer_faces()
+m.set_region(IN_RG, in_rg)
+m.set_region(OUT_RG1, out_rg1)
+m.set_region(OUT_RG2, out_rg2)
+m.set_region(WALL_RG, wall_rg)
+m.region_subtract(WALL_RG, IN_RG)
+m.region_subtract(WALL_RG, OUT_RG1)
+m.region_subtract(WALL_RG, OUT_RG2)
+
+# Finite element spaces and integration methods
+mfv_ = gf.MeshFem(m, 2)
+mfv_.set_classical_fem(2)
+
+#Il faudra éliminer les ddl sous la balle pour v et p
+#kept_dofs = np.setdiff1d(np.arange(mfv_.nb_basic_dof()),
+# mfv_.basic_dof_on_region(WALL_RG))
+#mfv = gf.MeshFem("partial", mfv_, kept_dofs)
+
+mfp_ = gf.MeshFem(m, 1)
+mfp_.set_classical_fem(1)
+# kept_dofs =