[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Getfem-commits] r4907 - in /trunk/getfem: doc/sphinx/source/userdoc/ in
From: |
Yves . Renard |
Subject: |
[Getfem-commits] r4907 - in /trunk/getfem: doc/sphinx/source/userdoc/ interface/src/ src/ src/getfem/ |
Date: |
Wed, 25 Mar 2015 16:27:39 -0000 |
Author: renard
Date: Wed Mar 25 17:27:38 2015
New Revision: 4907
URL: http://svn.gna.org/viewcvs/getfem?rev=4907&view=rev
Log:
minor modifications and documentation for elementary transformations
Modified:
trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst
trunk/getfem/doc/sphinx/source/userdoc/model.rst
trunk/getfem/interface/src/gf_model_set.cc
trunk/getfem/src/getfem/getfem_linearized_plates.h
trunk/getfem/src/getfem_linearized_plates.cc
Modified: trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst?rev=4907&r1=4906&r2=4907&view=diff
==============================================================================
--- trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst (original)
+++ trunk/getfem/doc/sphinx/source/userdoc/gasm_high.rst Wed Mar 25
17:27:38 2015
@@ -60,8 +60,9 @@
- Possiblility of macro definition (in the model or ga_workspace object).
The macros should be some valid expressions that are expanded inline at the
semantic analysis phase (if they are used several times, the computation is
automatically factorized at the compilation stage).
- - ``Interpolate(variable, transformation)``: powerful operation which allows
to interpolate the variables, or test functions either on the same mesh on
other elements or on another mesh. ``transformation`` is an object stored by
the workspace or model object which describe the map from the current point to
the point where to perform the interpolation. This functionality can be used
for instance to prescribe periodic conditions or to compute mortar matrices for
two finite element defined on different meshes.
-
+ - ``Interpolate(variable, transformation)``: powerful operation which allows
to interpolate the variables, or test functions either on the same mesh on
other elements or on another mesh. ``transformation`` is an object stored by
the workspace or model object which describe the map from the current point to
the point where to perform the interpolation. This functionality can be used
for instance to prescribe periodic conditions or to compute mortar matrices for
two finite element defined on different meshes or more generaly for fictitious
domain methods such as fluid-structure interaction.
+
+ - ``Elementary_transformation(variable, transformation)``: Allow a linear
tranformation defined at the element level (i.e. which is not possible to
define at the gauss point level). This add been added mostly to defien
reduction for plate elements (projection onto low-level vector element such as
rotated RT0). ``transformation`` is an object stored by the workspace or model
object which describe the trasformation for a particular element.
Some basic examples
@@ -660,6 +661,36 @@
In that case, the equality will only be prescribed in the part of the domain
where the transformation succeed and in the other part, the mulitplier is
enforced to vanish.
-
-
-**CAUTION**: You have to think that when some variables are used in the
transformation, the computation of the tangent system takes into account these
dependence. However, the second derivative of a transformation with respect to
a variable used has not been implemented. Thus, such a transformation is not
allowed in the definition of a potential since it cannot be derived twice.
+**CAUTION**: You have to think that when some variables are used in the
transformation, the computation of the tangent system takes into account these
dependence. However, the second derivative of a transformation with respect to
a variable used has not been implemented. Thus, such a transformation is not
allowed in the definition of a potential since it cannot be derived twice.
+
+Elementary transformations
+**************************
+
+An elementary transformation is a linear transformation of the shape
+functions given by a matrix which may depend on the element which is applied
+to the local degrees of freedom at the element level. an example of definition
+of elementary transformation can be found in the file
+:file:`src/linearized_plate.cc`. It aims for instance to define a local
+projection of a finite element on a lower level element to perform a
+reduction such as the one used in MITC elements.
+
+Once a transformation is defined, it can be added to the model/workspace with
+the method::
+
+ model.add_elementary_transformation(transname, pelementary_transformation)
+
+where ``pelementary_transformation`` is a pointer to an object deriving from
``virtual_elementary_transformation``. Once it is added to the model/workspace,
it is possible to use the following expressions in the assembly language::
+
+ Elementary_transformation(u, transname)
+ Elementary_transformation(Grad_u, transname)
+ Elementary_transformation(Hess_u, transname)
+ Elementary_transformation(Test_u, transname)
+ Elementary_transformation(Grad_Test_u, transname)
+ Elementary_transformation(Hess_Test_u, transname)
+
+where ``u`` is one of the fem variables of the model/workspace. For the
moment, the only available elementary transformation is the the one for the
projection on rotated RT0 element for two-dimensional elements which can be
added thanks to the function (defined in :file:`getfem/linearized_plate.h`)::
+
+ add_2D_rotated_RT0_projection(model, transname)
+
+
+
Modified: trunk/getfem/doc/sphinx/source/userdoc/model.rst
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/doc/sphinx/source/userdoc/model.rst?rev=4907&r1=4906&r2=4907&view=diff
==============================================================================
--- trunk/getfem/doc/sphinx/source/userdoc/model.rst (original)
+++ trunk/getfem/doc/sphinx/source/userdoc/model.rst Wed Mar 25 17:27:38 2015
@@ -52,10 +52,10 @@
model_fourier_robin
model_linear_elasticity
model_mass
+ model_bilaplacian
model_time_integration
model_nonlinear_elasticity
model_contact_friction
model_contact_friction_large_sliding
model_elastoplasticity
- model_bilaplacian
model_continuation
Modified: trunk/getfem/interface/src/gf_model_set.cc
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_model_set.cc?rev=4907&r1=4906&r2=4907&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_model_set.cc (original)
+++ trunk/getfem/interface/src/gf_model_set.cc Wed Mar 25 17:27:38 2015
@@ -342,11 +342,12 @@
md->model().define_variable_group(name, nl);
);
- /address@hidden ('add elementary RT0 projection')
+ /address@hidden ('add elementary rotated RT0 projection', @str transname)
Experimental method ... @*/
sub_command
- ("add elementary RT0 projection", 0, 0, 0, 0,
- add_RT0_projection(md->model());
+ ("add elementary rotated RT0 projection", 1, 1, 0, 0,
+ std::string transname = in.pop().to_string();
+ add_2D_rotated_RT0_projection(md->model(), transname);
);
/address@hidden ('add interpolate transformation from expression', @str
transname, @tmesh source_mesh, @tmesh target_mesh, @str expr)
Modified: trunk/getfem/src/getfem/getfem_linearized_plates.h
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_linearized_plates.h?rev=4907&r1=4906&r2=4907&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_linearized_plates.h (original)
+++ trunk/getfem/src/getfem/getfem_linearized_plates.h Wed Mar 25 17:27:38 2015
@@ -43,7 +43,11 @@
namespace getfem {
- void add_RT0_projection(model &m);
+ /** Add the elementary transformation corresponding to the projection
+ on rotated RT0 element for two-dimensional elements to the model.
+ The name is the name given to the elementary transformation.
+ */
+ void add_2D_rotated_RT0_projection(model &md, std::string name);
/* ******************************************************************** */
/* Linear plate specific assembly procedures. */
Modified: trunk/getfem/src/getfem_linearized_plates.cc
URL:
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_linearized_plates.cc?rev=4907&r1=4906&r2=4907&view=diff
==============================================================================
--- trunk/getfem/src/getfem_linearized_plates.cc (original)
+++ trunk/getfem/src/getfem_linearized_plates.cc Wed Mar 25 17:27:38 2015
@@ -28,10 +28,9 @@
namespace getfem {
- // For the moment, projection onto RT0 element
- // and with no storage.
-
- class elementary_projection_transformation
+ // For the moment, only projection onto rotated RT0 element in dimension 2
+
+ class _2D_Rotated_RT0_projection_transformation
: public virtual_elementary_transformation {
public:
@@ -39,11 +38,11 @@
virtual void give_transformation(const mesh_fem &mf, size_type cv,
base_matrix &M) const{
-
-
// Obtaining the fem descriptors
pfem pf1 = mf.fem_of_element(cv);
- size_type N = pf1->dim();
+ size_type N = 2;
+ GMM_ASSERT1(pf1->dim() == 2, "This projection is only defined "
+ "for two-dimensional elements");
size_type qmult = N / pf1->target_dim();
bool simplex = false;
@@ -56,14 +55,14 @@
GMM_ASSERT1(false, "Cannot adapt the method for such an element.");
}
- GMM_ASSERT1(pf1->is_equivalent(), "For tau-equivalent fem only."); //
Indeed no, for the moment ...
+ // GMM_ASSERT1(pf1->is_equivalent(), "For tau-equivalent fem only."); //
A remplacer par si non tau équivalent faire le calcul à chaque fois
std::stringstream fem_desc;
fem_desc << "FEM_RT0" << (simplex ? "":"Q") << "(" << N << ")";
pfem pf2 = fem_descriptor(fem_desc.str());
// Obtaining a convenient integration method
- size_type degree = pf1->estimated_degree() * pf2->estimated_degree();
+ size_type degree = pf1->estimated_degree() + pf2->estimated_degree();
bgeot::pgeometric_trans pgt = mf.linked_mesh().trans_of_convex(cv);
papprox_integration pim
= classical_approx_im(pgt, dim_type(degree))->approx_method();
@@ -93,14 +92,7 @@
vectorize_base_tensor(t1, tv1, ndof1, pf1->target_dim(), N);
pf2->real_base_value(ctx2, t2);
vectorize_base_tensor(t2, tv2, ndof2, pf2->target_dim(), N);
-
- if (N == 2) { // H curl ... ! and for triangles ?
- gmm::clear(tv2);
- tv2(0,0) = scalar_type(1);
- tv2(1,1) = scalar_type(1);
- tv2(2,0) = pim->point(i)[1];
- tv2(3,1) = pim->point(i)[0];
- }
+ for (size_type j = 0; j < ndof2; ++j) std::swap(tv2(j,0), tv2(j,1));
gmm::mult(tv1, gmm::transposed(tv1), aux0);
gmm::add(gmm::scaled(aux0, coeff), M1);
@@ -120,24 +112,119 @@
"Element not convenient for projection");
gmm::mult(aux2, gmm::transposed(B), M);
gmm::clean(M, 1E-15);
- // cout << "M = " << M << endl;
}
};
- void add_RT0_projection(model &md) {
-
+ void add_2D_rotated_RT0_projection(model &md, std::string name) {
pelementary_transformation p
- = new elementary_projection_transformation();
-
- md.add_elementary_transformation("RT0_projection", p);
+ = new _2D_Rotated_RT0_projection_transformation();
+ md.add_elementary_transformation(name, p);
}
+ // RT0 projection in any dimension. Unused for the moment.
+
+
+// class RT0_projection_transformation
+// : public virtual_elementary_transformation {
+
+// public:
+
+// virtual void give_transformation(const mesh_fem &mf, size_type cv,
+// base_matrix &M) const{
+
+
+
+// // Obtaining the fem descriptors
+// pfem pf1 = mf.fem_of_element(cv);
+// size_type N = pf1->dim();
+// size_type qmult = N / pf1->target_dim();
+
+// bool simplex = false;
+// if (pf1->ref_convex(cv) == bgeot::simplex_of_reference(dim_type(N))) {
+// simplex = true;
+// } else if (pf1->ref_convex(cv)
+// == bgeot::parallelepiped_of_reference(dim_type(N))) {
+// simplex = false;
+// } else {
+// GMM_ASSERT1(false, "Cannot adapt the method for such an element.");
+// }
+
+// GMM_ASSERT1(pf1->is_equivalent(), "For tau-equivalent fem only."); //
Indeed no, for the moment ...
+
+// std::stringstream fem_desc;
+// fem_desc << "FEM_RT0" << (simplex ? "":"Q") << "(" << N << ")";
+// pfem pf2 = fem_descriptor(fem_desc.str());
+
+// // Obtaining a convenient integration method
+// size_type degree = pf1->estimated_degree() + pf2->estimated_degree();
+// bgeot::pgeometric_trans pgt = mf.linked_mesh().trans_of_convex(cv);
+// papprox_integration pim
+// = classical_approx_im(pgt, dim_type(degree))->approx_method();
+
+// // Computation of mass matrices
+// size_type ndof1 = pf1->nb_dof(cv) * qmult;
+// size_type ndof2 = pf2->nb_dof(0);
+// base_matrix M1(ndof1, ndof1), M2(ndof2, ndof2), B(ndof1, ndof2);
+// base_matrix aux0(ndof1, ndof1), aux1(ndof1, ndof2), aux2(ndof1,
ndof2);
+// base_matrix aux3(ndof2, ndof2);
+
+
+// base_matrix G;
+// bgeot::vectors_to_base_matrix(G,
mf.linked_mesh().points_of_convex(cv));
+// fem_interpolation_context ctx1(pgt, pf1, base_node(N), G, cv);
+// fem_interpolation_context ctx2(pgt, pf2, base_node(N), G, cv);
+
+// base_tensor t1, t2;
+// base_matrix tv1, tv2;
+
+// for (size_type i = 0; i < pim->nb_points_on_convex(); ++i) {
+
+// scalar_type coeff = pim->coeff(i); // Mult by ctx.J() not useful
here
+// ctx1.set_xref(pim->point(i));
+// ctx2.set_xref(pim->point(i));
+// pf1->real_base_value(ctx1, t1);
+// vectorize_base_tensor(t1, tv1, ndof1, pf1->target_dim(), N);
+// pf2->real_base_value(ctx2, t2);
+// vectorize_base_tensor(t2, tv2, ndof2, pf2->target_dim(), N);
+
+
+// // for (size_type j = 0; j < 4; ++j)
+// // std::swap(tv2(j,0), tv2(j,1));
+
+
+// gmm::mult(tv1, gmm::transposed(tv1), aux0);
+// gmm::add(gmm::scaled(aux0, coeff), M1);
+// gmm::mult(tv2, gmm::transposed(tv2), aux3);
+// gmm::add(gmm::scaled(aux3, coeff), M2);
+// gmm::mult(tv1, gmm::transposed(tv2), aux1);
+// gmm::add(gmm::scaled(aux1, coeff), B);
+// }
+
+
+// // Computation of M
+// gmm::lu_inverse(M1);
+// gmm::lu_inverse(M2);
+// gmm::mult(M1, B, aux1);
+// gmm::mult(aux1, M2, aux2);
+// GMM_ASSERT1(gmm::mat_nrows(M) == ndof1,
+// "Element not convenient for projection");
+// gmm::mult(aux2, gmm::transposed(B), M);
+// gmm::clean(M, 1E-15);
+// // cout << "M = " << M << endl;
+// }
+// };
+
+
+
+
+
+
} /* end of namespace getfem. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Getfem-commits] r4907 - in /trunk/getfem: doc/sphinx/source/userdoc/ interface/src/ src/ src/getfem/,
Yves . Renard <=