Dear Zhenghuai Guo, The installation and building of getfem and the tests are explained in the manual <http://getfem.org/install/install_linux.html>. After getfem is installed, you can build all the examples with the command: make tests If you want to build a specific example, say laplacian_with_bricks <http://getfem.org/userdoc/model_poisson.html>, just type make laplacian_with_bricks
The make script will call the compiler to build the object file and subsequently link it against the library. Your attempt to build elastostatic example is close, but not sufficient: you're compiling your code, but not linking against getfem. When you type "make laplacian_with_bricks", you will see the output of the exact commands necessary to compile and link against the library. You can use these exact commands to build your source file into an getfem based program. Best regards, Andriy On Sat, 1 Dec 2018 at 21:16, Zhenghuai Guo <zhenghuai....@unsw.edu.au> wrote: > Dear Andriy, > > > > I try your suggestions - using im_data for the coefficients - in python > which are working fine. Thank you very much. > > > > But I still have problem in deforming the mesh in Python – simply don’t > know how to call the ‘temporary_mesh_deformator’ in Python. I guess I > should do it in C++. > > > > I don’t really use C++ too much. Could you please let me know where the > demos are for the C++? > > > > I can see that in the folder ‘getfem-5.3/tests’, there are some ‘.cc’ test > files – are they the demos? I try to compile it : ‘g++ elastostatic.cc -o > elastostatic’, but it did not go through (give the message as attached). I > am not sure if I did it right or simply because I did not install the > getfem right in the first place. > > > > Could you please advise? > > > > Thank you very much > > Kind regards > > Zhenghuai Guo > > > > > > *From:* Andriy Andreykiv <andriy.andrey...@gmail.com> > *Sent:* Wednesday, November 21, 2018 9:53 PM > *To:* Zhenghuai Guo <zhenghuai....@unsw.edu.au>; getfem-users@nongnu.org > *Subject:* Re: [Getfem-users] mesh_deformation > > > > Dear Zhenghuai Guo, > > > > For 1 you don't need to do anything. All the variables in the next step > remain from the last step. In some cases, if your variable has two versions > (old and current, for instance) you need to call model::next_iter() to copy > all the old versions of variable to the current. > > But if the variable doesn't have the two versions you don't need that. > Normally we want to have two versions of variables when our formulations > use their increments. > > For 2 you don't really need to add the linear elastic term with your own > code, as the actual function add_isotropic_linearized_elasticity_brick uses > high-level assembly internally. Here is it's source code > > from getfem_models.cc > > size_type add_isotropic_linearized_elasticity_brick > > (model &md, const mesh_im &mim, const std::string &varname, > > const std::string &dataexpr1, const std::string &dataexpr2, > > size_type region, const std::string &dataname3) { > > std::string test_varname > > = "Test_" + sup_previous_and_dot_to_varname(varname); > > std::string expr1 = "((("+dataexpr1+")*(Div_"+varname+"-Div_"+dataname3 > > +"))*Id(meshdim)+(2*("+dataexpr2+"))*(Sym(Grad_"+varname > > +")-Sym(Grad_"+dataname3+"))):Grad_" +test_varname; > > std::string expr2 = "(Div_"+varname+"*(("+dataexpr1+")*Id(meshdim))" > > +"+(2*("+dataexpr2+"))*Sym(Grad_"+varname+")):Grad_"+test_varname; > > ga_workspace workspace(md, true); > > workspace.add_expression(expr2, mim, region); > > model::varnamelist vl, vl_test1, vl_test2, dl; > > bool is_lin = workspace.used_variables(vl, vl_test1, vl_test2, dl, 2); > > if (is_lin) { > > pbrick pbr = std::make_shared<iso_lin_elasticity_new_brick> > > (expr2, dataname3); > > model::termlist tl; > > tl.push_back(model::term_description(varname, > > sup_previous_and_dot_to_varname(varname), true)); > > if (dataname3.size()) dl.push_back(dataname3); > > return md.add_brick(pbr, vl, dl, tl, model::mimlist(1, &mim), region); > > } else { > > return add_nonlinear_generic_assembly_brick > > (md, mim, dataname3.size() ? expr1 : expr2, region, false, false, > > "Linearized isotropic elasticity (with nonlinear dependance)"); > > } > > } > > It's c++, but python logic would be similar. > > Regarding the source code you've attached, I see that you still add the > elastic constants as a fixed size data. As I mentioned in the last email, > you need to have different constants for every integration point > > of your model. Hence they have to be im_data. > > > > Best regards, > > Andriy > > > > On Sun, 18 Nov 2018 at 20:47, Zhenghuai Guo <zhenghuai....@unsw.edu.au> > wrote: > > Dear Andriy, > > > > Thank you for the advice. You understand correctly about what I am trying > to achieve. The problems I am having now are to how to (1) use an updated > deformed mesh and (2) consider the displacement/stress value of previous > timestep as the initial condition at each new time step. > > > > Could you please advise about the following? > > > > 1. If I use Isotropic_linearized_elastic_brick, how can I pass the > displacement and stress values from one time step to another? At each > timestep, I would like the initial condition to take into account the state > (e.g. displacement and stress) of last timestep. I am not sure maybe it > does it automatically or not. > 2. I am trying to use high level assembly string language to carry out > linear elasticity. I am guessing, by doing this I can be more free. And > maybe I can consider the displacement/stress value of previous timestep as > the initial condition at each new time step. > > Could you please have a look at the attached small code? I try to add the > assembly string of isotropic linear elasticity by > *md.add_linear_term(mim,'(clambda*Trace(Grad_u)*Id(qdim(u)) > + cmu*(Grad_u+Grad_u’)):Grad_Test_u ')* > > > > but, when I run the code, it appear with some problem – although it does > not give error, but it does not proceed and the python shell is restarted. > Could you please advise about this issue? > > > > Thank you very much > > Regards > > Zhenghuai Guo > > > > *From:* Andriy Andreykiv <andriy.andrey...@gmail.com> > *Sent:* Friday, November 16, 2018 11:03 PM > *To:* Zhenghuai Guo <zhenghuai....@unsw.edu.au> > *Cc:* getfem-users@nongnu.org > *Subject:* Re: [Getfem-users] mesh_deformation > > > > Dear Zhenghuai Guo, > > > > If I understand correctly, you're trying to model creep with contact. If > so, then you can probably assume that your elastic properties are weakly > coupled with stress. In that case you can probably just update your elastic > properties every time step. > > So, you need to write a loop where you change the properties every step. > Here are some ideas > > > > 1) Your elastic properties lambda and mu cannot be fixed sized constants, > as they will depend on stress values throughout the domain. The logical way > to handle this is > > by setting them as a so-called im_data, which is a field defined on > Gauss points (on mesh_im class). Please look up documentation or source how > to add im_data. > > > > 2) Isotropic linearized elastic brick does not compute and store stress > field. You will need to define stress field as im_data too and compute it > from your solution > > using probably high-level assembly syntax > <http://getfem.org/userdoc/interMM.html#interpolation-based-on-the-high-level-weak-form-language> > > > > ga_interpolation_im_data(md, "lambda*Trace(Grad_u)*Id(qdim(u)) + > mu*(Grad_u+Grad_u'))" , im_data &imd_stress, base_vector > &stress_result_vector); > > > > 3) The whole calculation should look like this: > > > > initialize the elastic properties as im_data > > create im_data for the stress > > add contact bricks > > while(t < T) > > { > > md.solve(); > > compute the stresses from the displacement field using high-level > assembly syntax interpolations > > compute the new values for the elastic properties with high-level > assembly syntax interpolations > > post-process; > > t = t + delta T; > > } > > > > Best regards, > > Andriy > > > > On Fri, 16 Nov 2018 at 04:42, Zhenghuai Guo <zhenghuai....@unsw.edu.au> > wrote: > > Dear Andriy, > > > > I am planning to do a time dependent deformation with consideration of the > contact and friction. I would like to apply the elasticity theory with > Young’s modulus being a function of time and local stress value. > > > > Could you please advise about the following? > > > > 1. If I use *add_isotropic_linearized_elasticity_brick (mim, varname, > dataname_lambda, dataname_mu, region=None), *how can I make the > Young’s modulus time and stress dependent? In the test examples e.g. in > demo_tripod.py, Young’s modulus is only added by the method > *add_initialized_data* as a constant scalar value. > 2. If I carry out elasticity formulation by a approach like the one in > demo_tripod_alt.py using low level approach to building the linear system > by hand, can I in the meantime apply together the bricks framework e.g. > *add_master_contact_boundary_to_large_sliding_contact_brick(indbrick, > mim, region, dispname, wname=None)?* > > > > > > Thank you very much > > Best regards > > Zhenghuai Guo > > > > > > > > *From:* Andriy Andreykiv <andriy.andrey...@gmail.com> > *Sent:* Thursday, November 8, 2018 8:56 PM > *To:* Zhenghuai Guo <zhenghuai....@unsw.edu.au> > *Cc:* getfem-users@nongnu.org > *Subject:* Re: [Getfem-users] mesh_deformation > > > > Dear Zhenghuai Guo, > > > > You can build getfem and getfem based programs using either GCC c++ > compiler for Linux based systems > > (read Page 5 of the user doc: > http://download-mirror.savannah.gnu.org/releases/getfem/doc/gmm_userdoc.pdf > ) > > or with Microsoft Visual Studio (you can use free Community edition). You > can find MSVC solution in msvc directory of the distribution. > > Unfortunately, the solution for MSVC is not kept up-to-date and you would > need to re-add all getfem sources to it to make it work. > > > > You can deform your mesh with a simple call: > > auto deformator = temporary_mesh_deformator(mf, U, true, false); > > //the first true means "deform on creation", the second false means > "do not restore the mesh back when temporary_mesh_deformator reaches the > end of life" > > mf - is the mesh_fem for your displacement field and U is the > displacement vector with gmm::vect_size(U) = mf.nb_dof(); > > > > Best regards, > > Andriy > > > > > > On Thu, 8 Nov 2018 at 01:15, Zhenghuai Guo <zhenghuai....@unsw.edu.au> > wrote: > > Dear Andriy, > > > > Thank you for your explanation. > > > > Regarding creep, at the moment I only use liner_elasticity_brick with > young’s modulus being changed on each time-step. This is just to start > with. I am new in Getfem in fact. > > > > Could you please advise about the follows? > > > > 1. Are you using c++ to run getfem? If so, can you give some hints > how I can to it? I can’t see any instruction about setting up for c++. > 2. If you don’t use c++, how do you normally use the > *getfem::temporary_mesh_deformator > (from getfem_deformable_mesh.h) or other C functions? * > > > > I was trying to see if it is possible to use this function in Python > interface by using SWIG or Python.Boost. But it is far beyond my knowledge. > > > > Thank you very much > > > > Regards > > Zhenghuai Guo > > > > *From:* Andriy Andreykiv <andriy.andrey...@gmail.com> > *Sent:* Wednesday, November 7, 2018 8:32 PM > *To:* Zhenghuai Guo <zhenghuai....@unsw.edu.au> > *Cc:* getfem-users@nongnu.org > *Subject:* Re: [Getfem-users] mesh_deformation > > > > Dear Zhenghuai Guo, > > > > I don't use Python interface much, but your assumption is correct, > using getfem::temporary_mesh_deformator (from getfem_deformable_mesh.h) > you can apply displacement field to the mesh. > > By default temporary_mesh_deformator will deform the mesh and un-deform > it in the destructor, unless you build it with the argument > to_be_restored=false. > > I only assume that you can do it with Python too. > > > > I'm not really experienced with creep, but intuitively I would assume that > you can also use large deformation formulation to account for the change in > geometry. > > Or it's not how you intend it? > > > > In your follow up email you are asking about the usage of mesh slices. > From what I know it's used primarily for post-processing, not calculation. > If you intend to use it solely for > > post-processing than you can easily achieve it nowadays with Paraview, > were you import a vtk file, warp the result with a displacement field and > take a desired slice. > > > > Best regards, > > Andriy > > > > On Sat, 3 Nov 2018 at 12:33, Zhenghuai Guo <zhenghuai....@unsw.edu.au> > wrote: > > Dear Sir or Madam, > > > > Could you please advise how I and deform a mesh according to a > displacement field? > > > > I am trying to simulate a time dependent deformation of a cylinder like > object using python-interface. After applying stress the object creeps with > time. > > > > I think I can just go with many small time steps. In each time step, I > would like to update and deform the mesh according to the displacement > calculated as a function of time. And the deformed mesh will be an input > for next time step. > > > > I can see there is some related information such as (1) > ‘getfem_deformable_mesh.h’ in page 18 in > https://download-mirror.savannah.gnu.org/releases/getfem/doc/getfem_project.pdf > (2) ‘getfem::slicer_apply_deformation’ in > http://getfem.org/userdoc/export.html#getfem::slicer_apply_deformation . > But I can find details examples. > > > > Thank you very much > > Zhenghuai Guo > > *Tyree Xray CT network facility, School of Minerals and Energy Engineering > Resources, UNSW Sydney* > > > > > > > >