getfem-users
[Top][All Lists]
Advanced

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

Re: [Getfem-users] Getfem-users Digest, Vol 116, Issue 6


From: Yves Renard
Subject: Re: [Getfem-users] Getfem-users Digest, Vol 116, Issue 6
Date: Thu, 16 Jun 2016 11:26:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

Dear Andy,

First, just a remark for the future version of Getfem, the two lines

getfem::crack_singular_xy_function *s = new
getfem::crack_singular_xy_function(j);
vfunc[j] = getfem::global_function_on_level_set(ls, *s);

will have to be changed to

auto s = std::make_shared<getfem::crack_singular_xy_function>(j);
vfunc[j] = getfem::global_function_on_level_set(ls, s);


My first error in the code is in fact :

  what():  Error in ../../src/getfem_fem_global_function.cc, line 95 :
Convexes of different dimension: to be done

Indicating that there is both 2D and 3D elements in the mesh : may be
you should select only the 3D elements.


I look a bit into the code. For me the main mistake in the code is that

mls.adapt();
mfls.adapt();
mim.adapt();

are called but the level set value is not set. To be clear

getfem::level_set ls(mesh);

defined an invalid level set function which is zero everywhere. You have
to set its value using
ls.values(0) (see tests/crack.cc for instance) before calling adapt()
methods.


Best regards,

Yves.





