Commit 53f479f5 authored by Jeremy BLEYER's avatar Jeremy BLEYER

Started contact penalty example

parent 06f459d0
......@@ -12,6 +12,6 @@ Contents:
demo/viscoelasticity/linear_viscoelasticity.ipynb
demo/2D_plasticity/vonMises_plasticity.py.rst
demo/contact/penalty.ipynb
......@@ -24,7 +24,7 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Beams and plates" href="../../beams_and_plates.html" />
<link rel="next" title="Hertzian contact with a rigid indenter using a penalty approach" href="../contact/penalty.html" />
<link rel="prev" title="Linear viscoelasticity" href="../viscoelasticity/linear_viscoelasticity.html" />
</head>
<body>
......@@ -35,7 +35,7 @@
<div class="rel" role="navigation" aria-label="related navigation">
<a href="../viscoelasticity/linear_viscoelasticity.html" title="Linear viscoelasticity"
accesskey="P">previous</a> |
<a href="../../beams_and_plates.html" title="Beams and plates"
<a href="../contact/penalty.html" title="Hertzian contact with a rigid indenter using a penalty approach"
accesskey="N">next</a> |
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a>
......@@ -431,6 +431,7 @@ when considering a zero hardening modulus.</p>
<li class="toctree-l1 current"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......@@ -465,7 +466,7 @@ when considering a zero hardening modulus.</p>
<div role="navigation" aria-label="related navigaton">
<a href="../viscoelasticity/linear_viscoelasticity.html" title="Linear viscoelasticity"
>previous</a> |
<a href="../../beams_and_plates.html" title="Beams and plates"
<a href="../contact/penalty.html" title="Hertzian contact with a rigid indenter using a penalty approach"
>next</a> |
<a href="../../genindex.html" title="General Index"
>index</a>
......
......@@ -241,6 +241,7 @@ writing/reading. Prefered output format is now .xdmf:</p>
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -2826,6 +2826,7 @@ if (IPython.notebook.kernel != null) {
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -219,6 +219,7 @@ that:</p>
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -282,6 +282,7 @@ and the beam theory eigenfrequencies :</p>
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -2162,6 +2162,7 @@ if (IPython.notebook.kernel != null) {
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -216,6 +216,7 @@ so that no term arise in the linear functional):</p>
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul class="current">
......
......@@ -209,6 +209,7 @@ the thin plate solution.</p>
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul class="current">
......
......@@ -4348,6 +4348,7 @@ if (IPython.notebook.kernel != null) {
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -2912,6 +2912,7 @@ Mechanics and Engineering, 85(3), 349-365.
<li class="toctree-l1"><a class="reference internal" href="../../nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="../2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="../contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -84,6 +84,7 @@
<li class="toctree-l1"><a class="reference internal" href="nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -92,6 +92,7 @@
<li class="toctree-l1"><a class="reference internal" href="nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -76,6 +76,7 @@
<li class="toctree-l1"><a class="reference internal" href="nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......@@ -123,6 +124,7 @@
<li class="toctree-l1"><a class="reference internal" href="nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -98,6 +98,7 @@
<li class="toctree-l1"><a class="reference internal" href="nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -58,6 +58,7 @@
<ul>
<li class="toctree-l1"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l1"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</div>
</div>
......@@ -93,6 +94,7 @@
<li class="toctree-l1 current"><a class="current reference internal" href="#">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......
......@@ -107,6 +107,7 @@
<li class="toctree-l1"><a class="reference internal" href="nonlinear_problems.html">Nonlinear problems in solid mechanics</a><ul>
<li class="toctree-l2"><a class="reference internal" href="demo/viscoelasticity/linear_viscoelasticity.html">Linear viscoelasticity</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/2D_plasticity/vonMises_plasticity.py.html">Elasto-plastic analysis of a 2D von Mises material</a></li>
<li class="toctree-l2"><a class="reference internal" href="demo/contact/penalty.html">Hertzian contact with a rigid indenter using a penalty approach</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="beams_and_plates.html">Beams and plates</a><ul>
......
This diff is collapsed.
......@@ -12,6 +12,6 @@ Contents:
demo/viscoelasticity/linear_viscoelasticity.ipynb
demo/2D_plasticity/vonMises_plasticity.py.rst
demo/contact/penalty.ipynb
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Hertzian contact with a rigid indenter using a penalty approach\n",
"\n",
"In this numerical tour, we explore the formulation of frictionless contact between a rigid surface (the indenter) and an elastic domain, representing an infinite half-space for the present case. Contact will be solved using a penalty formulation, that is small interpenetration between the solid and the identer will be authorized. Prerequisites for this tour are the formulation of an linear elasticity problem and the resolution of a general nonlinear variational problem."
]
},
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
".. figure:: contact_problem.png\n",
" :scale: 20%\n",
" :align: center\n",
" \n",
" Hertzian contact problem of a rigid spherical indenter on a semi-infinite domain"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The elastic (isotropic $E,\\nu$) solid will be represented by a 3D cubic domain of unit dimension and contact will take place on its top surface $z=0$, centered at $x=y=0$. Symmetry conditions will be applied on the $x=0$ and $y=0$ surfaces whereas the bottom surface $z=-1$ will be fully fixed. If contact appears on a small region of extent $a\\ll 1$, the problem can then be considered to be a good approximation of contact on a semi-infinite domain.\n",
"\n",
"The rigid indenter will not be explictly modeled (in terms of mesh in particular) but instead its distance with respect to the solid top surface will be given as an ``Expression``. We will also consider that the indenter radius $R$ is sufficiently large with respect to the contact region characteristic size $a$ so that the spherical surface can be approximated by a parabola. In this case, the distance between such an indenter and the top surface can be written as:\n",
"\n",
"\\begin{equation}\n",
"h(x,y) = h_0 + \\dfrac{1}{2R}(x^2+y^2)\n",
"\\end{equation}\n",
"\n",
"where $h_0$ is the initial gap between both surfaces at $x=y=0$. Obviously, if $h_0>0$ there is no contact between both surfaces, contact appears only if $h_0=-d<0$ where $d$ will be the indenter depth inside the surface. This classical problem admits the following known analytical solution **[REF?]**:\n",
"\n",
"* the contact area is of circular shape and radius $a=\\sqrt{Rd}$\n",
"* the force exerted by the indenter onto the surface is $F=\\dfrac{4}{3}\\dfrac{E}{1-\\nu^2}ad$\n",
"* the pressure distribution on the contact region is given by $p(r) = p_0\\sqrt{1-(r/a)^2}$ where $p_0=3F/(2\\pi a^2)$ is the maximal pressure\n"
]
},
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
".. figure:: contact_solution.png\n",
" :scale: 20%\n",
" :align: center\n",
" \n",
" Indent at depth :math:`d` (left) and contact solution (right)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Contact problem formulation and penalty approach\n",
"\n",
"The unilateral contact (Signorini) condition on the top surface $\\Gamma$ writes as:\n",
"\n",
"\\begin{equation}\n",
"g \\geq 0, p\\geq 0, g\\cdot p =0 \\text{ on }\\Gamma\n",
"\\end{equation}\n",
"\n",
"where $g=h-u$ is the gap between the obstacle surface and the solid surface and $p$ is the pressure. One of the most simple way to solve approximately this contact condition consists in replacing the previous complementary conditions by the following penalized condition:\n",
"\n",
"\\begin{equation}\n",
"p = k\\ppos(-g)\n",
"\\end{equation}\n",
"\n",
"where $k$ is a large penalizing stiffness coefficient. With the previous relation, the pressure will be positive but a small negative gap will be authorized. "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Calling FFC just-in-time (JIT) compiler, this may take some time.\n",
"Calling FFC just-in-time (JIT) compiler, this may take some time.\n",
"Maximum pressure FE: 1.42763078681 Hertz: 1.39916433487:\n",
"Applied force FE: 0.0320642723007 Hertz: 0.029304029304:\n"
]
}
],
"source": [
"from dolfin import *\n",
"import numpy as np\n",
"\n",
"N = 30\n",
"mesh = UnitCubeMesh.create(N, N, N/2, CellType.Type_hexahedron)\n",
"mesh.coordinates()[:, :2] = mesh.coordinates()[:, :2]**2\n",
"mesh.coordinates()[:, 2] = -mesh.coordinates()[:, 2]**2\n",
"\n",
"class Top(SubDomain):\n",
" def inside(self, x, on_boundary):\n",
" return near(x[2], 0.) and on_boundary\n",
"def symmetry_x(x, on_boundary):\n",
" return near(x[0], 0) and on_boundary\n",
"def symmetry_y(x, on_boundary):\n",
" return near(x[1], 0) and on_boundary\n",
"def bottom(x, on_boundary):\n",
" return near(x[2], -1) and on_boundary\n",
" \n",
"# exterior facets MeshFunction\n",
"facets = MeshFunction(\"size_t\", mesh, 2)\n",
"facets.set_all(0)\n",
"Top().mark(facets, 1)\n",
"ds = Measure('ds', subdomain_data=facets)\n",
"\n",
"R = 0.5\n",
"d = 0.02\n",
"obstacle = Expression(\"-d+(pow(x[0],2)+pow(x[1], 2))/2/R\", d=d, R=R, degree=2)\n",
"\n",
"E = Constant(10.)\n",
"nu = Constant(0.3)\n",
"mu = E/2/(1+nu)\n",
"lmbda = E*nu/(1+nu)/(1-2*nu)\n",
"\n",
"\n",
"V = VectorFunctionSpace(mesh, \"CG\", 1)\n",
"V2 = FunctionSpace(mesh, \"CG\", 1)\n",
"V0 = FunctionSpace(mesh, \"DG\", 0)\n",
"\n",
"u = Function(V, name=\"Displacement\")\n",
"du = TrialFunction(V)\n",
"u_ = TestFunction(V)\n",
"h = Function(V2)\n",
"gap = Function(V2, name=\"Gap\")\n",
"p = Function(V0, name=\"Contact pressure\")\n",
"\n",
"\n",
"def border(x, on_boundary):\n",
" return on_boundary\n",
"bc =[DirichletBC(V, Constant((0., 0., 0.)), bottom),\n",
" DirichletBC(V.sub(0), Constant(0.), symmetry_x),\n",
" DirichletBC(V.sub(1), Constant(0.), symmetry_y)]\n",
"\n",
"def eps(v):\n",
" return sym(grad(v))\n",
"\n",
"def sigma(v):\n",
" return lmbda*tr(eps(v))*Identity(3) + 2.0*mu*eps(v)\n",
"\n",
"def ppos(x):\n",
" return (x+abs(x))/2.\n",
"\n",
"pen = Constant(1e4)\n",
"form = inner(sigma(u), eps(u_))*dx + pen*dot(u_[2], ppos(u[2]-obstacle))*ds(1)\n",
"J = derivative(form, u, du)\n",
"problem = NonlinearVariationalProblem(form, u, bc, J=J)\n",
"solver = NonlinearVariationalSolver(problem)\n",
"solver.parameters[\"newton_solver\"][\"linear_solver\"] = \"cg\"\n",
"solver.parameters[\"newton_solver\"][\"preconditioner\"] = \"ilu\"\n",
"\n",
"\n",
"h.interpolate(obstacle)\n",
"solver.solve()\n",
"\n",
"p.assign(-project(sigma(u)[2, 2], V0))\n",
"gap.assign(project(h-u[2], V2))\n",
"\n",
"#pl = plot(p)\n",
"#plt.colorbar(pl)\n",
"#plt.show()\n",
"\n",
"a = sqrt(R*d)\n",
"F = 4/3.*float(E)/(1-float(nu)**2)*a*d\n",
"p0 = 3*F/(2*pi*a**2)\n",
"print(\"Maximum pressure FE: {} Hertz: {}:\".format(max(np.abs(p.vector().get_local())), p0))\n",
"print(\"Applied force FE: {} Hertz: {}:\".format(4*assemble(p*ds(1)), F))\n",
"\n",
"file_results = XDMFFile(\"contact_penalty_results.xdmf\")\n",
"file_results.parameters[\"flush_output\"] = True\n",
"file_results.parameters[\"functions_share_mesh\"] = True\n",
"file_results.write(u, 0.)\n",
"file_results.write(gap, 0.)\n",
"file_results.write(p, 0.)"
]
}
],
"metadata": {
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
This diff is collapsed.
This diff is collapsed.
Run or source recompile.sh to compile locally and reproduce the build failure.
// This code conforms with the UFC specification version 2017.2.0
// and was automatically generated by FFC version 2017.2.0.
//
// This code was generated with the following parameters:
//
// add_tabulate_tensor_timing: False
// convert_exceptions_to_warnings: False
// cpp_optimize: True
// cpp_optimize_flags: '-O2'
// epsilon: 1e-14
// error_control: False
// external_include_dirs: ''
// external_includes: ''
// external_libraries: ''
// external_library_dirs: ''
// form_postfix: False
// format: 'ufc'
// generate_dummy_tabulate_tensor: False
// max_signature_length: 0
// no-evaluate_basis_derivatives: True
// optimize: True
// precision: None
// quadrature_degree: None
// quadrature_rule: None
// representation: 'auto'
// split: False
#include "ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532.h"
// Based on https://gcc.gnu.org/wiki/Visibility
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define DLL_EXPORT __attribute__ ((dllexport))
#else
#define DLL_EXPORT __declspec(dllexport)
#endif
#else
#define DLL_EXPORT __attribute__ ((visibility ("default")))
#endif
ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise::ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise() : ufc::cell_integral()
{
}
ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise::~ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise()
{
}
const std::vector<bool> & ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise::enabled_coefficients() const
{
static const std::vector<bool> enabled({});
return enabled;
}
void ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise::tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
int cell_orientation) const
{
// This function was generated using 'uflacs' representation
// with the following integrals metadata:
//
// num_cells: None
// optimize: True
// precision: 16
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'uflacs'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 4
// optimize: True
// precision: 16
// quadrature_degree: 2
// quadrature_rule: 'default'
// quadrature_scheme: 'default'
// representation: 'uflacs'
// Quadrature rules
alignas(32) static const double weights3[3] = { 0.1666666666666667, 0.1666666666666667, 0.1666666666666667 };
// Precomputed values of basis functions and precomputations
// FE* dimensions: [entities][points][dofs]
// PI* dimensions: [entities][dofs][dofs] or [entities][dofs]
// PM* dimensions: [entities][dofs][dofs]
alignas(32) static const double FE3_C0_D01_Q3[1][1][2] = { { { -1.0, 1.0 } } };
// Unstructured piecewise computations
const double J_c0 = coordinate_dofs[0] * FE3_C0_D01_Q3[0][0][0] + coordinate_dofs[2] * FE3_C0_D01_Q3[0][0][1];
const double J_c3 = coordinate_dofs[1] * FE3_C0_D01_Q3[0][0][0] + coordinate_dofs[5] * FE3_C0_D01_Q3[0][0][1];
const double J_c1 = coordinate_dofs[0] * FE3_C0_D01_Q3[0][0][0] + coordinate_dofs[4] * FE3_C0_D01_Q3[0][0][1];
const double J_c2 = coordinate_dofs[1] * FE3_C0_D01_Q3[0][0][0] + coordinate_dofs[3] * FE3_C0_D01_Q3[0][0][1];
alignas(32) double sp[4];
sp[0] = J_c0 * J_c3;
sp[1] = J_c1 * J_c2;
sp[2] = sp[0] + -1 * sp[1];
sp[3] = std::abs(sp[2]);
alignas(32) double BF0[3][3] = {};
for (int iq = 0; iq < 3; ++iq)
{
const double fw0 = sp[3] * weights3[iq];
alignas(32) double TF0[3];
for (int iq = 0; iq < 3; ++iq)
TF0[iq] = fw0 * FE6_C0_Q3[0][iq][iq];
BF0[iq][iq] += TF0[iq] * FE6_C0_Q3[0][iq][iq];
}
std::fill(A, A + 9, 0.0);
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j)
A[3 * i + j] += BF0[i][j];
}
extern "C" DLL_EXPORT ufc::cell_integral * create_ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise()
{
return new ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_cell_integral_main_otherwise();
}
ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_form_main::ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_form_main() : ufc::form()
{
// Do nothing
}
ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_form_main::~ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_form_main()
{
// Do nothing
}
const char * ffc_form_9bc5ffe367d1e456432d1740919e312cffd43532_form_main::signature() const
{
return "51ba4a6892c7258409c64733e68d3a9c93fe29d25ed05b5c00edbe8413834f9891ef1766f7dcf5a646f87114b15a72a6cfd871861b5934e0da9b6d466ae05292";
}