[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] [getfem-commits] branch master updated: Rename brick ad
From: |
Konstantinos Poulios |
Subject: |
[Getfem-commits] [getfem-commits] branch master updated: Rename brick addition functions and new interface function for lumped mass brick |
Date: |
Thu, 22 Apr 2021 13:04:48 -0400 |
This is an automated email from the git hooks/post-receive script.
logari81 pushed a commit to branch master
in repository getfem.
The following commit(s) were added to refs/heads/master by this push:
new 0241496 Rename brick addition functions and new interface function
for lumped mass brick
0241496 is described below
commit 0241496a72624aca5f7f6a4f3725accee863d46e
Author: Tetsuo Koyama <tkoyama010@gmail.com>
AuthorDate: Thu Apr 22 18:59:19 2021 +0200
Rename brick addition functions and new interface function for lumped mass
brick
---
.../source/userdoc/model_linear_elasticity.rst | 4 +--
interface/src/gf_model_set.cc | 35 ++++++++++++++++++----
interface/tests/matlab-octave/demo_elasticity.m | 4 +--
interface/tests/python/demo_wave_equation.py | 11 +++++++
src/getfem/getfem_models.h | 6 ++--
src/getfem_models.cc | 12 ++++----
6 files changed, 53 insertions(+), 19 deletions(-)
diff --git a/doc/sphinx/source/userdoc/model_linear_elasticity.rst
b/doc/sphinx/source/userdoc/model_linear_elasticity.rst
index 6ebbf1f..ca28a87 100644
--- a/doc/sphinx/source/userdoc/model_linear_elasticity.rst
+++ b/doc/sphinx/source/userdoc/model_linear_elasticity.rst
@@ -56,13 +56,13 @@ representing the |Lame| coefficients.
The function which adds this brick to a model and parametrized with Young
modulus and Poisson ratio is::
- ind_brick = getfem::add_isotropic_linearized_elasticity_brick_pstrain
+ ind_brick = getfem::add_isotropic_linearized_elasticity_pstrain_brick
(md, mim, varname, data_E, data_nu, region = size_type(-1));
This brick represent a plane strain approximation when it is applied to a 2D
mesh (and a standard model on a 3D mesh). In order to obtain a plane stress
approximation for 2D meshes, one can use::
- ind_brick = getfem::add_isotropic_linearized_elasticity_brick_pstress
+ ind_brick = getfem::add_isotropic_linearized_elasticity_pstress_brick
(md, mim, varname, data_E, data_nu, region = size_type(-1));
For 3D meshes, the two previous bricks give the same result.
diff --git a/interface/src/gf_model_set.cc b/interface/src/gf_model_set.cc
index 288572d..2c90b65 100644
--- a/interface/src/gf_model_set.cc
+++ b/interface/src/gf_model_set.cc
@@ -1978,7 +1978,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
out.pop().from_integer(int(ind));
);
- /*@SET ind = ('add isotropic linearized elasticity brick pstrain', @tmim
mim, @str varname, @str data_E, @str data_nu[, @int region])
+ /*@SET ind = ('add isotropic linearized elasticity pstrain brick', @tmim
mim, @str varname, @str data_E, @str data_nu[, @int region])
Add an isotropic linearized elasticity term to the model relatively to
the variable `varname`. `data_E` and `data_nu` should
contain the Young modulus and Poisson ratio, respectively.
@@ -1990,7 +1990,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
standard model.
Return the brick index in the model.@*/
sub_command
- ("add isotropic linearized elasticity brick pstrain", 4, 5, 0, 1,
+ ("add isotropic linearized elasticity pstrain brick", 4, 5, 0, 1,
getfem::mesh_im *mim = to_meshim_object(in.pop());
std::string varname = in.pop().to_string();
std::string data_E = in.pop().to_string();
@@ -1998,14 +1998,14 @@ void gf_model_set(getfemint::mexargs_in& m_in,
size_type region = size_type(-1);
if (in.remaining()) region = in.pop().to_integer();
size_type ind
- = getfem::add_isotropic_linearized_elasticity_brick_pstrain
+ = getfem::add_isotropic_linearized_elasticity_pstrain_brick
(*md, *mim, varname, data_E, data_nu, region)
+ config::base_index();
workspace().set_dependence(md, mim);
out.pop().from_integer(int(ind));
);
- /*@SET ind = ('add isotropic linearized elasticity brick pstress', @tmim
mim, @str varname, @str data_E, @str data_nu[, @int region])
+ /*@SET ind = ('add isotropic linearized elasticity pstress brick', @tmim
mim, @str varname, @str data_E, @str data_nu[, @int region])
Add an isotropic linearized elasticity term to the model relatively to
the variable `varname`. `data_E` and `data_nu` should
contain the Young modulus and Poisson ratio, respectively.
@@ -2017,7 +2017,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
standard model.
Return the brick index in the model.@*/
sub_command
- ("add isotropic linearized elasticity brick pstress", 4, 5, 0, 1,
+ ("add isotropic linearized elasticity pstress brick", 4, 5, 0, 1,
getfem::mesh_im *mim = to_meshim_object(in.pop());
std::string varname = in.pop().to_string();
std::string data_E = in.pop().to_string();
@@ -2025,7 +2025,7 @@ void gf_model_set(getfemint::mexargs_in& m_in,
size_type region = size_type(-1);
if (in.remaining()) region = in.pop().to_integer();
size_type ind
- = getfem::add_isotropic_linearized_elasticity_brick_pstress
+ = getfem::add_isotropic_linearized_elasticity_pstress_brick
(*md, *mim, varname, data_E, data_nu, region)
+ config::base_index();
workspace().set_dependence(md, mim);
@@ -2816,6 +2816,29 @@ void gf_model_set(getfemint::mexargs_in& m_in,
);
+ /*@SET ind = ('add lumped mass for first order brick', @tmim mim, @str
varname[, @str dataexpr_rho[, @int region]])
+ Add lumped mass for first order term to the model relatively to the
variable `varname`.
+ If specified, the data `dataexpr_rho` is the
+ density (1 if omitted). `region` is an optional mesh region on
+ which the term is added. If it is not specified, it
+ is added on the whole mesh. Return the brick index in the model.@*/
+ sub_command
+ ("add lumped mass for first order brick", 2, 4, 0, 1,
+ getfem::mesh_im *mim = to_meshim_object(in.pop());
+ std::string varname = in.pop().to_string();
+ std::string dataname_rho;
+ if (in.remaining()) dataname_rho = in.pop().to_string();
+ size_type region = size_type(-1);
+ if (in.remaining()) region = in.pop().to_integer();
+ size_type ind
+ = getfem::add_lumped_mass_for_first_order_brick
+ (*md, *mim, varname, dataname_rho, region)
+ + config::base_index();
+ workspace().set_dependence(md, mim);
+ out.pop().from_integer(int(ind));
+ );
+
+
/*@SET ('shift variables for time integration')
Function used to shift the variables of a model to the data
corresponding of ther value on the previous time step for time
diff --git a/interface/tests/matlab-octave/demo_elasticity.m
b/interface/tests/matlab-octave/demo_elasticity.m
index 74b51a9..f71f7fd 100644
--- a/interface/tests/matlab-octave/demo_elasticity.m
+++ b/interface/tests/matlab-octave/demo_elasticity.m
@@ -93,11 +93,11 @@ if (option == 1)
elseif (option == 2)
gf_model_set(md, 'add initialized data', 'E', [E]);
gf_model_set(md, 'add initialized data', 'nu', [nu]);
- gf_model_set(md, 'add isotropic linearized elasticity brick pstrain', mim,
'u', 'E', 'nu');
+ gf_model_set(md, 'add isotropic linearized elasticity pstrain brick', mim,
'u', 'E', 'nu');
elseif (option == 3)
gf_model_set(md, 'add initialized data', 'E', [E]);
gf_model_set(md, 'add initialized data', 'nu', [nu]);
- gf_model_set(md, 'add isotropic linearized elasticity brick pstress', mim,
'u', 'E', 'nu');
+ gf_model_set(md, 'add isotropic linearized elasticity pstress brick', mim,
'u', 'E', 'nu');
end
if (incompressible)
diff --git a/interface/tests/python/demo_wave_equation.py
b/interface/tests/python/demo_wave_equation.py
index 5a5e437..c5be7d7 100644
--- a/interface/tests/python/demo_wave_equation.py
+++ b/interface/tests/python/demo_wave_equation.py
@@ -57,10 +57,13 @@ V0 = 0.*U0
md=gf.Model('real');
md.add_fem_variable('u', mf);
md.add_fem_variable('u1', mf);
+md.add_fem_variable('u2', mf);
md.add_Laplacian_brick(mim, 'u');
md.add_Laplacian_brick(mim, 'u1');
+md.add_Laplacian_brick(mim, 'u2');
md.add_Dirichlet_condition_with_multipliers(mim, 'u', mf, 1);
md.add_Dirichlet_condition_with_multipliers(mim, 'u1', mf, 1);
+md.add_Dirichlet_condition_with_multipliers(mim, 'u2', mf, 1);
# md.add_Dirichlet_condition_with_penalization(mim, 'u', 1E9, 1);
# md.add_Dirichlet_condition_with_simplification('u', 1);
@@ -74,8 +77,10 @@ gamma = 0.5;
md.add_Newmark_scheme('u', beta, gamma)
md.add_Houbolt_scheme('u1')
+md.add_Newmark_scheme('u2', beta, gamma)
md.add_mass_brick(mim, 'Dot2_u')
md.add_mass_brick(mim, 'Dot2_u1')
+md.add_lumped_mass_for_first_order_brick(mim, 'Dot2_u2')
md.set_time_step(dt)
## Initial data.
@@ -84,6 +89,8 @@ md.set_variable('Previous_Dot_u', V0)
md.set_variable('Previous_u1', U0)
md.set_variable('Previous2_u1', U0)
md.set_variable('Previous3_u1', U0)
+md.set_variable('Previous_u2', U0)
+md.set_variable('Previous_Dot_u2', V0)
## Initialisation of the acceleration 'Previous_Dot2_u'
md.perform_init_time_derivative(dt/2.)
@@ -116,6 +123,10 @@ for t in np.arange(0.,T,dt):
V = md.variable('Dot_u1')
A = md.variable('Dot2_u1')
+ U = md.variable('u2')
+ V = md.variable('Dot_u2')
+ A = md.variable('Dot2_u2')
+
n += 1
md.shift_variables_for_time_integration()
diff --git a/src/getfem/getfem_models.h b/src/getfem/getfem_models.h
index 520efc0..d875ace 100644
--- a/src/getfem/getfem_models.h
+++ b/src/getfem/getfem_models.h
@@ -2373,7 +2373,7 @@ namespace getfem {
( @f$ \lambda = E\nu/((1+\nu)(1-2\nu)), \mu = E/(2(1+\nu)) @f$ ).
Corresponds to the standard model for three-dimensional problems.
*/
- size_type APIDECL add_isotropic_linearized_elasticity_brick_pstrain
+ size_type APIDECL add_isotropic_linearized_elasticity_pstrain_brick
(model &md, const mesh_im &mim, const std::string &varname,
const std::string &data_E, const std::string &data_nu,
size_type region);
@@ -2386,7 +2386,7 @@ namespace getfem {
( @f$ \lambda^* = E\nu/(1-\nu^2), \mu = E/(2(1+\nu)) @f$ ).
Corresponds to the standard model for three-dimensional problems.
*/
- size_type APIDECL add_isotropic_linearized_elasticity_brick_pstress
+ size_type APIDECL add_isotropic_linearized_elasticity_pstress_brick
(model &md, const mesh_im &mim, const std::string &varname,
const std::string &data_E, const std::string &data_nu,
size_type region);
@@ -2470,7 +2470,7 @@ namespace getfem {
Add a lumped mass matix for first order on a variable (eventually with a
specified region).
If the parameter $\rho$ is omitted it is assumed to be equal to 1.
*/
- size_type APIDECL add_lumped_mass_brick_for_first_order
+ size_type APIDECL add_lumped_mass_for_first_order_brick
(model &md, const mesh_im &mim, const std::string &varname,
const std::string &dataexpr_rho = std::string(),
size_type region = size_type(-1));
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index 1aec2c3..9e08ad1 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -6124,7 +6124,7 @@ namespace getfem {
}
}
- size_type add_isotropic_linearized_elasticity_brick_pstrain
+ size_type add_isotropic_linearized_elasticity_pstrain_brick
(model &md, const mesh_im &mim, const std::string &varname,
const std::string &data_E, const std::string &data_nu,
size_type region) {
@@ -6153,7 +6153,7 @@ namespace getfem {
}
}
- size_type add_isotropic_linearized_elasticity_brick_pstress
+ size_type add_isotropic_linearized_elasticity_pstress_brick
(model &md, const mesh_im &mim, const std::string &varname,
const std::string &data_E, const std::string &data_nu,
size_type region) {
@@ -6543,7 +6543,7 @@ namespace getfem {
//
// ----------------------------------------------------------------------
- struct lumped_mass_brick_for_first_order : public virtual_brick {
+ struct lumped_mass_for_first_order_brick : public virtual_brick {
virtual void asm_real_tangent_terms(const model &md, size_type,
const model::varnamelist &vl,
@@ -6589,7 +6589,7 @@ namespace getfem {
}
- lumped_mass_brick_for_first_order() {
+ lumped_mass_for_first_order_brick() {
set_flags("Lumped mass brick", true /* is linear*/,
true /* is symmetric */, true /* is coercive */,
true /* is real */, false /* no complex version */,
@@ -6598,10 +6598,10 @@ namespace getfem {
};
- size_type add_lumped_mass_brick_for_first_order
+ size_type add_lumped_mass_for_first_order_brick
(model & md, const mesh_im &mim, const std::string &varname,
const std::string &dataexpr_rho, size_type region) {
- pbrick pbr = std::make_shared<lumped_mass_brick_for_first_order>();
+ pbrick pbr = std::make_shared<lumped_mass_for_first_order_brick>();
model::termlist tl;
tl.push_back(model::term_description(varname, varname, true));
model::varnamelist dl;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] [getfem-commits] branch master updated: Rename brick addition functions and new interface function for lumped mass brick,
Konstantinos Poulios <=