Le 15/06/2016 19:21, address@hidden a écrit :
> Hi Andrew,
>
> I already had this error message, a long time ago. If I remember well,
> this message can appear when the degree of the level-set is wrong, in view
> of the way the level-set is defined and/or used. This degree must be 1
> when it is a curve (in 2D), or 2 when it is a surface (in 3D):
>
> getfem::level_set ls(mesh, degree = 1, with_secondary = false);
>
> http://download.gna.org/getfem/html/homepage/userdoc/xfem.html
>
> In your code, by default the degree of the level-set is equal to 1, and in
> what follows it seems that we are in a 3D context.
>
> Maybe the problem comes also from the fact that you may have to specify
> secondary level-set functions. In that case your level-set object is not a
> scalar-type anymore, but a vector.
>
> Sincerely,
>
> S.C
>
>
>
> https://online.uni-graz.at/kfu_online/visitenkarte.show_vcard?pPersonenId=8E061E23CBE613F4&pPersonenGruppe=3
>
>
>
>
>> Send Getfem-users mailing list submissions to
>>      address@hidden
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>      https://mail.gna.org/listinfo/getfem-users
>> or, via email, send a message with subject or body 'help' to
>>      address@hidden
>>
>> You can reach the person managing the list at
>>      address@hidden
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Getfem-users digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re: "level is zero!" (Andrew Roberts)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 14 Jun 2016 16:35:59 -0500
>> From: Andrew Roberts <address@hidden>
>> To: Yves Renard <address@hidden>
>> Cc: address@hidden
>> Subject: Re: [Getfem-users] "level is zero!"
>> Message-ID:
>>      <address@hidden>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Hello again,
>>    I've been working diligently to understand as to why I receive "level
>> is
>> zero" error.  I'd appreciate any code review and advice.  The purpose is
>> just to demonstrate basic xfem behavior in the compact specimen mesh
>> (v4.gmsh.msh).
>>
>> Thank you,
>> Andy
>>
>>
>> /address@hidden compact.cc
>>    @brief compact specimen problem.
>>
>> */
>>
>> #include "getfem/getfem_model_solvers.h"
>> #include "getfem/getfem_export.h"
>> #include "gmm/gmm.h"
>> #include "getfem/getfem_import.h"
>> #include "getfem/getfem_assembling.h"
>> #include "getfem/getfem_generic_assembly.h"
>> #include "getfem/getfem_mesh_im_level_set.h"
>> #include "getfem/getfem_mesh_fem_level_set.h"
>> #include "getfem/getfem_mesh_fem_product.h"
>> #include "getfem/getfem_mesh_fem_global_function.h"
>> #include "getfem/getfem_mesh_fem_sum.h"
>> #include <string>
>> #include <cstring>
>> #include <sstream>
>> #include <iostream>
>>
>> using std::endl; using std::cout; using std::cerr;
>> using std::ends; using std::cin;
>>
>> using bgeot::size_type;
>> using bgeot::base_node;
>> using bgeot::base_small_vector;
>> typedef getfem::model_real_plain_vector plain_vector;
>>
>>
>> using bgeot::scalar_type; /* = double */
>>
>>
>>
>> int main(void) {
>>
>>
>> double E = 21E6;     // Young Modulus (N/cm^2)
>> double nu = 0.3;     // Poisson ratio
>> double clambda = E*nu/((1+nu)*(1-2*nu));
>> double cmu = E/(2*(1+nu));
>> double clambdastar = 2*clambda*cmu/(clambda+2*cmu);
>>
>>
>> double residual = 1E-9;
>>
>>
>> getfem::mesh mesh;
>> getfem::import_mesh("gmsh:v4.gmsh.msh",mesh);
>>
>>
>> getfem::mesh_fem mf(mesh);
>>
>>
>> getfem::level_set ls(mesh);
>> getfem::mesh_level_set mls(mesh);
>> mls.add_level_set(ls);
>>
>>
>> std::vector<getfem::pglobal_function> vfunc(4);
>>   for (unsigned j=0; j < 4; ++j) {
>>     getfem::crack_singular_xy_function *s =
>>       new getfem::crack_singular_xy_function(j);
>>     vfunc[j] = getfem::global_function_on_level_set(ls, *s);
>>   }
>>
>>
>> getfem::mesh_fem_level_set mfls(mls, mf);
>>
>>
>> getfem::mesh_fem_global_function mf_sing(mesh);
>>
>>
>> mf_sing.set_functions(vfunc);
>>
>>
>> getfem::mesh_fem_sum mfu(mesh);
>>
>>
>> mfu.set_mesh_fems(mf_sing, mfls);
>>
>> getfem::mesh_im_level_set mim(mls,
>> getfem::mesh_im_level_set::INTEGRATE_ALL,
>> getfem::int_method_descriptor("IM_TETRAHEDRON(6)"),
>> getfem::int_method_descriptor("IM_QUASI_POLAR(IM_TETRAHEDRON(8), 2)"));
>>
>>
>> mls.adapt();
>> mfls.adapt();
>> mim.adapt();
>>
>>
>> getfem::mesh_fem mfvm(mesh, 1);
>>
>> mfvm.set_classical_discontinuous_finite_element(1);
>>
>>
>> getfem::model md;
>> md.add_fem_variable("u", mfu);
>>
>>
>> md.add_initialized_scalar_data("cmu", cmu);
>> md.add_initialized_scalar_data("clambdastar", clambdastar);
>>
>>
>> getfem::add_isotropic_linearized_elasticity_brick
>>     (md, mim, "u", "clambdastar", "cmu");
>>
>>
>>
>> getfem::add_normal_Dirichlet_condition_with_multipliers(md,mim,"u", 1,
>> 109);
>>
>> getfem::add_source_term_brick(md,mim,"u","[0,1640,0]", 108);
>>
>>
>> gmm::iteration iter(residual, 1, 50);
>> getfem::standard_solve(md, iter,
>> getfem::rselect_linear_solver(md,"superlu"));
>>
>>
>>
>> plain_vector U(mfu.nb_dof()); gmm::copy(md.real_variable("u"), U);
>> plain_vector VM(mfvm.nb_dof());
>> getfem::compute_isotropic_linearized_Von_Mises_or_Tresca
>>     (md, "u", "clamabdastar", "cmu", mfvm, VM, false);
>>
>>
>> getfem::vtk_export exp2("d_w_vm.vtk", false);
>> exp2.exporting(mfu);
>> exp2.write_point_data(mfu, U, "displacement");
>> exp2.write_point_data(mfvm, VM, "Von Mises stress");
>>
>>
>> }
>>
>> On Mon, Jun 13, 2016 at 7:03 AM, Yves Renard <address@hidden>
>> wrote:
>>
>>> Dear Andrew,
>>>
>>> This message appear when the level_set function is identically zero on
>>> an
>>> element (the level set function have to be "close" to a signed
>>> distance).
>>> Are you sure you initialized your level-set function with a correct
>>> value ?
>>>
>>> Best regards,
>>>
>>> Yves.
>>>
>>>
>>> Le 12/06/2016 23:33, Andrew Roberts a écrit :
>>>
>>> Working to demo 3d XFEM crack propagation of a steel compact specimen
>>> top-half (gmsh import).
>>>
>>> It compiles fine but the executable throws a "level is zero" error which
>>> I'm uncertain of the source of this error.  Code attached below.
>>>
>>> /address@hidden compact.cc
>>>>    @brief three-dimensional XFEM crack propagation.
>>>>
>>>> */
>>>>
>>>> #include "getfem/getfem_model_solvers.h"
>>>> #include "getfem/getfem_export.h"
>>>> #include "gmm/gmm.h"
>>>> #include "getfem/getfem_import.h"
>>>> #include "getfem/getfem_assembling.h"
>>>> #include "getfem/getfem_generic_assembly.h"
>>>> #include "getfem/getfem_mesh_im_level_set.h"
>>>> #include "getfem/getfem_mesh_fem_level_set.h"
>>>> #include "getfem/getfem_mesh_fem_product.h"
>>>> #include "getfem/getfem_mesh_fem_global_function.h"
>>>> #include "getfem/getfem_mesh_fem_sum.h"
>>>> #include <string>
>>>> #include <cstring>
>>>> #include <sstream>
>>>> #include <iostream>
>>>>
>>>> using std::endl; using std::cout; using std::cerr;
>>>> using std::ends; using std::cin;
>>>>
>>>> using bgeot::size_type;
>>>> using bgeot::base_node;
>>>> using bgeot::base_small_vector;
>>>> typedef getfem::model_real_plain_vector plain_vector;
>>>>
>>>>
>>>> using bgeot::scalar_type; /* = double */
>>>>
>>>> int main(void) {
>>>>
>>>> double E = 21E6;     // Young Modulus (N/cm^2)
>>>> double nu = 0.3;     // Poisson ratio
>>>> double clambda = E*nu/((1+nu)*(1-2*nu));
>>>> double cmu = E/(2*(1+nu));
>>>> double clambdastar = 2*clambda*cmu/(clambda+2*cmu);
>>>>
>>>> double residual = 1E-9;
>>>>
>>>> getfem::mesh mesh;
>>>> getfem::import_mesh("gmsh:v4.gmsh.msh",mesh);
>>>>
>>>>
>>>> getfem::mesh_fem mf(mesh, 3);
>>>>
>>>> getfem::mesh_fem mfvm(mesh, 1);
>>>>
>>>> mf.set_finite_element(mesh.convex_index(),
>>>> getfem::fem_descriptor("FEM_PK(3,2)"));
>>>>
>>>> mfvm.set_classical_discontinuous_finite_element(1);
>>>>
>>>> getfem::level_set ls(mesh, 1, true);
>>>> getfem::mesh_level_set mls(mesh);
>>>> mls.add_level_set(ls);
>>>> mls.adapt();
>>>>
>>>> std::vector<getfem::pglobal_function> vfunc(6);
>>>> for (unsigned i = 0; i < vfunc.size(); ++i){
>>>>     getfem::abstract_xy_function *s =
>>>>         new getfem::crack_singular_xy_function(i);
>>>>     getfem::abstract_xy_function *c =
>>>>         new getfem::cutoff_xy_function(0, .2,.01,.49);
>>>>     s = new getfem::product_of_xy_functions(*s, *c);
>>>>       vfunc[i] = getfem::global_function_on_level_set(ls, *s);
>>>> }
>>>>
>>>> getfem::mesh_fem_level_set mfls(mls, mf);
>>>>
>>>> getfem::mesh_fem_global_function mf_sing(mesh,3);
>>>>
>>>> mf_sing.set_functions(vfunc);
>>>>
>>>> getfem::mesh_fem_product mf_asympt(mfls, mf_sing);
>>>>
>>>> getfem::mesh_fem_product mfu(mf_asympt);
>>>>
>>>> getfem::mesh_im_level_set mim(mls,
>>>> getfem::mesh_im_level_set::INTEGRATE_ALL,
>>>> getfem::int_method_descriptor("IM_TETRAHEDRON(6)"),
>>>> getfem::int_method_descriptor("IM_QUASI_POLAR(IM_TETRAHEDRON(8), 2)"));
>>>>
>>>>
>>>>
>>>> getfem::model md;
>>>> md.add_fem_variable("u", mfu);
>>>>
>>>>
>>>> md.add_initialized_scalar_data("cmu", cmu);
>>>> md.add_initialized_scalar_data("clambdastar", clambdastar);
>>>>
>>>> getfem::add_isotropic_linearized_elasticity_brick
>>>>     (md, mim, "u", "clambdastar", "cmu");
>>>>
>>>>
>>>> getfem::add_normal_Dirichlet_condition_with_multipliers(md,mim,"u", 1,
>>>> 109);
>>>>
>>>> getfem::add_source_term_brick(md,mim,"u","[0,1640,0]", 108);
>>>>
>>>> gmm::iteration iter(residual, 1, 50);
>>>> getfem::standard_solve(md, iter,
>>>> getfem::rselect_linear_solver(md,"superlu"));
>>>>
>>>> getfem::standard_solve(md, iter);
>>>>
>>>> plain_vector U(mfu.nb_dof()); gmm::copy(md.real_variable("u"), U);
>>>> plain_vector VM(mfvm.nb_dof());
>>>> getfem::compute_isotropic_linearized_Von_Mises_or_Tresca
>>>>     (md, "u", "clamabdastar", "cmu", mfvm, VM, false);
>>>>
>>>>
>>>> getfem::vtk_export exp2("d_w_vm.vtk", false);
>>>> exp2.exporting(mfu);
>>>> exp2.write_point_data(mfu, U, "displacement");
>>>> exp2.write_point_data(mfvm, VM, "Von Mises stress");
>>>>
>>>>
>>>> }
>>>>
>>> Thank you for any help in advance,
>>>
>>> Andy
>>>
>>>
>>> _______________________________________________
>>> Getfem-users mailing
>>> address@hidden
>>>
>>>
>>>
>>> --
>>>
>>>   Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
>>>   Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
>>>   20, rue Albert Einstein
>>>   69621 Villeurbanne Cedex, FRANCE
>>>   http://math.univ-lyon1.fr/~renard
>>>
>>> ---------
>>>
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: </public/getfem-users/attachments/20160614/0acdbda0/attachment.html>
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> Getfem-users mailing list
>> address@hidden
>> https://mail.gna.org/listinfo/getfem-users
>>
>>
>> ------------------------------
>>
>> End of Getfem-users Digest, Vol 116, Issue 6
>> ********************************************
>>
>
>
> _______________________________________________
> Getfem-users mailing list
> address@hidden
> https://mail.gna.org/listinfo/getfem-users


-- 

  Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
  Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE
  http://math.univ-lyon1.fr/~renard

---------




reply via email to

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