Dear Getfem-users, to check whether i understand correctly the implementation (and because it's actually much clearer in my code that way), i am trying to replace some predefined bricks for strain energy by the equivalent version using GWFL. For that, i have several questions
*First question* For instance lawname = 'SaintVenant Kirchhoff' clambda,cmu = params["clambda"],params["cmu"] model.add_initialized_data('paramsSVK', [clambda, cmu]) idBrick=model.add_finite_strain_elasticity_brick(mim, lawname, 'u', 'paramsSVK') becomes clambda,cmu = params["clambda"],params["cmu"] model.add_initialized_data('paramsSVK', [clambda, cmu]) idBrick=model.add_nonlinear_generic_assembly_brick(mim, "(paramsSVK(1)/2)*pow(Trace(Green_Lagrange_E),2)+paramsSVK(2)*Trace(Green_Lagrange_E'*Green_Lagrange_E)" ) And the results seems to be the same. However, for the incompressible Mooney Rivlin strain energy case, it does not behave as i expected Using the example there as a basis in a 3D case https://github.com/getfem-doc/getfem/blob/master/interface/tests/python/demo_nonlinear_elasticity.py and after some simplifications I have tried to replace the last line in lawname = 'Incompressible Mooney Rivlin' model.add_initialized_data('paramsIMR', [1,1]) model.add_finite_strain_elasticity_brick(mim, lawname, 'u', 'paramsIMR') By this model.add_nonlinear_generic_assembly_brick(mim, "Incompressible_Mooney_Rivlin_potential(Grad_u, [paramsIMR(1);paramsIMR(2)])") Which was exactly the same, of course. Next, i have tried to replace it by these lines model.add_macro("F", "Grad_u+Id(3)") model.add_nonlinear_generic_assembly_brick(mim, "paramsIMR(1)* ( Matrix_j1(Right_Cauchy_Green(F)) - 3 )+ paramsIMR(2)* ( Matrix_j2(Right_Cauchy_Green(F)) - 3 )") Which failed to converge I thought this expression was consistent with the implementation of Mooney_Rivlin_hyperelastic_law::strain_energy and the compute_invariants here http://download-mirror.savannah.gnu.org/releases/getfem/doc/getfem_reference/getfem__nonlinear__elasticity_8cc_source.html and the documentation https://getfem.org/userdoc/model_nonlinear_elasticity.html?highlight=finite%20strain But, clearly, i am missing something. Could you explain what I am doing wrong? Second question In a 2D case, i would like to be able to use either a plane strain approximation based on a given strain energy expression in 3D. In the implementation, it is nicely done in scalar_type plane_strain_hyperelastic_law::strain_energy there http://download-mirror.savannah.gnu.org/releases/getfem/doc/getfem_reference/getfem__nonlinear__elasticity_8cc_source.html Is it possible to do the same using the GWFL? *Third question* I would like to be able to compute the von-mises field for any strain energy function. If It is an existing brick, the method md.compute_finite_strain_elasticity_Von_Mises(lawname, 'u', 'params', mfdu) will do the trick just fine. If it's not the case, i guess i can use something akin to the actual implementation of compute_finite_strain_elasticity_Von_Mises <http://download-mirror.savannah.gnu.org/releases/getfem/doc/getfem_reference/namespacegetfem.html#a9166bc2065a4f2b5633e2e933ec3e693> std::string expr = "sqrt(3/2)*Norm(Deviator(Cauchy_stress_from_PK2(" + adapted_lawname + "_PK2(Grad_" + varname + "," + params + "),Grad_" + varname + ")))"; ga_interpolation_Lagrange_fem(md, expr, mf_vm, VM, rg); } combined with local_projection to get the value at the elements. The question is: is it possible to compute Piola Kirchhoff 2 from the strain energy within the GWFL expression given to local_projection? I have the impression it's the only thing i need to be able to do what i want. Let W be a strain energy function and E be the Green-Lagrange tensor (defined as macros, let's say), is Diff(W, E) doing exactly what i am expecting for this purpose? If it's not the case, is there another way to do it? Thank you in advance, kind regards, David.