[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] (no subject)
From: |
Yves Renard |
Subject: |
[Getfem-commits] (no subject) |
Date: |
Tue, 5 Jun 2018 11:28:33 -0400 (EDT) |
branch: master
commit 7cc126f4dcd18876392df3658d98348d63076031
Author: Yves Renard <address@hidden>
Date: Tue Jun 5 17:27:47 2018 +0200
name simplification: add_linear_assembly_brick -> add_linear_term and the
same for similar operations.
---
.../test_plasticity/test_small_strain_plasticity.m | 10 +--
.../test_small_strain_plasticity.py | 10 +--
doc/sphinx/source/tutorial/thermo_coupling.rst | 29 ++++-----
doc/sphinx/source/tutorial/wheel.rst | 8 +--
.../source/userdoc/model_generic_assembly.rst | 13 ++--
interface/src/gf_model_set.cc | 74 +++++++++++++++++++---
interface/tests/matlab/check_plasticity.m | 4 +-
.../tests/matlab/demo_Mindlin_Reissner_plate.m | 10 +--
.../tests/matlab/demo_Nitsche_contact_by_hand.m | 20 +++---
interface/tests/matlab/demo_continuation.m | 3 +-
interface/tests/matlab/demo_crack.m | 4 +-
interface/tests/matlab/demo_dynamic_contact.m | 4 +-
interface/tests/matlab/demo_dynamic_plasticity.m | 2 +-
.../matlab/demo_dynamic_plasticity_with_contact.m | 2 +-
interface/tests/matlab/demo_elasticity.m | 2 +-
interface/tests/matlab/demo_laplacian.m | 2 +-
interface/tests/matlab/demo_laplacian_DG.m | 10 +--
interface/tests/matlab/demo_laplacian_pyramid.m | 2 +-
.../tests/matlab/demo_large_sliding_contact.m | 20 +++---
interface/tests/matlab/demo_nonlinear_elasticity.m | 20 +++---
interface/tests/matlab/demo_periodic_laplacian.m | 4 +-
interface/tests/matlab/demo_plasticity.m | 2 +-
.../demo_thermo_elasticity_electrical_coupling.m | 6 +-
.../tests/matlab/test1_nitsche_large_sliding.m | 8 +--
.../tests/matlab/test2_nitsche_large_sliding.m | 30 ++++-----
interface/tests/matlab/tutorial1.m | 4 +-
interface/tests/python/demo_crack.py | 4 +-
interface/tests/python/demo_laplacian_DG.py | 2 +-
.../tests/python/demo_large_sliding_contact.py | 20 +++---
interface/tests/python/demo_navier_stokes.py | 4 +-
.../tests/python/demo_nonlinear_elasticity.py | 12 ++--
.../demo_thermo_elasticity_electrical_coupling.py | 6 +-
interface/tests/python/demo_wheel_contact.py | 6 +-
src/getfem/getfem_models.h | 32 +++++++++-
src/getfem_models.cc | 52 +++++++--------
tests/laplacian_with_bricks.cc | 3 +-
tests/test_continuation.cc | 3 +-
tests/thermo_elasticity_electrical_coupling.cc | 6 +-
38 files changed, 265 insertions(+), 188 deletions(-)
diff --git a/contrib/test_plasticity/test_small_strain_plasticity.m
b/contrib/test_plasticity/test_small_strain_plasticity.m
index 1316e21..1f7ea29 100644
--- a/contrib/test_plasticity/test_small_strain_plasticity.m
+++ b/contrib/test_plasticity/test_small_strain_plasticity.m
@@ -190,7 +190,7 @@ switch (option)
% fbound = strcat('(Norm(',Eptheta,'-Epn)-theta*xi*sigma_y)');
expr = strcat(sigma_np1,
':Grad_Test_u+(1/r)*(xi-pos_part(xi+r*',fbound,'))*Test_xi');
% expr = strcat(sigma_np1, ':Grad_Test_u + (',fbound,' +
pos_part(-xi/r-',fbound,'))*Test_xi');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim, expr);
+ gf_model_set(md, 'add nonlinear term', mim, expr);
end
case 3
if (use_small_strain_pl_brick)
@@ -237,7 +237,7 @@ switch (option)
fbound = strcat('(Norm(2*mu*Deviator(',Etheta,')-(2*mu+Hk)*',Eptheta,')
- sqrt(2/3)*(sigma_y + Hi*',alpha_theta,'))');
expr = strcat(sigma_np1, ':Grad_Test_u + (1/r)*(xi -
pos_part(xi+r*',fbound,'))*Test_xi');
% expr = strcat(sigma_np1, ':Grad_Test_u + (',fbound,' +
pos_part(-xi/r-',fbound,'))*Test_xi');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim, expr);
+ gf_model_set(md, 'add nonlinear term', mim, expr);
end
case 4
if (use_small_strain_pl_brick)
@@ -267,7 +267,7 @@ switch (option)
sigma_theta = strcat('(lambda*Trace(',Etheta,'-',Eptheta, ')*Id(meshdim)
+ 2*mu*(',Etheta,'-', Eptheta,'))');
expr = strcat(sigma_np1, ':Grad_Test_u');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim, expr);
+ gf_model_set(md, 'add nonlinear term', mim, expr);
end
case 5
set(md, 'add fem variable', 'xi', mf_xi);
@@ -298,7 +298,7 @@ switch (option)
% fbound =
strcat('(Norm(2*mu*Deviator(',Etheta,')-(2*mu+c2+delta)*',Eptheta,'-c1*Normalized_reg(',Eptheta,',1E-6))
- sqrt(2/3)*sigma_y)');
fbound_delta = strcat('(Norm(',Eptheta,')-c3)');
expr = strcat(sigma_np1, ':Grad_Test_u + (10/r1)*(xi -
pos_part(xi+r1*',fbound,'))*Test_xi - (100/r2)*(delta -
pos_part(delta+r2*',fbound_delta,'))*Test_delta');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim, expr);
+ gf_model_set(md, 'add nonlinear term', mim, expr);
else
@@ -317,7 +317,7 @@ switch (option)
% fbound =
strcat('(Norm(2*mu*Deviator(',Etheta,')-(2*mu+c2)*',Eptheta,') -
sqrt(2/3)*sigma_y)');
expr = strcat(sigma_np1, ':Grad_Test_u + (1/r1)*(xi -
pos_part(xi+r1*',fbound,'))*Test_xi');
% expr = strcat(sigma_np1, ':Grad_Test_u + (',fbound,' +
pos_part(-xi/r1-',fbound,'))*Test_xi');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim, expr);
+ gf_model_set(md, 'add nonlinear term', mim, expr);
end
diff --git a/contrib/test_plasticity/test_small_strain_plasticity.py
b/contrib/test_plasticity/test_small_strain_plasticity.py
index 8ed7af1..b39e415 100644
--- a/contrib/test_plasticity/test_small_strain_plasticity.py
+++ b/contrib/test_plasticity/test_small_strain_plasticity.py
@@ -276,7 +276,7 @@ if (option == 2):
expr =
sigma_np1+':Grad_Test_u+(1/r)*(xi-pos_part(xi+r*'+fbound+'))*Test_xi'
# expr = sigma_np1+':Grad_Test_u+('+fbound+'+pos_part(-xi/r-'+fbound+
# '))*Test_xi'
- md.add_nonlinear_generic_assembly_brick(mim, expr)
+ md.add_nonlinear_term(mim, expr)
if (option == 3):
if (use_small_strain_pl_brick):
@@ -339,7 +339,7 @@ if (option == 3):
+'))*Test_xi')
# expr = (sigma_np1+':Grad_Test_u + ('+fbound+' + pos_part(-xi/r-'+fbound
# +'))*Test_xi')
- md.add_nonlinear_generic_assembly_brick(mim, expr)
+ md.add_nonlinear_term(mim, expr)
if (option == 4):
if (use_small_strain_pl_brick):
@@ -378,7 +378,7 @@ if (option == 4):
+')*Id(meshdim) + 2*mu*('+Etheta+'-'+Eptheta+'))')
expr = sigma_np1+':Grad_Test_u'
- md.add_nonlinear_generic_assembly_brick(mim, expr)
+ md.add_nonlinear_term(mim, expr)
if (option == 5):
md.add_fem_variable('xi', mf_xi)
@@ -416,7 +416,7 @@ if (option == 5):
expr = (sigma_np1+':Grad_Test_u + (1/r1)*(xi - pos_part(xi+r1*'+fbound
+'))*Test_xi-(1/r2)*(delta-pos_part(delta+r2*'+fbound_delta
+'))*Test_delta')
- md.add_nonlinear_generic_assembly_brick(mim, expr)
+ md.add_nonlinear_term(mim, expr)
if (False):
Etheta = '(Sym(theta*Grad_u+(1-theta)*Grad_Previous_u))'
@@ -452,7 +452,7 @@ if (option == 5):
+'))*Test_xi')
# expr = (sigma_np1+':Grad_Test_u + ('+fbound+' + pos_part(-xi/r-'
# +fbound+'))*Test_xi')
- md.add_nonlinear_generic_assembly_brick(mim, expr)
+ md.add_nonlinear_term(mim, expr)
diff --git a/doc/sphinx/source/tutorial/thermo_coupling.rst
b/doc/sphinx/source/tutorial/thermo_coupling.rst
index 353edeb..76f14cf 100644
--- a/doc/sphinx/source/tutorial/thermo_coupling.rst
+++ b/doc/sphinx/source/tutorial/thermo_coupling.rst
@@ -511,7 +511,7 @@ Let us now begin by the elastic deformation problem. We
will use the predefined
\int_{\Omega} (\lambda^* \mbox{div}(u) I + 2\mu
\bar{\varepsilon}(u)):\bar{\varepsilon}(\delta_u)dx,
-to the tangent linear system. In order to use this model brick, the data
corresponding to he |Lame| coefficient have to be added to the model first.
Here, the |Lame| coefficients are constant over the domain. However, it it also
possible to define some non-constant data. Note also that instead of using this
predefined brick, one can use equivalently the generic assembly brick
`add_linear_generic_assembly_brick(md mim, "lambda*(Div_u*Div_Test_u) +
mu*((Grad_u + Grad_u'):Grad_Test_u)"`.
+to the tangent linear system. In order to use this model brick, the data
corresponding to he |Lame| coefficient have to be added to the model first.
Here, the |Lame| coefficients are constant over the domain. However, it it also
possible to define some non-constant data. Note also that instead of using this
predefined brick, one can use equivalently the generic assembly brick
`add_linear_term(md mim, "lambda*(Div_u*Div_Test_u) + mu*((Grad_u +
Grad_u'):Grad_Test_u)"`.
Concerning the coupling term
@@ -519,7 +519,7 @@ Concerning the coupling term
\int_{\Omega} (\beta\theta I) :\bar{\varepsilon}(\delta_u)dx,
-there is no predefined brick and we use directly a generic assembly brick
`add_linear_generic_assembly_brick(md mim, "beta*theta*Div_Test_u)"`. See
:ref:`ud-gasm-high` for more details on the high-level generic assembly
language. Basically, the principle is that the assembly string is compiled into
a list of optimized assembly instructions which are executed on each Gauss
point.
+there is no predefined brick and we use directly a generic assembly brick
`add_linear_term(md mim, "beta*theta*Div_Test_u)"`. See :ref:`ud-gasm-high` for
more details on the high-level generic assembly language. Basically, the
principle is that the assembly string is compiled into a list of optimized
assembly instructions which are executed on each Gauss point.
The following program allows to take into account the whole elastic
deformation equation. Note the use of specific brick to prescribe the Dirichlet
condition on the left boundary. There is several option to prescribe a
Dirichlet condition (see :ref:`ud-model-Dirichlet`).
@@ -538,8 +538,7 @@ The following program allows to take into account the whole
elastic deformation
getfem::add_source_term_brick(md, mim, "u", "Fdata",
RIGHT_BOUND);
md.add_initialized_scalar_data("beta", alpha_th*E/(1-2*nu));
- getfem::add_linear_generic_assembly_brick
- (md, mim, "beta*(T0-theta)*Div_Test_u");
+ getfem::add_linear_term(md, mim, "beta*(T0-theta)*Div_Test_u");
----------
----------------------------------------------------------------------------------------------------------------
**Python** .. code-block:: python
@@ -553,7 +552,7 @@ The following program allows to take into account the whole
elastic deformation
md.add_source_term_brick(mim, 'u', 'Fdata', RIGHT_BOUND)
md.add_initialized_data('beta', [alpha_th*E/(1-2*nu)])
- md.add_linear_generic_assembly_brick(mim,
'beta*(T0-theta)*Div_Test_u')
+ md.add_linear_term(mim, 'beta*(T0-theta)*Div_Test_u')
----------
----------------------------------------------------------------------------------------------------------------
**Scilab** .. code-block:: matlab
@@ -567,7 +566,7 @@ The following program allows to take into account the whole
elastic deformation
gf_model_set(md, 'add source term brick', mim, 'u', 'Fdata',
RIGHT_BOUND);
gf_model_set(md, 'add initialized data', 'beta',
[alpha_th*E/(1-2*nu)]);
- gf_model_set(md, 'add linear generic assembly brick', mim,
'beta*(T0-theta)*Div_Test_u');
+ gf_model_set(md, 'add linear term', mim,
'beta*(T0-theta)*Div_Test_u');
----------
----------------------------------------------------------------------------------------------------------------
**Matlab** .. code-block:: matlab
@@ -581,7 +580,7 @@ The following program allows to take into account the whole
elastic deformation
gf_model_set(md, 'add source term brick', mim, 'u', 'Fdata',
RIGHT_BOUND);
gf_model_set(md, 'add initialized data', 'beta',
[alpha_th*E/(1-2*nu)]);
- gf_model_set(md, 'add linear generic assembly brick', mim,
'beta*(T0-theta)*Div_Test_u');
+ gf_model_set(md, 'add linear term', mim,
'beta*(T0-theta)*Div_Test_u');
==========
================================================================================================================
Electric potential problem
@@ -596,7 +595,7 @@ Similarly, the following program take into account the
electric potential equati
md.add_initialized_scalar_data("eps", epsilon);
md.add_initialized_scalar_data("rho_0", rho_0);
md.add_initialized_scalar_data("alpha", alpha);
- getfem::add_nonlinear_generic_assembly_brick
+ getfem::add_nonlinear_term
(md, mim, sigmaeps+"*(Grad_V.Grad_Test_V)");
getfem::add_Dirichlet_condition_with_multipliers
(md, mim, "V", bgeot::dim_type(elements_degree-1),
RIGHT_BOUND);
@@ -610,7 +609,7 @@ Similarly, the following program take into account the
electric potential equati
md.add_initialized_data('eps', [epsilon])
md.add_initialized_data('rho_0', [rho_0])
md.add_initialized_data('alpha', [alpha])
- md.add_nonlinear_generic_assembly_brick(mim,
sigmaeps+'*(Grad_V.Grad_Test_V)')
+ md.add_nonlinear_term(mim, sigmaeps+'*(Grad_V.Grad_Test_V)')
md.add_Dirichlet_condition_with_multipliers(mim, 'V',
elements_degree-1, RIGHT_BOUND)
md.add_initialized_data('DdataV', [0.1])
md.add_Dirichlet_condition_with_multipliers(mim, 'V',
elements_degree-1, LEFT_BOUND, 'DdataV')
@@ -621,7 +620,7 @@ Similarly, the following program take into account the
electric potential equati
gf_model_set(md, 'add initialized data', 'eps', [epsilon]);
gf_model_set(md, 'add initialized data', 'rho_0', [rho_0]);
gf_model_set(md, 'add initialized data', 'alpha', [alpha]);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim,
sigmaeps+'*(Grad_V.Grad_Test_V)');
+ gf_model_set(md, 'add nonlinear term', mim,
sigmaeps+'*(Grad_V.Grad_Test_V)');
gf_model_set(md, 'add Dirichlet condition with multipliers',
mim, 'V', elements_degree-1, RIGHT_BOUND);
gf_model_set(md, 'add initialized data', 'DdataV', [0.1]);
gf_model_set(md, 'add Dirichlet condition with multipliers',
mim, 'V', elements_degree-1, LEFT_BOUND, 'DdataV');
@@ -632,7 +631,7 @@ Similarly, the following program take into account the
electric potential equati
gf_model_set(md, 'add initialized data', 'eps', [epsilon]);
gf_model_set(md, 'add initialized data', 'rho_0', [rho_0]);
gf_model_set(md, 'add initialized data', 'alpha', [alpha]);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim,
[sigmaeps '*(Grad_V.Grad_Test_V)']);
+ gf_model_set(md, 'add nonlinear term', mim, [sigmaeps
'*(Grad_V.Grad_Test_V)']);
gf_model_set(md, 'add Dirichlet condition with multipliers',
mim, 'V', elements_degree-1, RIGHT_BOUND);
gf_model_set(md, 'add initialized data', 'DdataV', [0.1]);
gf_model_set(md, 'add Dirichlet condition with multipliers',
mim, 'V', elements_degree-1, LEFT_BOUND, 'DdataV');
@@ -653,7 +652,7 @@ Now, the program to take into account the thermal problem:
getfem::add_mass_brick(md, mim, "theta", "D2");
getfem::add_source_term_brick(md, mim, "theta", "D2airt");
- getfem::add_nonlinear_generic_assembly_brick
+ getfem::add_nonlinear_term
(md, mim, "-"+sigmaeps+"*Norm_sqr(Grad_V)*Test_theta");
----------
---------------------------------------------------------------------------
**Python** .. code-block:: python
@@ -665,7 +664,7 @@ Now, the program to take into account the thermal problem:
md.add_mass_brick(mim, 'theta', 'D2')
md.add_source_term_brick(mim, 'theta', 'D2airt')
- md.add_nonlinear_generic_assembly_brick(mim,
'-'+sigmaeps+'*Norm_sqr(Grad_V)*Test_theta')
+ md.add_nonlinear_term(mim,
'-'+sigmaeps+'*Norm_sqr(Grad_V)*Test_theta')
----------
---------------------------------------------------------------------------
**Scilab** .. code-block:: matlab
@@ -676,7 +675,7 @@ Now, the program to take into account the thermal problem:
gf_model_set(md, 'add mass brick', mim, 'theta', 'D2');
gf_model_set(md, 'add source term brick', mim, 'theta',
'D2airt');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim,
'-'+sigmaeps+'*Norm_sqr(Grad_V)*Test_theta');
+ gf_model_set(md, 'add nonlinear term', mim,
'-'+sigmaeps+'*Norm_sqr(Grad_V)*Test_theta');
----------
---------------------------------------------------------------------------
**Matlab** .. code-block:: matlab
@@ -687,7 +686,7 @@ Now, the program to take into account the thermal problem:
gf_model_set(md, 'add mass brick', mim, 'theta', 'D2');
gf_model_set(md, 'add source term brick', mim, 'theta',
'D2airt');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim,
['-' sigmaeps '*Norm_sqr(Grad_V)*Test_theta']);
+ gf_model_set(md, 'add nonlinear term', mim, ['-' sigmaeps
'*Norm_sqr(Grad_V)*Test_theta']);
==========
===========================================================================
diff --git a/doc/sphinx/source/tutorial/wheel.rst
b/doc/sphinx/source/tutorial/wheel.rst
index fb46707..71acd82 100644
--- a/doc/sphinx/source/tutorial/wheel.rst
+++ b/doc/sphinx/source/tutorial/wheel.rst
@@ -174,9 +174,9 @@ Using the high-level generic assembly bricks, the contact
condition can be added
md.add_initialized_data('gamma0', [gamma0])
md.add_filtered_fem_variable('lambda1', mflambda_C, CONTACT_BOUND)
- md.add_nonlinear_generic_assembly_brick(mim1, 'lambda1*(Test_u1.[0;1])'
+ md.add_nonlinear_term(mim1, 'lambda1*(Test_u1.[0;1])'
'-lambda1*(Interpolate(Test_u2,Proj1).[0;1])',
CONTACT_BOUND)
- md.add_nonlinear_generic_assembly_brick(mim1, '-(gamma0*element_size)'
+ md.add_nonlinear_term(mim1, '-(gamma0*element_size)'
'*(lambda1 + neg_part(lambda1+(1/(gamma0*element_size))'
'*((u1-Interpolate(u2,Proj1)+X-Interpolate(X,Proj1)).[0;1])))*Test_lambda1',
CONTACT_BOUND);
@@ -209,14 +209,14 @@ This could be added to the model with the generic
assembly brick:
md.add_filtered_fem_variable('lambda_D', mflambda, HOLE_BOUND)
md.add_initialized_data('F', [applied_force/(8*2*np.pi)])
- md.add_linear_generic_assembly_brick(mim1, '-lambda_D.Test_u1 +
(alpha_D*[0;1]-u1).Test_lambda_D'
+ md.add_linear_term(mim1, '-lambda_D.Test_u1 +
(alpha_D*[0;1]-u1).Test_lambda_D'
' + (lambda_D.[0;1]+F)*Test_alpha_D', HOLE_BOUND)
For more robustness, a small penalization on :math:`alpha_D` can be added
.. code-block:: python
- md.add_linear_generic_assembly_brick(mim1, '1E-6*alpha_D*Test_alpha_D');
+ md.add_linear_term(mim1, '1E-6*alpha_D*Test_alpha_D');
Note that the fixed size variable `alpha_D` is linked to each points of the
rim boundary. This means that the line of the tangent matrix corresponding to
`alpha_D` may have a lot of nonzero components. This is why such a use of fixed
size variable have to be done with care.
diff --git a/doc/sphinx/source/userdoc/model_generic_assembly.rst
b/doc/sphinx/source/userdoc/model_generic_assembly.rst
index efee1f6..43f9cd9 100644
--- a/doc/sphinx/source/userdoc/model_generic_assembly.rst
+++ b/doc/sphinx/source/userdoc/model_generic_assembly.rst
@@ -15,32 +15,31 @@ Generic assembly bricks
A mean to add a term either on one variable or on several ones is to directly
use the high-level generic assembly langage describe in Section
:ref:`ud-gasm-high`. The more general way is to use::
- size_type getfem::add_nonlinear_generic_assembly_brick(md, mim, expr,
+ size_type getfem::add_nonlinear_term(md, mim, expr,
region = -1, is_sym = false, is_coercive = false);
This adds a brick to the model ``md``, using the integration method ``mim``,
the assembly string ``expr`` on the mesh region ``region``. If the result is
symmetric, you can specify it on the 5th argument and if it is coercive on the
6th argument. The latter indications of symmetry and coercivness are used to
determine the right linear solver. If you are not so sure, it is preferable not
to indicate anything.
However, this brick consider that the expression is nonlinear. This brick is
especially indicated to obtain nonlinear coupled terms between several
variables. This means in particular that the assembly of the term is performed
at each call of the assembly of the model and that a Newton algorithm will be
used to solve the problem. If the term is indeed linear, you should use
instead::
- size_type getfem::add_linear_generic_assembly_brick(md, mim, expr,
+ size_type getfem::add_linear_term(md, mim, expr,
region = -1, is_sym = false, is_coercive = false);
with the same arguments. Conversely, this brick alway assume that the term
corresponding to ``expr`` is linear and the assembly will be performed only
once if the data used do not change. Thus, you have to care that your
expression is indeed linear (affine in fact) with respect to each variable.
Otherwise, the result is of course not guaranted. Source terms in the
expression are taken into account. Still for linear problem, it is possible to
perform the assembly of a sole source term tha [...]
- size_type getfem::add_source_term_generic_assembly_brick(md, mim, expr,
- region = -1);
+ size_type getfem::add_source(md, mim, expr, region = -1);
with again the same arguments except the symmetry and coercivness. This brick
performs the assembly of the corresponding order 1 term (residual vector) and
add it as a right hand side to the problem. The assembly will be performed only
once, so the term should not depend on the variables of the model (but could
depend of course on the constants).
For instance, if one wants to solve a Poisson problem on a predefined variable
``u`` of the model, one may use the corresponding pre-defined bricks (see
below) or simply use::
- getfem::add_nonlinear_generic_assembly_brick(md, mim, "Grad_u.Grad_Test_u -
F*Test_u", -1, true, true);
+ getfem::add_nonlinear_term(md, mim, "Grad_u.Grad_Test_u - F*Test_u", -1,
true, true);
where ``F`` is a pre-defined constant of the model representing the right hand
side. Of course, doing so, Newton's algorithms will be called. So, the more
appropriate manner is to use the linear bricks as follows::
- getfem::add_linear_generic_assembly_brick(md, mim, "Grad_u.Grad_Test_u", -1,
true, true);
- getfem::add_source_term_generic_assembly_brick(md, mim, "F*Test_u");
+ getfem::add_linear_term(md, mim, "Grad_u.Grad_Test_u", -1, true, true);
+ getfem::add_source_term(md, mim, "F*Test_u");
diff --git a/interface/src/gf_model_set.cc b/interface/src/gf_model_set.cc
index 388e181..3680dc4 100644
--- a/interface/src/gf_model_set.cc
+++ b/interface/src/gf_model_set.cc
@@ -597,7 +597,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
(*md, transname, expr, N);
);
- /address@hidden ind = ('add linear generic assembly brick', @tmim mim,
@str expression[, @int region[, @int is_symmetric[, @int is_coercive]]])
+ /address@hidden ind = ('add linear term', @tmim mim, @str expression[,
@int region[, @int is_symmetric[, @int is_coercive]]])
Adds a matrix term given by the assembly string `expr` which will
be assembled in region `region` and with the integration method `mim`.
Only the matrix term will be taken into account, assuming that it is
@@ -615,7 +615,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
are not allowed for non-coercive problems.
`brickname` is an otpional name for the address@hidden/
sub_command
- ("add linear generic assembly brick", 2, 5, 0, 1,
+ ("add linear term", 2, 5, 0, 1,
getfem::mesh_im *mim = to_meshim_object(in.pop());
std::string expr = in.pop().to_string();
size_type region = size_type(-1);
@@ -625,16 +625,35 @@ void gf_model_set(getfemint::mexargs_in& m_in,
int is_coercive = 0;
if (in.remaining()) is_coercive = in.pop().to_integer();
- size_type ind
- = getfem::add_linear_generic_assembly_brick
+ size_type ind = getfem::add_linear_term
(*md, *mim, expr, region, is_symmetric,
is_coercive) + config::base_index();
workspace().set_dependence(md, mim);
out.pop().from_integer(int(ind));
);
+ /address@hidden ind = ('add linear generic assembly brick', @tmim mim,
@str expression[, @int region[, @int is_symmetric[, @int is_coercive]]])
+ Deprecated. Use MODEL:SET('add linear term') instead. @*/
+ sub_command
+ ("add linear generic assembly brick", 2, 5, 0, 1,
+ getfem::mesh_im *mim = to_meshim_object(in.pop());
+ std::string expr = in.pop().to_string();
+ size_type region = size_type(-1);
+ if (in.remaining()) region = in.pop().to_integer();
+ int is_symmetric = 0;
+ if (in.remaining()) is_symmetric = in.pop().to_integer();
+ int is_coercive = 0;
+ if (in.remaining()) is_coercive = in.pop().to_integer();
+
+ size_type ind
+ = getfem::add_linear_term
+ (*md, *mim, expr, region, is_symmetric,
+ is_coercive) + config::base_index();
+ workspace().set_dependence(md, mim);
+ out.pop().from_integer(int(ind));
+ );
- /address@hidden ind = ('add nonlinear generic assembly brick', @tmim mim,
@str expression[, @int region[, @int is_symmetric[, @int is_coercive]]])
+ /address@hidden ind = ('add nonlinear term', @tmim mim, @str expression[,
@int region[, @int is_symmetric[, @int is_coercive]]])
Adds a nonlinear term given by the assembly string `expr` which will
be assembled in region `region` and with the integration method `mim`.
The expression can describe a potential or a weak form. Second order
@@ -646,7 +665,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
are not allowed for non-coercive problems.
`brickname` is an otpional name for the address@hidden/
sub_command
- ("add nonlinear generic assembly brick", 2, 5, 0, 1,
+ ("add nonlinear term", 2, 5, 0, 1,
getfem::mesh_im *mim = to_meshim_object(in.pop());
std::string expr = in.pop().to_string();
size_type region = size_type(-1);
@@ -657,21 +676,58 @@ void gf_model_set(getfemint::mexargs_in& m_in,
if (in.remaining()) is_coercive = in.pop().to_integer();
size_type ind
- = getfem::add_nonlinear_generic_assembly_brick
+ = getfem::add_nonlinear_term
(*md, *mim, expr, region, is_symmetric,
is_coercive) + config::base_index();
workspace().set_dependence(md, mim);
out.pop().from_integer(int(ind));
);
- /address@hidden ind = ('add source term generic assembly brick', @tmim
mim, @str expression[, @int region])
+ /address@hidden ind = ('add nonlinear generic assembly brick', @tmim mim,
@str expression[, @int region[, @int is_symmetric[, @int is_coercive]]])
+ Deprecated. Use MODEL:SET('add nonlinear term') address@hidden/
+ sub_command
+ ("add nonlinear generic assembly brick", 2, 5, 0, 1,
+ getfem::mesh_im *mim = to_meshim_object(in.pop());
+ std::string expr = in.pop().to_string();
+ size_type region = size_type(-1);
+ if (in.remaining()) region = in.pop().to_integer();
+ int is_symmetric = 0;
+ if (in.remaining()) is_symmetric = in.pop().to_integer();
+ int is_coercive = 0;
+ if (in.remaining()) is_coercive = in.pop().to_integer();
+
+ size_type ind
+ = getfem::add_nonlinear_term
+ (*md, *mim, expr, region, is_symmetric,
+ is_coercive) + config::base_index();
+ workspace().set_dependence(md, mim);
+ out.pop().from_integer(int(ind));
+ );
+
+ /address@hidden ind = ('add source term', @tmim mim, @str expression[,
@int region])
Adds a source term given by the assembly string `expr` which will
be assembled in region `region` and with the integration method `mim`.
Only the residual term will be taken into account.
Take care that if the expression contains some variables and if the
expression is a potential, the expression will be
derivated with respect to all variables.
- `brickname` is an otpional name for the address@hidden/
+ `brickname` is an optional name for the address@hidden/
+ sub_command
+ ("add source term", 2, 3, 0, 1,
+ getfem::mesh_im *mim = to_meshim_object(in.pop());
+ std::string expr = in.pop().to_string();
+ size_type region = size_type(-1);
+ if (in.remaining()) region = in.pop().to_integer();
+
+ size_type ind
+ = getfem::add_source_term_generic_assembly_brick
+ (*md, *mim, expr, region) + config::base_index();
+ workspace().set_dependence(md, mim);
+ out.pop().from_integer(int(ind));
+ );
+
+ /address@hidden ind = ('add source term generic assembly brick', @tmim
mim, @str expression[, @int region])
+ Deprecated. Use MODEL:SET('add source term') instead. @*/
sub_command
("add source term generic assembly brick", 2, 3, 0, 1,
getfem::mesh_im *mim = to_meshim_object(in.pop());
diff --git a/interface/tests/matlab/check_plasticity.m
b/interface/tests/matlab/check_plasticity.m
index 91c9671..3e83f57 100644
--- a/interface/tests/matlab/check_plasticity.m
+++ b/interface/tests/matlab/check_plasticity.m
@@ -161,8 +161,8 @@ En = '((Grad_Previous_u+Grad_Previous_u'')/2)';
expr_sigma = strcat('(', B_inv,
'*(Von_Mises_projection((',B,'*((1-alpha)*sigma))+(-(H)*(((1-alpha)*',En,')+(alpha*',
Enp1, ')))+(alpha*', ApH, '*(',Enp1,'-',En,')) + (alpha*', ...
B, '*sigma), von_mises_threshold) + (H)*(((1-alpha)*',En,')+(alpha*',
Enp1, '))))');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim,
strcat(expr_sigma, 'Grad_u:Grad_Test_u'));
-gf_model_set(md, 'add nonlinear generic assembly brick', mim,
strcat(expr_sigma, ':Grad_Test_u'));
+% gf_model_set(md, 'add nonlinear term', mim, strcat(expr_sigma,
'Grad_u:Grad_Test_u'));
+gf_model_set(md, 'add nonlinear term', mim, strcat(expr_sigma,
':Grad_Test_u'));
% gf_model_set(md, 'add finite strain elasticity brick', mim, 'SaintVenant
Kirchhoff', 'u', '[lambda; mu]');
return;
diff --git a/interface/tests/matlab/demo_Mindlin_Reissner_plate.m
b/interface/tests/matlab/demo_Mindlin_Reissner_plate.m
index d308ebf..aaa07fe 100644
--- a/interface/tests/matlab/demo_Mindlin_Reissner_plate.m
+++ b/interface/tests/matlab/demo_Mindlin_Reissner_plate.m
@@ -81,14 +81,14 @@ if (with_Mindlin_brick)
gf_model_set(md, 'add Mindlin Reissner plate brick', mim, mim_reduced, 'u',
'theta', 'E', 'nu', 'epsilon', 'kappa', variant);
else
gf_model_set(md, 'add elementary rotated RT0 projection', 'RT0_projection');
- gf_model_set(md, 'add linear generic assembly brick', mim,
'(E*epsilon*epsilon*epsilon*(1-nu)/(48 * (1 - nu*nu))) *
((Grad_theta+Grad_theta''):(Grad_Test_theta+Grad_Test_theta''))');
- gf_model_set(md, 'add linear generic assembly brick', mim,
'(E*epsilon*epsilon*epsilon*nu/(12 * (1 - nu*nu))) *
(Div_theta*Div_Test_theta)');
+ gf_model_set(md, 'add linear term', mim,
'(E*epsilon*epsilon*epsilon*(1-nu)/(48 * (1 - nu*nu))) *
((Grad_theta+Grad_theta''):(Grad_Test_theta+Grad_Test_theta''))');
+ gf_model_set(md, 'add linear term', mim, '(E*epsilon*epsilon*epsilon*nu/(12
* (1 - nu*nu))) * (Div_theta*Div_Test_theta)');
if (variant == 0)
- gf_model_set(md, 'add linear generic assembly brick', mim,
'(E*kappa*epsilon/(1 + nu)) * ((Grad_u + theta).Grad_Test_u) +
(E*kappa*epsilon/(1 + nu)) * ((Grad_u + theta).Test_theta)');
+ gf_model_set(md, 'add linear term', mim, '(E*kappa*epsilon/(1 + nu)) *
((Grad_u + theta).Grad_Test_u) + (E*kappa*epsilon/(1 + nu)) * ((Grad_u +
theta).Test_theta)');
elseif (variant == 1)
- gf_model_set(md, 'add linear generic assembly brick', mim_reduced,
'(E*kappa*epsilon/(1 + nu)) * ((Grad_u + theta).Grad_Test_u) +
(E*kappa*epsilon/(1 + nu)) * ((Grad_u + theta).Test_theta)');
+ gf_model_set(md, 'add linear term', mim_reduced, '(E*kappa*epsilon/(1 +
nu)) * ((Grad_u + theta).Grad_Test_u) + (E*kappa*epsilon/(1 + nu)) * ((Grad_u +
theta).Test_theta)');
else
- gf_model_set(md, 'add linear generic assembly brick', mim,
'(E*kappa*epsilon/(1 + nu)) * ((Grad_u +
Elementary_transformation(theta,RT0_projection)).Grad_Test_u) +
(E*kappa*epsilon/(1 + nu)) * ((Grad_u + Elementary_transformation(theta,
RT0_projection)).(Elementary_transformation(Test_theta, RT0_projection)))');
+ gf_model_set(md, 'add linear term', mim, '(E*kappa*epsilon/(1 + nu)) *
((Grad_u + Elementary_transformation(theta,RT0_projection)).Grad_Test_u) +
(E*kappa*epsilon/(1 + nu)) * ((Grad_u + Elementary_transformation(theta,
RT0_projection)).(Elementary_transformation(Test_theta, RT0_projection)))');
end
end
diff --git a/interface/tests/matlab/demo_Nitsche_contact_by_hand.m
b/interface/tests/matlab/demo_Nitsche_contact_by_hand.m
index 0572754..af7e7f1 100644
--- a/interface/tests/matlab/demo_Nitsche_contact_by_hand.m
+++ b/interface/tests/matlab/demo_Nitsche_contact_by_hand.m
@@ -199,8 +199,8 @@ NX = Nxy(zz)
if (approximation_type == 0)
gf_model_set(md, 'add filtered fem variable', 'lambda1', mflambda1,
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'-lambda1*(Test_u1.N1)+lambda1*(Interpolate(Test_u2,Proj1).N1)',
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'-(gamma0*element_size)*(lambda1 +
neg_part(lambda1-(1/(gamma0*element_size))*((u1-Interpolate(u2,Proj1)+X-Interpolate(X,Proj1)).N1)))*Test_lambda1',
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'-lambda1*(Test_u1.N1)+lambda1*(Interpolate(Test_u2,Proj1).N1)',
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'-(gamma0*element_size)*(lambda1 +
neg_part(lambda1-(1/(gamma0*element_size))*((u1-Interpolate(u2,Proj1)+X-Interpolate(X,Proj1)).N1)))*Test_lambda1',
CONTACT_BOUNDARY1);
else
gamma='(gamma0*element_size)';
@@ -209,10 +209,10 @@ NX = Nxy(zz)
Pn_gamma_u1=strcat('((u1-Interpolate(u2,Proj1)+X-Interpolate(X,Proj1)).N1) -
',gamma,'*(',sigma_uh1_n,')');
if (approximation_type == 1) coeff = ''; elseif (approximation_type ==
2) coeff = '0.5*'; end
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('-',coeff,'theta*',gamma,'*(',sigma_uh1_n,')*(',sigma_vh1_n,')'),
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('-',coeff,'theta*',sigma_vh1_n,'*pos_part(',Pn_gamma_u1,')'),
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat(coeff,'(1/',gamma,')*(Test_u1.N1)*pos_part(',Pn_gamma_u1,')'),
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('-',coeff,'(1/',gamma,')*(Interpolate(Test_u2,Proj1).N1)*pos_part(',Pn_gamma_u1,')'),CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('-',coeff,'theta*',gamma,'*(',sigma_uh1_n,')*(',sigma_vh1_n,')'),
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('-',coeff,'theta*',sigma_vh1_n,'*pos_part(',Pn_gamma_u1,')'),
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat(coeff,'(1/',gamma,')*(Test_u1.N1)*pos_part(',Pn_gamma_u1,')'),
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('-',coeff,'(1/',gamma,')*(Interpolate(Test_u2,Proj1).N1)*pos_part(',Pn_gamma_u1,')'),CONTACT_BOUNDARY1);
if (approximation_type == 2)
if N==2
@@ -226,10 +226,10 @@ NX = Nxy(zz)
sigma_uh2_n ='(((clambda*Trace(Grad_u2)*Id(qdim(u2)) + cmu*(Grad_u2 +
Grad_u2'')).Normal).N2)';
Pn_gamma_u2=strcat('((u2-Interpolate(u1,Proj2)).N2) -
',gamma,'*(',sigma_uh2_n,')-(Interpolate(X,Proj2)-X).N2');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('-0.5*theta*',gamma,'*(',sigma_uh2_n,')*(',sigma_vh2_n,')'),
CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('-0.5*theta*',sigma_vh2_n,'*pos_part(',Pn_gamma_u2,')'),
CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('0.5*(1/',gamma,')*(Test_u2.N2)*pos_part(',Pn_gamma_u2,')'),
CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('-0.5*(1/',gamma,')*(Interpolate(Test_u1,Proj2).N2)*pos_part(',Pn_gamma_u2,')'),
CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('-0.5*theta*',gamma,'*(',sigma_uh2_n,')*(',sigma_vh2_n,')'),
CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('-0.5*theta*',sigma_vh2_n,'*pos_part(',Pn_gamma_u2,')'),
CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('0.5*(1/',gamma,')*(Test_u2.N2)*pos_part(',Pn_gamma_u2,')'),
CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('-0.5*(1/',gamma,')*(Interpolate(Test_u1,Proj2).N2)*pos_part(',Pn_gamma_u2,')'),
CONTACT_BOUNDARY2);
end
end
diff --git a/interface/tests/matlab/demo_continuation.m
b/interface/tests/matlab/demo_continuation.m
index 1e6015c..fd0d093 100644
--- a/interface/tests/matlab/demo_continuation.m
+++ b/interface/tests/matlab/demo_continuation.m
@@ -68,8 +68,7 @@ md = gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
gf_model_set(md, 'add Laplacian brick', mim, 'u');
gf_model_set(md, 'add data', 'lambda', 1);
-gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
- '(u-lambda*exp(u))*Test_u');
+gf_model_set(md, 'add nonlinear term', mim, '(u-lambda*exp(u))*Test_u');
if (with_dirichlet)
gf_model_set(md, 'add Dirichlet condition with multipliers', ...
diff --git a/interface/tests/matlab/demo_crack.m
b/interface/tests/matlab/demo_crack.m
index 71512de..9feb83b 100644
--- a/interface/tests/matlab/demo_crack.m
+++ b/interface/tests/matlab/demo_crack.m
@@ -140,12 +140,12 @@
gf_model_set(md,'add_Dirichlet_condition_with_penalization',mim,'u', 1e12, DIRIC
if (variant == 5 || variant == 6) % Penalisation of the jump over the first
crack
mim_bound1 = gf_mesh_im('levelset', mls, 'boundary(a)',
gf_integ('IM_STRUCTURED_COMPOSITE(IM_TRIANGLE(6),3)'));
% gf_asm('generic', mim_bound, 0, '1', -1) % length of the crack
- gf_model_set(md, 'add linear generic assembly brick', mim_bound1,
'1e17*(Xfem_plus(u)-Xfem_minus(u)).(Xfem_plus(Test_u)-Xfem_minus(Test_u))');
+ gf_model_set(md, 'add linear term', mim_bound1,
'1e17*(Xfem_plus(u)-Xfem_minus(u)).(Xfem_plus(Test_u)-Xfem_minus(Test_u))');
end
if (variant == 4 || variant == 6) % Penalisation of the jump over the second
crack
mim_bound2 = gf_mesh_im('levelset', mls, 'boundary(b)',
gf_integ('IM_STRUCTURED_COMPOSITE(IM_TRIANGLE(6),3)'));
- gf_model_set(md, 'add linear generic assembly brick', mim_bound2,
'1e17*(Xfem_plus(u)-Xfem_minus(u)).(Xfem_plus(Test_u)-Xfem_minus(Test_u))');
+ gf_model_set(md, 'add linear term', mim_bound2,
'1e17*(Xfem_plus(u)-Xfem_minus(u)).(Xfem_plus(Test_u)-Xfem_minus(Test_u))');
end
% Assembly of the linear system and solve:
diff --git a/interface/tests/matlab/demo_dynamic_contact.m
b/interface/tests/matlab/demo_dynamic_contact.m
index d246da6..c769180 100644
--- a/interface/tests/matlab/demo_dynamic_contact.m
+++ b/interface/tests/matlab/demo_dynamic_contact.m
@@ -303,12 +303,12 @@ elseif (Contact_option == 0)
end
elseif (Contact_option == 2)
gf_model_set(md, 'add initialized data', 'penalty_coeff', [penalty_coeff]);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim_friction,
'penalty_coeff*sqr(neg_part(obstacle + u.(Normalized(Grad_obstacle))))',
GAMMAC);
+ gf_model_set(md, 'add nonlinear term', mim_friction,
'penalty_coeff*sqr(neg_part(obstacle + u.(Normalized(Grad_obstacle))))',
GAMMAC);
if (friction ~= 0)
error('Sorry friction to be taken into account for penalty method')
end
elseif (Contact_option == 3)
- gf_model_set(md, 'add nonlinear generic assembly brick', mim_friction,
'0', GAMMAC); % In order to have at list a nonlinear term ...
+ gf_model_set(md, 'add nonlinear term', mim_friction, '0', GAMMAC); % In
order to have at list a nonlinear term ...
gf_model_set(md, 'add fem data', 'uel', mfu);
if (scheme ~= 3)
error('experimental method only implemented for explicit scheme,
sorry')
diff --git a/interface/tests/matlab/demo_dynamic_plasticity.m
b/interface/tests/matlab/demo_dynamic_plasticity.m
index 4ca49d6..a810182 100644
--- a/interface/tests/matlab/demo_dynamic_plasticity.m
+++ b/interface/tests/matlab/demo_dynamic_plasticity.m
@@ -202,7 +202,7 @@ if(general_theta_method)
end
-gf_model_set(md, 'add nonlinear generic assembly brick', mim,
strcat(expr_sigma, ':Grad_Test_u'));
+gf_model_set(md, 'add nonlinear term', mim, strcat(expr_sigma,
':Grad_Test_u'));
% gf_model_set(md, 'add finite strain elasticity brick', mim, 'u',
'SaintVenant Kirchhoff', '[lambda; mu]');
diff --git a/interface/tests/matlab/demo_dynamic_plasticity_with_contact.m
b/interface/tests/matlab/demo_dynamic_plasticity_with_contact.m
index 5b765df..3c9055b 100644
--- a/interface/tests/matlab/demo_dynamic_plasticity_with_contact.m
+++ b/interface/tests/matlab/demo_dynamic_plasticity_with_contact.m
@@ -289,7 +289,7 @@ if(general_theta_method)
end
-gf_model_set(md, 'add nonlinear generic assembly brick', mim,
strcat(expr_sigma, ':Grad_Test_u'));
+gf_model_set(md, 'add nonlinear term', mim, strcat(expr_sigma,
':Grad_Test_u'));
% gf_model_set(md, 'add finite strain elasticity brick', mim, 'u',
'SaintVenant Kirchhoff', '[lambda; mu]');
diff --git a/interface/tests/matlab/demo_elasticity.m
b/interface/tests/matlab/demo_elasticity.m
index 98d2ff7..a9b9e3a 100644
--- a/interface/tests/matlab/demo_elasticity.m
+++ b/interface/tests/matlab/demo_elasticity.m
@@ -86,7 +86,7 @@ gf_model_set(md, 'add fem variable', 'u', mf);
if (option == 1)
gf_model_set(md, 'add initialized data', 'cmu', [cmu]);
gf_model_set(md, 'add initialized data', 'clambda', [clambda]);
- % gf_model_set(md, 'add linear generic assembly brick', mim, ...
+ % gf_model_set(md, 'add linear term', mim, ...
% '(clambda*Div_Test_u*Id(qdim(u)) +
% cmu*(Grad_Test_u''+Grad_Test_u)):Grad_Test2_u');
gf_model_set(md, 'add isotropic linearized elasticity brick', mim, 'u',
'clambda', 'cmu');
diff --git a/interface/tests/matlab/demo_laplacian.m
b/interface/tests/matlab/demo_laplacian.m
index f070f78..b97310d 100644
--- a/interface/tests/matlab/demo_laplacian.m
+++ b/interface/tests/matlab/demo_laplacian.m
@@ -70,7 +70,7 @@ F = gf_mesh_fem_get(mf, 'eval', {
'4*pi*(2*pi*x.*sin(2*pi*x) - cos(2*pi*x))
md=gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
-gf_model_set(md, 'add linear generic assembly brick', mim,
'Grad_u.Grad_Test_u');
+gf_model_set(md, 'add linear term', mim, 'Grad_u.Grad_Test_u');
% gf_model_set(md, 'add Laplacian brick', mim, 'u');
gf_model_set(md, 'add initialized fem data', 'VolumicData', mf, F);
gf_model_set(md, 'add source term brick', mim, 'u', 'VolumicData');
diff --git a/interface/tests/matlab/demo_laplacian_DG.m
b/interface/tests/matlab/demo_laplacian_DG.m
index 035badf..f9346b4 100644
--- a/interface/tests/matlab/demo_laplacian_DG.m
+++ b/interface/tests/matlab/demo_laplacian_DG.m
@@ -97,7 +97,7 @@ F = gf_mesh_fem_get(mf, 'eval', {
'4*pi*(2*pi*x.*sin(2*pi*x) - cos(2*pi*x))
md=gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
-gf_model_set(md, 'add linear generic assembly brick', mim,
'Grad_u.Grad_Test_u');
+gf_model_set(md, 'add linear term', mim, 'Grad_u.Grad_Test_u');
% gf_model_set(md, 'add Laplacian brick', mim, 'u');
gf_model_set(md, 'add initialized fem data', 'VolumicData', mf, F);
gf_model_set(md, 'add source term brick', mim, 'u', 'VolumicData');
@@ -121,10 +121,10 @@ jump = '((u-Interpolate(u,neighbour_elt))*Normal)';
test_jump = '((Test_u-Interpolate(Test_u,neighbour_elt))*Normal)';
grad_mean = '((Grad_u+Interpolate(Grad_u,neighbour_elt))*0.5)';
grad_test_mean = '((Grad_Test_u+Interpolate(Grad_Test_u,neighbour_elt))*0.5)';
-% gf_model_set(md, 'add linear generic assembly brick', mim,
sprintf('-((%s).(%s))', grad_mean, test_jump), INNER_FACES);
-% gf_model_set(md, 'add linear generic assembly brick', mim,
sprintf('-((%s).(%s))', jump, grad_test_mean), INNER_FACES);
-% gf_model_set(md, 'add linear generic assembly brick', mim,
sprintf('alpha*((%s).(%s))', jump, test_jump), INNER_FACES);
-gf_model_set(md, 'add linear generic assembly brick', mim,
sprintf('-((%s).(%s))-((%s).(%s))+alpha*((%s).(%s))', grad_mean, test_jump,
jump, grad_test_mean, jump, test_jump), INNER_FACES);
+% gf_model_set(md, 'add linear term', mim, sprintf('-((%s).(%s))', grad_mean,
test_jump), INNER_FACES);
+% gf_model_set(md, 'add linear term', mim, sprintf('-((%s).(%s))', jump,
grad_test_mean), INNER_FACES);
+% gf_model_set(md, 'add linear term', mim, sprintf('alpha*((%s).(%s))', jump,
test_jump), INNER_FACES);
+gf_model_set(md, 'add linear term', mim,
sprintf('-((%s).(%s))-((%s).(%s))+alpha*((%s).(%s))', grad_mean, test_jump,
jump, grad_test_mean, jump, test_jump), INNER_FACES);
gf_model_get(md, 'solve', 'noisy');
U = gf_model_get(md, 'variable', 'u');
diff --git a/interface/tests/matlab/demo_laplacian_pyramid.m
b/interface/tests/matlab/demo_laplacian_pyramid.m
index 520811d..46608ab 100644
--- a/interface/tests/matlab/demo_laplacian_pyramid.m
+++ b/interface/tests/matlab/demo_laplacian_pyramid.m
@@ -76,7 +76,7 @@ F = gf_mesh_fem_get(mf, 'eval', {
'3*pi*pi*sin(pi*x/2).*sin(pi*y/2).*sin(pi*z/2)
md=gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
-gf_model_set(md, 'add linear generic assembly brick', mim,
'Grad_u.Grad_Test_u');
+gf_model_set(md, 'add linear term', mim, 'Grad_u.Grad_Test_u');
% gf_model_set(md, 'add Laplacian brick', mim, 'u');
gf_model_set(md, 'add initialized fem data', 'VolumicData', mf, F);
gf_model_set(md, 'add source term brick', mim, 'u', 'VolumicData');
diff --git a/interface/tests/matlab/demo_large_sliding_contact.m
b/interface/tests/matlab/demo_large_sliding_contact.m
index 3dc14fd..80ed984 100644
--- a/interface/tests/matlab/demo_large_sliding_contact.m
+++ b/interface/tests/matlab/demo_large_sliding_contact.m
@@ -263,18 +263,18 @@ if (direct_generic_assembly) % Direct use of high-level
generic assembly
gf_model_set(md, 'add initialized data', 'r', r);
gf_model_set(md, 'add initialized data', 'f', f_coeff);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'-lambda1.Test_u1', CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'Interpolate_filter(contact_trans, lambda1.Interpolate(Test_u,contact_trans),
1)', CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'-(1/r)*lambda1.Test_lambda1', CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1,
(Interpolate(X,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1, Normal),
f, r).Test_lambda1, 2)', CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1,
Normal), f, r).Test_lambda1, 1)', CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact, '-lambda1.Test_u1',
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'Interpolate_filter(contact_trans, lambda1.Interpolate(Test_u,contact_trans),
1)', CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'-(1/r)*lambda1.Test_lambda1', CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1,
(Interpolate(X,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1, Normal),
f, r).Test_lambda1, 2)', CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1,
Normal), f, r).Test_lambda1, 1)', CONTACT_BOUNDARY1);
if (two_meshes && self_contact)
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
'-lambda2.Test_u2', CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
'Interpolate_filter(contact_trans, lambda2.Interpolate(Test_u,contact_trans),
1)', CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
'-(1/r)*lambda2.Test_lambda2', CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2,
(Interpolate(X,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2, Normal),
f, r).Test_lambda2, 2)', CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2,
Normal), f, r).Test_lambda2, 1)', CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact, '-lambda2.Test_u2',
CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
'Interpolate_filter(contact_trans, lambda2.Interpolate(Test_u,contact_trans),
1)', CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
'-(1/r)*lambda2.Test_lambda2', CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2,
(Interpolate(X,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2, Normal),
f, r).Test_lambda2, 2)', CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
'Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2,
Normal), f, r).Test_lambda2, 1)', CONTACT_BOUNDARY2);
end
u_group = 'u';
diff --git a/interface/tests/matlab/demo_nonlinear_elasticity.m
b/interface/tests/matlab/demo_nonlinear_elasticity.m
index d0d1376..5e6803a 100644
--- a/interface/tests/matlab/demo_nonlinear_elasticity.m
+++ b/interface/tests/matlab/demo_nonlinear_elasticity.m
@@ -86,20 +86,20 @@ gf_model_set(md, 'add fem variable', 'u', mfu);
gf_model_set(md,'add initialized data','params', params);
% gf_model_set(md, 'add nonlinear elasticity brick', mim, 'u', lawname,
'params');
gf_model_set(md, 'add finite strain elasticity brick', mim, lawname, 'u',
'params');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim, ...
% 'sqr(Trace(Green_Lagrangian(Id(meshdim)+Grad_u)))/8 +
Norm_sqr(Green_Lagrangian(Id(meshdim)+Grad_u))/4');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim, ...
%
'((Id(meshdim)+Grad_u)*(params(1)*Trace(Green_Lagrangian(Id(meshdim)+Grad_u))*Id(meshdim)+2*params(2)*Green_Lagrangian(Id(meshdim)+Grad_u))):Grad_Test_u');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim,
'Saint_Venant_Kirchhoff_potential(Grad_u,params)');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim,
'Saint_Venant_Kirchhoff_potential(Grad_u,params)');
+% gf_model_set(md, 'add nonlinear term', mim, ...
%
'((Id(meshdim)+Grad_u)*(Ciarlet_Geymonat_sigma(Grad_u,params))):Grad_Test_u');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim, ...
% 'Ciarlet_Geymonat_potential(Grad_u,params)');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim, ...
%
'((Id(meshdim)+Grad_u)*(Incompressible_Mooney_Rivlin_sigma(Grad_u,params))):Grad_Test_u');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim, ...
% 'Incompressible_Mooney_Rivlin_potential(Grad_u,params)');
-% gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+% gf_model_set(md, 'add nonlinear term', mim, ...
%
'((Id(meshdim)+Grad_u)*(Saint_Venant_Kirchhoff_sigma(Grad_u,params))):Grad_Test_u');
@@ -110,9 +110,9 @@ if (incompressible)
gf_model_set(md, 'add fem variable', 'p', mfp);
% gf_model_set(md, 'add nonlinear incompressibility brick', mim, 'u', 'p');
gf_model_set(md, 'add finite strain incompressibility brick', mim, 'u',
'p');
- % gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+ % gf_model_set(md, 'add nonlinear term', mim, ...
% 'p*(1-Det(Id(meshdim)+Grad_u))');
- % gf_model_set(md, 'add nonlinear generic assembly brick', mim, ...
+ % gf_model_set(md, 'add nonlinear term', mim, ...
%
'-p*Det(Id(meshdim)+Grad_u)*(Inv(Id(meshdim)+Grad_u))'':Grad_Test_u +
Test_p*(1-Det(Id(meshdim)+Grad_u))');
end
diff --git a/interface/tests/matlab/demo_periodic_laplacian.m
b/interface/tests/matlab/demo_periodic_laplacian.m
index 84634de..57fdf45 100644
--- a/interface/tests/matlab/demo_periodic_laplacian.m
+++ b/interface/tests/matlab/demo_periodic_laplacian.m
@@ -72,7 +72,7 @@ F = gf_mesh_fem_get(mf, 'eval', {
'8*pi*pi*cos(2*pi*(x+0.1)).*sin(2*pi*y)'
md=gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
gf_model_set(md, 'add Laplacian brick', mim, 'u');
-% gf_model_set(md, 'add linear generic assembly brick', mim,
'Grad_Test2_u.Grad_Test_u');
+% gf_model_set(md, 'add linear term', mim, 'Grad_Test2_u.Grad_Test_u');
gf_model_set(md, 'add initialized fem data', 'VolumicData', mf, F);
gf_model_set(md, 'add source term brick', mim, 'u', 'VolumicData');
gf_model_set(md, 'add initialized fem data', 'DirichletData', mf, Uexact);
@@ -90,7 +90,7 @@ end
% periodic condition
gf_model_set(md, 'add filtered fem variable', 'lambda', mf_lambda, GAMMAP); %
multiplier for the periodic condition
gf_model_set(md, 'add interpolate transformation from expression',
'transform', m, m, 'X-[1;0]');
-gf_model_set(md, 'add linear generic assembly brick', mim,
'(Interpolate(u,transform)-u)*lambda', GAMMAP);
+gf_model_set(md, 'add linear term', mim,
'(Interpolate(u,transform)-u)*lambda', GAMMAP);
gf_model_get(md, 'solve');
U = gf_model_get(md, 'variable', 'u');
diff --git a/interface/tests/matlab/demo_plasticity.m
b/interface/tests/matlab/demo_plasticity.m
index e23e9fd..8dc63b6 100644
--- a/interface/tests/matlab/demo_plasticity.m
+++ b/interface/tests/matlab/demo_plasticity.m
@@ -157,7 +157,7 @@ if (with_hardening)
expr_sigma = strcat('(', B_inv,
'*(Von_Mises_projection((',B,'*((1-alpha)*sigma))+(-(H)*(((1-alpha)*',En,')+(alpha*',
Enp1, ')))+(alpha*', ApH, '*(',Enp1,'-',En,')) + (alpha*', ...
B, '*sigma), von_mises_threshold) + (H)*(((1-alpha)*',En,')+(alpha*',
Enp1, '))))');
- gf_model_set(md, 'add nonlinear generic assembly brick', mim,
strcat(expr_sigma, ':Grad_Test_u'));
+ gf_model_set(md, 'add nonlinear term', mim, strcat(expr_sigma,
':Grad_Test_u'));
% gf_model_set(md, 'add finite strain elasticity brick', mim, 'SaintVenant
Kirchhoff', 'u', '[lambda; mu]');
else
gf_model_set(md, 'add fem data', 'previous_u', mf_u);
diff --git
a/interface/tests/matlab/demo_thermo_elasticity_electrical_coupling.m
b/interface/tests/matlab/demo_thermo_elasticity_electrical_coupling.m
index a637069..4a67f7c 100644
--- a/interface/tests/matlab/demo_thermo_elasticity_electrical_coupling.m
+++ b/interface/tests/matlab/demo_thermo_elasticity_electrical_coupling.m
@@ -156,7 +156,7 @@ gf_model_set(md, 'add initialized data', 'eps', [epsilon]);
gf_model_set(md, 'add initialized data', 'rho_0', [rho_0]);
gf_model_set(md, 'add initialized data', 'alpha', [alpha]);
gf_model_set(md, 'add initialized data', 'T0', [T0]);
-gf_model_set(md, 'add nonlinear generic assembly brick', mim, [sigmaeps
'*(Grad_V.Grad_Test_V)']);
+gf_model_set(md, 'add nonlinear term', mim, [sigmaeps
'*(Grad_V.Grad_Test_V)']);
gf_model_set(md, 'add Dirichlet condition with multipliers', mim, 'V',
elements_degree-1, RIGHT_BOUND);
gf_model_set(md, 'add initialized data', 'DdataV', [0.1]);
gf_model_set(md, 'add Dirichlet condition with multipliers', mim, 'V',
elements_degree-1, LEFT_BOUND, 'DdataV');
@@ -176,11 +176,11 @@ gf_model_set(md, 'add Fourier Robin brick', mim, 'theta',
'Deps', BOTTOM_BOUND);
gf_model_set(md, 'add source term brick', mim, 'theta', 'Depsairt',
BOTTOM_BOUND);
% Joule heating term
-gf_model_set(md, 'add nonlinear generic assembly brick', mim, ['-' sigmaeps
'*Norm_sqr(Grad_V)*Test_theta']);
+gf_model_set(md, 'add nonlinear term', mim, ['-' sigmaeps
'*Norm_sqr(Grad_V)*Test_theta']);
% Thermal expansion term
gf_model_set(md, 'add initialized data', 'beta', [alpha_th*E/(1-2*nu)]);
-gf_model_set(md, 'add linear generic assembly brick', mim,
'beta*(T0-theta)*Div_Test_u');
+gf_model_set(md, 'add linear term', mim, 'beta*(T0-theta)*Div_Test_u');
%
diff --git a/interface/tests/matlab/test1_nitsche_large_sliding.m
b/interface/tests/matlab/test1_nitsche_large_sliding.m
index 0c70f5e..6dc40c3 100644
--- a/interface/tests/matlab/test1_nitsche_large_sliding.m
+++ b/interface/tests/matlab/test1_nitsche_large_sliding.m
@@ -269,13 +269,13 @@ if (generic_assembly_contact_brick)
g1_t='u1';
gf_model_set(md, 'add initialized data', 'r', r);
gf_model_set(md, 'add initialized data', 'f', f_coeff);
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,(Test_u1).Transformed_unit_vector(Grad_u1,
Normal)*pos_part(',g1_n,'-',gamma,'*(',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal))),1)'),CONTACT_BOUNDARY1);
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,-(Interpolate(Test_u2,contact_trans)).Transformed_unit_vector(Grad_u1,
Normal)*pos_part(',g1_n,'-',gamma,'*',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal)),1)'),CONTACT_BOUNDARY1);
+ %gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,(Test_u1).Transformed_unit_vector(Grad_u1,
Normal)*pos_part(',g1_n,'-',gamma,'*(',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal))),1)'),CONTACT_BOUNDARY1);
+ %gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,-(Interpolate(Test_u2,contact_trans)).Transformed_unit_vector(Grad_u1,
Normal)*pos_part(',g1_n,'-',gamma,'*',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal)),1)'),CONTACT_BOUNDARY1);
% assembly_string1 =
strcat('Interpolate_filter(contact_trans,-(Test_u1).(Coulomb_friction_coupled_projection((',sigma_chap_u1,'),Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',f,1/',gamma,')),1)')
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,-(Test_u1).(Coulomb_friction_coupled_projection((',sigma_chap_u1,'),Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',f,1/',gamma,')),1)'),CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,-(Test_u1).(Coulomb_friction_coupled_projection((',sigma_chap_u1,'),Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',f,1/',gamma,')),1)'),CONTACT_BOUNDARY1);
% assembly_string2 =
strcat('Interpolate_filter(contact_trans,(Interpolate(Test_u2,contact_trans)).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',f,','1/',gamma,')),1)')
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,(Interpolate(Test_u2,contact_trans)).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',f,','1/',gamma,')),1)'),CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,(Interpolate(Test_u2,contact_trans)).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',f,','1/',gamma,')),1)'),CONTACT_BOUNDARY1);
end
end
% errmax = gf_model_get(md, 'test tangent matrix', 1E-9, 10, 0.0001);
diff --git a/interface/tests/matlab/test2_nitsche_large_sliding.m
b/interface/tests/matlab/test2_nitsche_large_sliding.m
index b837837..ef31366 100644
--- a/interface/tests/matlab/test2_nitsche_large_sliding.m
+++ b/interface/tests/matlab/test2_nitsche_large_sliding.m
@@ -175,9 +175,9 @@ gf_model_set(md, 'add slave contact boundary to raytracing
transformation', 'con
gf_model_set(md, 'add master contact boundary to raytracing transformation',
'contact_trans', mesh2, 'u2', CONTACT_BOUNDARY2);
if (approximation_type == 0)
gf_model_set(md, 'add filtered fem variable', 'lambda1', mflambda1,
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'-lambda1*(Test_u1.Transformed_unit_vector(Grad_u1, Normal))',
CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'Interpolate_filter(contact_trans,lambda1*(Interpolate(Test_u2,contact_trans).Transformed_unit_vector(Grad_u1,
Normal)),1)', CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
'Interpolate_filter(contact_trans,-(gamma0*element_size)*(lambda1 +
neg_part(lambda1-(1/(gamma0*element_size))*(
(u1-Interpolate(u2,contact_trans))+(X-Interpolate(X,contact_trans))
).Transformed_unit_vector(Grad_u1, Normal)))*Test_lambda1,1)',
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'-lambda1*(Test_u1.Transformed_unit_vector(Grad_u1, Normal))',
CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'Interpolate_filter(contact_trans,lambda1*(Interpolate(Test_u2,contact_trans).Transformed_unit_vector(Grad_u1,
Normal)),1)', CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
'Interpolate_filter(contact_trans,-(gamma0*element_size)*(lambda1 +
neg_part(lambda1-(1/(gamma0*element_size))*(
(u1-Interpolate(u2,contact_trans))+(X-Interpolate(X,contact_trans))
).Transformed_unit_vector(Grad_u1, Normal)))*Test_lambda1,1)',
CONTACT_BOUNDARY1);
else
gamma='(gamma0*element_size)';
@@ -188,12 +188,12 @@ gf_model_set(md, 'add slave contact boundary to
raytracing transformation', 'con
g1_t='(u1) ';
if (approximation_type == 1) coeff = ''; elseif (approximation_type ==
2) coeff = '0.5*'; end
- % gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('-',coeff,'Interpolate_filter(contact_trans,(Test_u1).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Normal,',g1_t,',',g1_n,',[0;friction_coeff;friction_coeff],1/',gamma,')),1)'),CONTACT_BOUNDARY1);
- % gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('',coeff,'Interpolate_filter(contact_trans,Interpolate(Test_u2,contact_trans).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Normal,',g1_t,',',g1_n,',[0;friction_coeff;friction_coeff],1/',gamma,')),1)'),CONTACT_BOUNDARY1);
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,',coeff,'(Test_u1).Transformed_unit_vector(Grad_u1,
Normal)*(1/',gamma,')*pos_part(',g1_n,'-',gamma,'*(',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal))),1)'),CONTACT_BOUNDARY1);
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,-',coeff,'(Interpolate(Test_u2,contact_trans)).Transformed_unit_vector(Grad_u1,
Normal)*(1/',gamma,')*pos_part(',g1_n,'-',gamma,'*',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal)),1)'),CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,
-',coeff,'(Test_u1).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY1);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim1_contact,
strcat('Interpolate_filter(contact_trans,',coeff,'(Interpolate(Test_u2,contact_trans)).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY1);
+ % gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('-',coeff,'Interpolate_filter(contact_trans,(Test_u1).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Normal,',g1_t,',',g1_n,',[0;friction_coeff;friction_coeff],1/',gamma,')),1)'),CONTACT_BOUNDARY1);
+ % gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('',coeff,'Interpolate_filter(contact_trans,Interpolate(Test_u2,contact_trans).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Normal,',g1_t,',',g1_n,',[0;friction_coeff;friction_coeff],1/',gamma,')),1)'),CONTACT_BOUNDARY1);
+ %gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,',coeff,'(Test_u1).Transformed_unit_vector(Grad_u1,
Normal)*(1/',gamma,')*pos_part(',g1_n,'-',gamma,'*(',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal))),1)'),CONTACT_BOUNDARY1);
+ %gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,-',coeff,'(Interpolate(Test_u2,contact_trans)).Transformed_unit_vector(Grad_u1,
Normal)*(1/',gamma,')*pos_part(',g1_n,'-',gamma,'*',sigma_chap_u1,'.Transformed_unit_vector(Grad_u1,
Normal)),1)'),CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,
-',coeff,'(Test_u1).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY1);
+ gf_model_set(md, 'add nonlinear term', mim1_contact,
strcat('Interpolate_filter(contact_trans,',coeff,'(Interpolate(Test_u2,contact_trans)).(Coulomb_friction_coupled_projection(',sigma_chap_u1,',Transformed_unit_vector(Grad_u1,
Normal),',g1_t,',',g1_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY1);
if (approximation_type == 2)
sigma_chap_u2=gf_model_get(md, 'Neumann term', 'u2',
CONTACT_BOUNDARY2);
@@ -202,16 +202,16 @@ gf_model_set(md, 'add slave contact boundary to
raytracing transformation', 'con
g2_n = '-((
u2-Interpolate(u1,contact_trans2)+X-Interpolate(X,contact_trans2)
).Transformed_unit_vector(Grad_u2, Normal))';
g2_t='(u2) ';
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('-',coeff,'theta*',gamma,'*((',sigma_uh2,').(',sigma_vh2,'))'),
CONTACT_BOUNDARY2);
- %gf_model_set(md, 'add nonlinear generic assembly brick',mim2_contact,
strcat('',coeff,'theta*',gamma,'*',sigma_vh2,'.(Coulomb_friction_coupled_projection(',sigma_uh2,',N2,',g2_t,',',g2_n,',[0;friction_coeff*',gamma,';friction_coeff*',gamma,'],1/',gamma,'))'),CONTACT_BOUNDARY2);
+ %gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('-',coeff,'theta*',gamma,'*((',sigma_uh2,').(',sigma_vh2,'))'),
CONTACT_BOUNDARY2);
+ %gf_model_set(md, 'add nonlinear term',mim2_contact,
strcat('',coeff,'theta*',gamma,'*',sigma_vh2,'.(Coulomb_friction_coupled_projection(',sigma_uh2,',N2,',g2_t,',',g2_n,',[0;friction_coeff*',gamma,';friction_coeff*',gamma,'],1/',gamma,'))'),CONTACT_BOUNDARY2);
gf_model_set(md, 'add raytracing transformation', 'contact_trans2',
release_dist);
gf_model_set(md, 'add slave contact boundary to raytracing
transformation', 'contact_trans2', mesh2, 'u2', CONTACT_BOUNDARY2);
gf_model_set(md, 'add master contact boundary to raytracing
transformation', 'contact_trans2', mesh1, 'u1', CONTACT_BOUNDARY1);
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('Interpolate_filter(contact_trans2,',coeff,'(Test_u2).Transformed_unit_vector(Grad_u2,
Normal)*(1/',gamma,')*pos_part(',g2_n,'-',gamma,'*',sigma_chap_u2,'.Transformed_unit_vector(Grad_u2,
Normal)),1)'),CONTACT_BOUNDARY2);
- %gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('Interpolate_filter(contact_trans2,-',coeff,'(Interpolate(Test_u1,contact_trans2)).Transformed_unit_vector(Grad_u2,
Normal)*(1/',gamma,')*pos_part(',g2_n,'-',gamma,'*',sigma_chap_u2,'.Transformed_unit_vector(Grad_u2,
Normal)),1)'),CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('Interpolate_filter(contact_trans2,
-',coeff,'(Test_u2).(Coulomb_friction_coupled_projection(',sigma_chap_u2,',Transformed_unit_vector(Grad_u2,
Normal),',g2_t,',',g2_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY2);
- gf_model_set(md, 'add nonlinear generic assembly brick', mim2_contact,
strcat('Interpolate_filter(contact_trans2,',coeff,'(Interpolate(Test_u1,contact_trans2)).(Coulomb_friction_coupled_projection(',
sigma_chap_u2,',Transformed_unit_vector(Grad_u2,
Normal),',g2_t,',',g2_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY2);
+ %gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('Interpolate_filter(contact_trans2,',coeff,'(Test_u2).Transformed_unit_vector(Grad_u2,
Normal)*(1/',gamma,')*pos_part(',g2_n,'-',gamma,'*',sigma_chap_u2,'.Transformed_unit_vector(Grad_u2,
Normal)),1)'),CONTACT_BOUNDARY2);
+ %gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('Interpolate_filter(contact_trans2,-',coeff,'(Interpolate(Test_u1,contact_trans2)).Transformed_unit_vector(Grad_u2,
Normal)*(1/',gamma,')*pos_part(',g2_n,'-',gamma,'*',sigma_chap_u2,'.Transformed_unit_vector(Grad_u2,
Normal)),1)'),CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('Interpolate_filter(contact_trans2,
-',coeff,'(Test_u2).(Coulomb_friction_coupled_projection(',sigma_chap_u2,',Transformed_unit_vector(Grad_u2,
Normal),',g2_t,',',g2_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY2);
+ gf_model_set(md, 'add nonlinear term', mim2_contact,
strcat('Interpolate_filter(contact_trans2,',coeff,'(Interpolate(Test_u1,contact_trans2)).(Coulomb_friction_coupled_projection(',
sigma_chap_u2,',Transformed_unit_vector(Grad_u2,
Normal),',g2_t,',',g2_n,',friction_coeff,1/',gamma,')),1)'),CONTACT_BOUNDARY2);
end
end
diff --git a/interface/tests/matlab/tutorial1.m
b/interface/tests/matlab/tutorial1.m
index e6ff588..77db022 100644
--- a/interface/tests/matlab/tutorial1.m
+++ b/interface/tests/matlab/tutorial1.m
@@ -26,7 +26,7 @@ mim=gf_mesh_im(m, gf_integ('IM_GAUSS_PARALLELEPIPED(2, 4)'));
% mim=gf_mesh_im(m, gf_integ('IM_EXACT_PARALLELEPIPED(2)')); % not allowed
with the high level generic assembly
border = gf_mesh_get(m,'outer faces');
-gf_mesh_set(m, 'region', 42, border); % create the region (:#(B42
+gf_mesh_set(m, 'region', 42, border); % create the region (:#42
% the boundary edges appears in red
gf_plot_mesh(m, 'regions', [42], 'vertices','on','convexes','on');
@@ -34,7 +34,7 @@ gf_plot_mesh(m, 'regions', [42],
'vertices','on','convexes','on');
md=gf_model('real');
gf_model_set(md, 'add fem variable', 'u', mf);
-% gf_model_set(md, 'add linear generic assembly brick', mim,
'Grad_u.Grad_Test_u');
+% gf_model_set(md, 'add linear term', mim, 'Grad_u.Grad_Test_u');
gf_model_set(md, 'add Laplacian brick', mim, 'u');
R=gf_mesh_fem_get(mf, 'eval', {'(x-.5).^2 + (y-.5).^2 + x/5 - y/3'});
gf_model_set(md, 'add initialized fem data', 'DirichletData', mf, R);
diff --git a/interface/tests/python/demo_crack.py
b/interface/tests/python/demo_crack.py
index 57a1524..8388d2f 100644
--- a/interface/tests/python/demo_crack.py
+++ b/interface/tests/python/demo_crack.py
@@ -157,13 +157,13 @@ if variant == 5 or variant == 6: # Penalisation of the
jump over the first crack
mim_bound1 = gf.MeshIm('levelset', mls, 'boundary(a)',
gf.Integ('IM_STRUCTURED_COMPOSITE(IM_TRIANGLE(6),3)'))
#gf.asm_generic(mim_bound1, 0, '1', -1) # length of the crack
- md.add_linear_generic_assembly_brick\
+ md.add_linear_term\
(mim_bound1,
'1e17*(Xfem_plus(u)-Xfem_minus(u)).(Xfem_plus(Test_u)-Xfem_minus(Test_u))')
if variant == 4 or variant == 6: # Penalisation of the jump over the second
crack
mim_bound2 = gf.MeshIm('levelset', mls, 'boundary(b)',
gf.Integ('IM_STRUCTURED_COMPOSITE(IM_TRIANGLE(6),3)'))
- md.add_linear_generic_assembly_brick\
+ md.add_linear_term\
(mim_bound2,
'1e17*(Xfem_plus(u)-Xfem_minus(u)).(Xfem_plus(Test_u)-Xfem_minus(Test_u))')
# Assembly of the linear system and solve:
diff --git a/interface/tests/python/demo_laplacian_DG.py
b/interface/tests/python/demo_laplacian_DG.py
index dccc575..921f769 100644
--- a/interface/tests/python/demo_laplacian_DG.py
+++ b/interface/tests/python/demo_laplacian_DG.py
@@ -143,7 +143,7 @@ jump = "((u-Interpolate(u,neighbour_elt))*Normal)"
test_jump = "((Test_u-Interpolate(Test_u,neighbour_elt))*Normal)"
grad_mean = "((Grad_u+Interpolate(Grad_u,neighbour_elt))*0.5)"
grad_test_mean = "((Grad_Test_u+Interpolate(Grad_Test_u,neighbour_elt))*0.5)"
-md.add_linear_generic_assembly_brick(mim,
"-(({F}).({G}))-(({H}).({I}))+alpha*(({J}).({K}))".format(F=grad_mean,
G=test_jump, H=jump, I=grad_test_mean, J=jump, K=test_jump), INNER_FACES);
+md.add_linear_term(mim,
"-(({F}).({G}))-(({H}).({I}))+alpha*(({J}).({K}))".format(F=grad_mean,
G=test_jump, H=jump, I=grad_test_mean, J=jump, K=test_jump), INNER_FACES);
gf.memstats()
# md.listvar()
diff --git a/interface/tests/python/demo_large_sliding_contact.py
b/interface/tests/python/demo_large_sliding_contact.py
index 3fd2cd3..be4b741 100644
--- a/interface/tests/python/demo_large_sliding_contact.py
+++ b/interface/tests/python/demo_large_sliding_contact.py
@@ -258,18 +258,18 @@ if direct_generic_assembly: # Direct use of high-level
generic assembly
md.add_master_contact_boundary_to_raytracing_transformation("contact_trans",
mesh2, "u", CONTACT_BOUNDARY2)
md.add_rigid_obstacle_to_raytracing_transformation("contact_trans", "z+5",
N)
- md.add_nonlinear_generic_assembly_brick(mim1_contact, "-lambda1.Test_u1",
CONTACT_BOUNDARY1)
- md.add_nonlinear_generic_assembly_brick(mim1_contact,
"Interpolate_filter(contact_trans, lambda1.Interpolate(Test_u,contact_trans),
1)", CONTACT_BOUNDARY1)
- md.add_nonlinear_generic_assembly_brick(mim1_contact,
"-(1/r)*lambda1.Test_lambda1", CONTACT_BOUNDARY1)
- md.add_nonlinear_generic_assembly_brick(mim1_contact,
"Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1,
(Interpolate(X,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1, Normal),
f, r).Test_lambda1, 2)", CONTACT_BOUNDARY1)
- md.add_nonlinear_generic_assembly_brick(mim1_contact,
"Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1,
Normal), f, r).Test_lambda1, 1)", CONTACT_BOUNDARY1)
+ md.add_nonlinear_term(mim1_contact, "-lambda1.Test_u1", CONTACT_BOUNDARY1)
+ md.add_nonlinear_term(mim1_contact, "Interpolate_filter(contact_trans,
lambda1.Interpolate(Test_u,contact_trans), 1)", CONTACT_BOUNDARY1)
+ md.add_nonlinear_term(mim1_contact, "-(1/r)*lambda1.Test_lambda1",
CONTACT_BOUNDARY1)
+ md.add_nonlinear_term(mim1_contact, "Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1,
(Interpolate(X,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1, Normal),
f, r).Test_lambda1, 2)", CONTACT_BOUNDARY1)
+ md.add_nonlinear_term(mim1_contact, "Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda1,
Transformed_unit_vector(Grad_u1, Normal), u1-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u1).Transformed_unit_vector(Grad_u1,
Normal), f, r).Test_lambda1, 1)", CONTACT_BOUNDARY1)
if two_meshes and self_contact:
- md.add_nonlinear_generic_assembly_brick(mim2_contact, "-lambda2.Test_u2",
CONTACT_BOUNDARY2)
- md.add_nonlinear_generic_assembly_brick(mim2_contact,
"Interpolate_filter(contact_trans, lambda2.Interpolate(Test_u,contact_trans),
1)", CONTACT_BOUNDARY2)
- md.add_nonlinear_generic_assembly_brick(mim2_contact,
"-(1/r)*lambda2.Test_lambda2", CONTACT_BOUNDARY2)
- md.add_nonlinear_generic_assembly_brick(mim2_contact,
"Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2,
(Interpolate(X,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2, Normal),
f, r).Test_lambda2, 2)", CONTACT_BOUNDARY2)
- md.add_nonlinear_generic_assembly_brick(mim2_contact,
"Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2,
Normal), f, r).Test_lambda2, 1)", CONTACT_BOUNDARY2)
+ md.add_nonlinear_term(mim2_contact, "-lambda2.Test_u2", CONTACT_BOUNDARY2)
+ md.add_nonlinear_term(mim2_contact, "Interpolate_filter(contact_trans,
lambda2.Interpolate(Test_u,contact_trans), 1)", CONTACT_BOUNDARY2)
+ md.add_nonlinear_term(mim2_contact, "-(1/r)*lambda2.Test_lambda2",
CONTACT_BOUNDARY2)
+ md.add_nonlinear_term(mim2_contact, "Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2,
(Interpolate(X,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2, Normal),
f, r).Test_lambda2, 2)", CONTACT_BOUNDARY2)
+ md.add_nonlinear_term(mim2_contact, "Interpolate_filter(contact_trans,
(1/r)*Coulomb_friction_coupled_projection(lambda2,
Transformed_unit_vector(Grad_u2, Normal), u2-Interpolate(u,contact_trans),
(Interpolate(X,contact_trans)+Interpolate(u,contact_trans)-X-u2).Transformed_unit_vector(Grad_u2,
Normal), f, r).Test_lambda2, 1)", CONTACT_BOUNDARY2)
u_group = "u"
contact_trans = "contact_trans"
diff --git a/interface/tests/python/demo_navier_stokes.py
b/interface/tests/python/demo_navier_stokes.py
index 8cf9e18..6dc046c 100644
--- a/interface/tests/python/demo_navier_stokes.py
+++ b/interface/tests/python/demo_navier_stokes.py
@@ -109,9 +109,9 @@ md.add_initialized_data("dt", [dt])
md.add_initialized_data("nu", [nu])
md.add_Dirichlet_condition_with_multipliers(mim, "p", mfp, IN_RG, "p_in")
-md.add_nonlinear_generic_assembly_brick\
+md.add_nonlinear_term\
(mim, "1/dt*(v-v0).Test_v + (Grad_v0*v0).Test_v + nu*Grad_v:Grad_Test_v -
f.Test_v")
-md.add_nonlinear_generic_assembly_brick\
+md.add_nonlinear_term\
(mim, "Grad_p.Grad_Test_p + 1/dt*Trace(Grad_v)*Test_p")
mmat_v = gf.asm_mass_matrix(mim, mfv)
diff --git a/interface/tests/python/demo_nonlinear_elasticity.py
b/interface/tests/python/demo_nonlinear_elasticity.py
index 6d2c6ab..b149050 100644
--- a/interface/tests/python/demo_nonlinear_elasticity.py
+++ b/interface/tests/python/demo_nonlinear_elasticity.py
@@ -93,20 +93,20 @@ else:
_expr_2 =
"{K_over_2}*sqr(log({J}))+{mu_over_2}*(pow(Det{be},-1./3.)*Trace{be}-3)"\
.format(K_over_2=K/2., J=_J_, mu_over_2=mu/2., be=_be_)
- md.add_nonlinear_generic_assembly_brick(mim, _expr_2);
+ md.add_nonlinear_term(mim, _expr_2);
-# md.add_nonlinear_generic_assembly_brick(mim,
'sqr(Trace(Green_Lagrangian(Id(meshdim)+Grad_u)))/8 +
Norm_sqr(Green_Lagrangian(Id(meshdim)+Grad_u))/4')
-# md.add_nonlinear_generic_assembly_brick(mim,
'((Id(meshdim)+Grad_u)*(params(1)*Trace(Green_Lagrangian(Id(meshdim)+Grad_u))*Id(meshdim)+2*params(2)*Green_Lagrangian(Id(meshdim)+Grad_u))):Grad_Test_u')
-# md.add_nonlinear_generic_assembly_brick(mim,
'Saint_Venant_Kirchhoff_potential(Grad_u,params)')
+# md.add_nonlinear_term(mim,
'sqr(Trace(Green_Lagrangian(Id(meshdim)+Grad_u)))/8 +
Norm_sqr(Green_Lagrangian(Id(meshdim)+Grad_u))/4')
+# md.add_nonlinear_term(mim,
'((Id(meshdim)+Grad_u)*(params(1)*Trace(Green_Lagrangian(Id(meshdim)+Grad_u))*Id(meshdim)+2*params(2)*Green_Lagrangian(Id(meshdim)+Grad_u))):Grad_Test_u')
+# md.add_nonlinear_term(mim, 'Saint_Venant_Kirchhoff_potential(Grad_u,params)')
if (incompressible):
mfp = gf.MeshFem(m,1)
mfp.set_classical_discontinuous_fem(1)
md.add_fem_variable('p', mfp)
md.add_finite_strain_incompressibility_brick(mim, 'u', 'p')
- # md.add_nonlinear_generic_assembly brick(mim,
'p*(1-Det(Id(meshdim)+Grad_u))')
- # md.add_nonlinear_generic_assembly_brick(mim,
'-p*Det(Id(meshdim)+Grad_u)*(Inv(Id(meshdim)+Grad_u))'':Grad_Test_u +
Test_p*(1-Det(Id(meshdim)+Grad_u))')
+ # md.add_nonlinear_term(mim, 'p*(1-Det(Id(meshdim)+Grad_u))')
+ # md.add_nonlinear_term(mim,
'-p*Det(Id(meshdim)+Grad_u)*(Inv(Id(meshdim)+Grad_u))'':Grad_Test_u +
Test_p*(1-Det(Id(meshdim)+Grad_u))')
if (dirichlet_version == 1):
diff --git
a/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
b/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
index 1b00445..cf6b44c 100644
--- a/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
+++ b/interface/tests/python/demo_thermo_elasticity_electrical_coupling.py
@@ -160,7 +160,7 @@ md.add_initialized_data('eps', [epsilon])
md.add_initialized_data('rho_0', [rho_0])
md.add_initialized_data('alpha', [alpha])
md.add_initialized_data('T0', [T0])
-md.add_nonlinear_generic_assembly_brick(mim, sigmaeps+'*(Grad_V.Grad_Test_V)')
+md.add_nonlinear_term(mim, sigmaeps+'*(Grad_V.Grad_Test_V)')
md.add_Dirichlet_condition_with_multipliers(mim, 'V', elements_degree-1,
RIGHT_BOUND)
md.add_initialized_data('DdataV', [0.1])
md.add_Dirichlet_condition_with_multipliers(mim, 'V', elements_degree-1,
LEFT_BOUND, 'DdataV')
@@ -180,11 +180,11 @@ md.add_Fourier_Robin_brick(mim, 'theta', 'Deps',
BOTTOM_BOUND)
md.add_source_term_brick(mim, 'theta', 'Depsairt', BOTTOM_BOUND)
# Joule heating term
-md.add_nonlinear_generic_assembly_brick(mim,
'-'+sigmaeps+'*Norm_sqr(Grad_V)*Test_theta')
+md.add_nonlinear_term(mim, '-'+sigmaeps+'*Norm_sqr(Grad_V)*Test_theta')
# Thermal expansion term
md.add_initialized_data('beta', [alpha_th*E/(1-2*nu)])
-md.add_linear_generic_assembly_brick(mim, 'beta*(T0-theta)*Trace(Grad_Test_u)')
+md.add_linear_term(mim, 'beta*(T0-theta)*Trace(Grad_Test_u)')
#
diff --git a/interface/tests/python/demo_wheel_contact.py
b/interface/tests/python/demo_wheel_contact.py
index 0aea7a0..3dc5071 100644
--- a/interface/tests/python/demo_wheel_contact.py
+++ b/interface/tests/python/demo_wheel_contact.py
@@ -126,9 +126,9 @@ md.add_Dirichlet_condition_with_multipliers(mim2, 'u2',
elements_degree-1, BOTTO
md.add_initialized_data('gamma0', [gamma0])
md.add_interpolate_transformation_from_expression('Proj1', mesh1, mesh2,
'[X(1);0]')
md.add_filtered_fem_variable('lambda1', mflambda_C, CONTACT_BOUND)
-md.add_nonlinear_generic_assembly_brick(mim1c, 'lambda1*(Test_u1.[0;1])'
+md.add_nonlinear_term(mim1c, 'lambda1*(Test_u1.[0;1])'
'-lambda1*(Interpolate(Test_u2,Proj1).[0;1])', CONTACT_BOUND)
-md.add_nonlinear_generic_assembly_brick(mim1c,
'-(gamma0*element_size)*(lambda1 +
neg_part(lambda1+(1/(gamma0*element_size))*((u1-Interpolate(u2,Proj1)+X-Interpolate(X,Proj1)).[0;1])))*Test_lambda1',
CONTACT_BOUND);
+md.add_nonlinear_term(mim1c, '-(gamma0*element_size)*(lambda1 +
neg_part(lambda1+(1/(gamma0*element_size))*((u1-Interpolate(u2,Proj1)+X-Interpolate(X,Proj1)).[0;1])))*Test_lambda1',
CONTACT_BOUND);
# Prescribed force in the hole
if (Dirichlet_version):
@@ -138,7 +138,7 @@ else:
md.add_filtered_fem_variable('lambda_D', mflambda, HOLE_BOUND)
md.add_initialized_data('F', [applied_force/(8*2*np.pi)])
md.add_variable('alpha_D', 1)
- md.add_linear_generic_assembly_brick(mim1, '-lambda_D.Test_u1 +
(alpha_D*[0;1] - u1).Test_lambda_D + (lambda_D.[0;1] + F)*Test_alpha_D +
1E-6*alpha_D*Test_alpha_D', HOLE_BOUND)
+ md.add_linear_term(mim1, '-lambda_D.Test_u1 + (alpha_D*[0;1] -
u1).Test_lambda_D + (lambda_D.[0;1] + F)*Test_alpha_D +
1E-6*alpha_D*Test_alpha_D', HOLE_BOUND)
# The small penalization 1E-6*alpha_D*Test_alpha_D seems necessary to have
# a convergence in all cases. Why ?
diff --git a/src/getfem/getfem_models.h b/src/getfem/getfem_models.h
index 7da65d1..0172c37 100644
--- a/src/getfem/getfem_models.h
+++ b/src/getfem/getfem_models.h
@@ -1523,12 +1523,21 @@ namespace getfem {
are not allowed for non-coercive problems.
`brickname` is an otpional name for the brick.
*/
- size_type APIDECL add_linear_generic_assembly_brick
+ size_type APIDECL add_linear_term
(model &md, const mesh_im &mim, const std::string &expr,
size_type region = size_type(-1), bool is_sym = false,
bool is_coercive = false, std::string brickname = "",
bool return_if_nonlin = false);
+ inline size_type APIDECL add_linear_generic_assembly_brick
+ (model &md, const mesh_im &mim, const std::string &expr,
+ size_type region = size_type(-1), bool is_sym = false,
+ bool is_coercive = false, std::string brickname = "",
+ bool return_if_nonlin = false) {
+ return add_linear_term(md, mim, expr, region, is_sym,
+ is_coercive, brickname, return_if_nonlin);
+ }
+
/** Add a nonlinear term given by the assembly string `expr` which will
be assembled in region `region` and with the integration method `mim`.
The expression can describe a potential or a weak form. Second order
@@ -1540,11 +1549,19 @@ namespace getfem {
are not allowed for non-coercive problems.
`brickname` is an otpional name for the brick.
*/
- size_type APIDECL add_nonlinear_generic_assembly_brick
+ size_type APIDECL add_nonlinear_term
(model &md, const mesh_im &mim, const std::string &expr,
size_type region = size_type(-1), bool is_sym = false,
bool is_coercive = false, std::string brickname = "");
+ inline size_type APIDECL add_nonlinear_generic_assembly_brick
+ (model &md, const mesh_im &mim, const std::string &expr,
+ size_type region = size_type(-1), bool is_sym = false,
+ bool is_coercive = false, std::string brickname = "") {
+ return add_nonlinear_term(md, mim, expr, region,
+ is_sym, is_coercive, brickname);
+ }
+
/** Add a source term given by the assembly string `expr` which will
be assembled in region `region` and with the integration method `mim`.
@@ -1554,12 +1571,21 @@ namespace getfem {
derivated with respect to all variables.
`brickname` is an otpional name for the brick.
*/
- size_type APIDECL add_source_term_generic_assembly_brick
+ size_type APIDECL add_source_term
(model &md, const mesh_im &mim, const std::string &expr,
size_type region = size_type(-1), std::string brickname = "",
std::string directvarname = std::string(),
const std::string &directdataname = std::string(),
bool return_if_nonlin = false);
+ inline size_type APIDECL add_source_term_generic_assembly_brick
+ (model &md, const mesh_im &mim, const std::string &expr,
+ size_type region = size_type(-1), std::string brickname = "",
+ std::string directvarname = std::string(),
+ const std::string &directdataname = std::string(),
+ bool return_if_nonlin = false) {
+ return add_source_term(md, mim, expr, region, brickname,
+ directvarname, directdataname, return_if_nonlin);
+ }
/** Add a Laplacian term on the variable `varname` (in fact with a minus :
:math:`-\text{div}(\nabla u)`). If it is a vector
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 7e16876..c2c7e81 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -3369,7 +3369,7 @@ model_complex_plain_vector &
return true;
}
- size_type add_source_term_generic_assembly_brick
+ size_type add_source_term
(model &md, const mesh_im &mim, const std::string &expr, size_type region,
std::string brickname, std::string directvarname,
const std::string &directdataname, bool return_if_nonlin) {
@@ -3506,7 +3506,7 @@ model_complex_plain_vector &
return true;
}
- size_type add_linear_generic_assembly_brick
+ size_type add_linear_term
(model &md, const mesh_im &mim, const std::string &expr, size_type region,
bool is_sym, bool is_coercive, std::string brickname,
bool return_if_nonlin) {
@@ -3592,7 +3592,7 @@ model_complex_plain_vector &
};
- size_type add_nonlinear_generic_assembly_brick
+ size_type add_nonlinear_term
(model &md, const mesh_im &mim, const std::string &expr, size_type region,
bool is_sym, bool is_coercive, std::string brickname) {
@@ -3862,8 +3862,8 @@ model_complex_plain_vector &
expr = "Grad_"+varname+".Grad_"+test_varname;
else
expr = "Grad_"+varname+":Grad_"+test_varname;
- return add_linear_generic_assembly_brick(md, mim, expr, region, true,
- true, "Laplacian", false);
+ return add_linear_term(md, mim, expr, region, true, true,
+ "Laplacian", false);
}
}
@@ -3914,10 +3914,10 @@ model_complex_plain_vector &
expr = "(("+dataname+")*Grad_"+varname+"):Grad_"+test_varname;
}
}
- size_type ib = add_linear_generic_assembly_brick
+ size_type ib = add_linear_term
(md, mim, expr, region, true, true, "Generic elliptic", true);
if (ib == size_type(-1))
- ib = add_nonlinear_generic_assembly_brick
+ ib = add_nonlinear_term
(md, mim, expr, region, false, false,
"Generic elliptic (nonlinear)");
return ib;
@@ -4075,7 +4075,7 @@ model_complex_plain_vector &
size_type ib = add_source_term_generic_assembly_brick
(md, mim, expr, region, "Source term", varname, directdataname, true);
if (ib == size_type(-1)) {
- ib = add_nonlinear_generic_assembly_brick
+ ib = add_nonlinear_term
(md, mim, "-("+expr+")", region, false, false,
"Source term (nonlinear)");
if (directdataname.size())
@@ -4989,11 +4989,11 @@ model_complex_plain_vector &
// cout << "is_lin : " << int(is_lin) << endl;
if (is_lin) {
- return add_linear_generic_assembly_brick
+ return add_linear_term
(md, mim, expr, region, false, false,
"Dirichlet condition with Nitsche's method");
} else {
- return add_nonlinear_generic_assembly_brick
+ return add_nonlinear_term
(md, mim, expr, region, false, false,
"Dirichlet condition with Nitsche's method");
}
@@ -5024,11 +5024,11 @@ model_complex_plain_vector &
+derivative_Neumann+")";
}
if (is_lin) {
- return add_linear_generic_assembly_brick
+ return add_linear_term
(md, mim, expr, region, false, false,
"Dirichlet condition with Nitsche's method");
} else {
- return add_nonlinear_generic_assembly_brick
+ return add_nonlinear_term
(md, mim, expr, region, false, false,
"Dirichlet condition with Nitsche's method");
}
@@ -5059,11 +5059,11 @@ model_complex_plain_vector &
+derivative_Neumann+"))";
}
if (is_lin) {
- return add_linear_generic_assembly_brick
+ return add_linear_term
(md, mim, expr, region, false, false,
"Dirichlet condition with Nitsche's method");
} else {
- return add_nonlinear_generic_assembly_brick
+ return add_nonlinear_term
(md, mim, expr, region, false, false,
"Dirichlet condition with Nitsche's method");
}
@@ -5463,10 +5463,10 @@ model_complex_plain_vector &
std::string expr = "Grad_"+varname+".Grad_"+test_varname
+" + sqr("+dataexpr+")*"+varname+"*"+test_varname;
- size_type ib = add_linear_generic_assembly_brick
+ size_type ib = add_linear_term
(md, mim, expr, region, true, true, "Helmholtz", true);
if (ib == size_type(-1))
- ib = add_nonlinear_generic_assembly_brick
+ ib = add_nonlinear_term
(md, mim, expr, region, false, false, "Helmholtz (nonlinear)");
return ib;
}
@@ -5582,10 +5582,10 @@ model_complex_plain_vector &
std::string test_varname
= "Test_" + sup_previous_and_dot_to_varname(varname);
std::string expr = "(("+dataexpr+")*"+varname+")."+test_varname;
- size_type ib = add_linear_generic_assembly_brick
+ size_type ib = add_linear_term
(md, mim, expr, region, true, true, "Fourier-Robin", true);
if (ib == size_type(-1))
- ib = add_nonlinear_generic_assembly_brick
+ ib = add_nonlinear_term
(md, mim, expr, region, false, false, "Fourier-Robin (nonlinear)");
return ib;
}
@@ -6088,10 +6088,10 @@ model_complex_plain_vector &
bool is_lin = workspace.used_variables(vl, vl_test1, vl_test2, dl, 2);
if (is_lin) {
- return add_linear_generic_assembly_brick
+ return add_linear_term
(md, mim, expr, region, false, false, "Linearized isotropic
elasticity");
} else {
- return add_nonlinear_generic_assembly_brick
+ return add_nonlinear_term
(md, mim, expr, region, false, false,
"Linearized isotropic elasticity (with nonlinear dependance)");
}
@@ -6122,10 +6122,10 @@ model_complex_plain_vector &
bool is_lin = workspace.used_variables(vl, vl_test1, vl_test2, dl, 2);
if (is_lin) {
- return add_linear_generic_assembly_brick
+ return add_linear_term
(md, mim, expr, region, false, false, "Linearized isotropic
elasticity");
} else {
- return add_nonlinear_generic_assembly_brick
+ return add_nonlinear_term
(md, mim, expr, region, false, false,
"Linearized isotropic elasticity (with nonlinear dependance)");
}
@@ -6330,10 +6330,10 @@ model_complex_plain_vector &
else
expr = "-"+multname+"*Div_"+test_varname + "-"+test_multname
+"*Div_"+varname;
- size_type ib = add_linear_generic_assembly_brick
+ size_type ib = add_linear_term
(md, mim, expr, region, true, true, "Linear incompressibility", true);
if (ib == size_type(-1))
- ib = add_nonlinear_generic_assembly_brick
+ ib = add_nonlinear_term
(md, mim, expr, region, false, false,
"Linear incompressibility (with nonlinear dependance)");
return ib;
@@ -6471,10 +6471,10 @@ model_complex_plain_vector &
expr ="(("+dataexpr_rho+")*"+varname+")."+test_varname;
else
expr = varname+"."+test_varname;
- size_type ib = add_linear_generic_assembly_brick
+ size_type ib = add_linear_term
(md, mim, expr, region, true, true, "Mass matrix", true);
if (ib == size_type(-1))
- ib = add_nonlinear_generic_assembly_brick
+ ib = add_nonlinear_term
(md, mim, expr, region, false, false, "Mass matrix (nonlinear)");
return ib;
}
diff --git a/tests/laplacian_with_bricks.cc b/tests/laplacian_with_bricks.cc
index bb63521..b0b03c2 100644
--- a/tests/laplacian_with_bricks.cc
+++ b/tests/laplacian_with_bricks.cc
@@ -236,8 +236,7 @@ bool laplacian_problem::solve(void) {
std::string expr = "-("+grad_mean+").("+test_jump+") "
"- ("+jump+").("+grad_test_mean+")"
"+ alpha*("+jump+").("+test_jump+")";
- getfem::add_linear_generic_assembly_brick(model, mim, expr,
- INNER_FACES, true);
+ getfem::add_linear_term(model, mim, expr, INNER_FACES, true);
}
model.listvar(cout);
diff --git a/tests/test_continuation.cc b/tests/test_continuation.cc
index 92f49e8..3542af4 100644
--- a/tests/test_continuation.cc
+++ b/tests/test_continuation.cc
@@ -101,8 +101,7 @@ bool state_problem::cont(plain_vector &U) {
getfem::add_Laplacian_brick(model, mim, "u");
std::string f = "u-lambda*exp(u)", dfdu = "1-lambda*exp(u)";
model.add_fixed_size_data("lambda", 1);
- getfem::add_nonlinear_generic_assembly_brick(model, mim,
- "(u-lambda*exp(u))*Test_u");
+ getfem::add_nonlinear_term(model, mim, "(u-lambda*exp(u))*Test_u");
// Initialise the continuation
diff --git a/tests/thermo_elasticity_electrical_coupling.cc
b/tests/thermo_elasticity_electrical_coupling.cc
index 9ce4662..fdd34a9 100644
--- a/tests/thermo_elasticity_electrical_coupling.cc
+++ b/tests/thermo_elasticity_electrical_coupling.cc
@@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
md.add_initialized_scalar_data("rho_0", rho_0);
md.add_initialized_scalar_data("alpha", alpha);
md.add_initialized_scalar_data("T0", T0);
- getfem::add_nonlinear_generic_assembly_brick
+ getfem::add_nonlinear_term
(md, mim, sigmaeps+"*(Grad_V.Grad_Test_V)");
getfem::add_Dirichlet_condition_with_multipliers
(md, mim, "V", bgeot::dim_type(elements_degree-1), RIGHT_BOUND);
@@ -232,12 +232,12 @@ int main(int argc, char *argv[]) {
// Joule heating term
- getfem::add_nonlinear_generic_assembly_brick
+ getfem::add_nonlinear_term
(md, mim, "-"+sigmaeps+"*Norm_sqr(Grad_V)*Test_theta");
// Thermal expansion term
md.add_initialized_scalar_data("beta", alpha_th*E/(1-2*nu));
- getfem::add_linear_generic_assembly_brick
+ getfem::add_linear_term
(md, mim, "beta*(T0-theta)*Trace(Grad_Test_u)");