Page MenuHomec4science

nonperiodic.py
No OneTemporary

File Metadata

Created
Fri, Jul 4, 03:10

nonperiodic.py

#!/usr/bin/env python3
#
# Copyright (©) 2016-2025 EPFL (École Polytechnique Fédérale de Lausanne),
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
# Copyright (©) 2020-2025 Lucas Frérot
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import tamaas as tm
import matplotlib.pyplot as plt
from tamaas.utils import publications, hertz_surface
# Surface size
n = 512
# Surface radius
R = 0.1
# Surface generator
surface = hertz_surface([1.0, 1.0], [n, n], R)
# Creating model
model = tm.ModelFactory.createModel(tm.model_type.basic_2d, [1.0, 1.0], [n, n])
tm.ModelFactory.registerNonPeriodic(model, "dcfft")
# Solver
solver = tm.PolonskyKeerRey(model, surface, 1e-9)
# Solve for target pressure
p_target = 1.2
solver.solve(p_target)
# Copy periodic solution
periodic_traction = model.traction.copy()
# Make solver use the non-periodic operator
solver.setIntegralOperator("dcfft")
solver.solve(p_target)
# The concact solver always shifts the displacement so that gap >= 0
# To compute the true displacement, one needs to re-evaluate the displacement
model.operators["dcfft"](model.traction, model.displacement)
delta = (9 * p_target**2 / (16 * R * model.E_star**2)) ** (1 / 3)
print(f"Hertzian interference = {delta:.4f}, computed = {model.displacement.max():.4f}")
fig, axs = plt.subplots(1, 2, figsize=(12, 4))
axs[0].imshow(periodic_traction)
axs[1].imshow(model.traction)
axs[0].set_title("Periodic tractions")
axs[1].set_title("Non-periodic tractions")
fig.tight_layout()
plt.show()
publications()

Event Timeline