Thank you Yves for that insight. After researching the level set
mathematics a bit more, including papers authored in part by you, I
understand I am attempting to establish calculations through a "fictitious
domain". In the 2d crack problem (crack.cc), I see the following:
base_small_vector ls_function(const base_node P, int num = 0) {
scalar_type x = P[0], y = P[1];
base_small_vector res(2);
switch (num) {
case 0: {
res[0] = y;
res[1] = -.5 + x;
} break;
case 1: {
res[0] = gmm::vect_dist2(P, base_node(0.5, 0.)) - .25;
res[1] = gmm::vect_dist2(P, base_node(0.25, 0.0)) - 0.27;
} break;
case 2: {
res[0] = x - 0.25;
res[1] = gmm::vect_dist2(P, base_node(0.25, 0.0)) - 0.35;
} break;
default: assert(0);
}
return res;
}
How are these three level set functions determined as to correspond to
physical phenomena and how can than be imposed onto 3d behavior. I've
tried just toying with these functions in my 3d code and I receive
"segmentation fault".
Thank you,
Andy
On Thu, Jun 16, 2016 at 4:26 AM, Yves Renard <[email protected]>
wrote:
>
> 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, [email protected] 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
> >> [email protected]
> >>
> >> 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
> >> [email protected]
> >>
> >> You can reach the person managing the list at
> >> [email protected]
> >>
> >> 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 <[email protected]>
> >> To: Yves Renard <[email protected]>
> >> Cc: [email protected]
> >> Subject: Re: [Getfem-users] "level is zero!"
> >> Message-ID:
> >> <
> capb_fnwceawrrmg-heuqbpkynvgxgxuwyp3isvrslxwap8r...@mail.gmail.com>
> >> 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
> >>
> >>
> >> /**@file 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 <[email protected]>
> >> 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.
> >>>
> >>> /**@file 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
> >>> [email protected]https://mail.gna.org/listinfo/getfem-users
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>> Yves Renard ([email protected]) 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
> >> [email protected]
> >> https://mail.gna.org/listinfo/getfem-users
> >>
> >>
> >> ------------------------------
> >>
> >> End of Getfem-users Digest, Vol 116, Issue 6
> >> ********************************************
> >>
> >
> >
> > _______________________________________________
> > Getfem-users mailing list
> > [email protected]
> > https://mail.gna.org/listinfo/getfem-users
>
>
> --
>
> Yves Renard ([email protected]) 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
>
> ---------
>
>
_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users