ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Creating Periodic Lines in the Gmsh Python API Using Affine Transformations

Автор: vlogommentary

Загружено: 2025-12-19

Просмотров: 0

Описание: Learn how to correctly set up periodic boundary conditions on lines in Gmsh using the Python API with affine transformations for meshing periodic geometries.
---
This video is based on the question https://stackoverflow.com/q/79466893/ asked by the user 'Albacete' ( https://stackoverflow.com/u/19925891/ ) and on the answer https://stackoverflow.com/a/79470985/ provided by the user 'Michael Ermakov' ( https://stackoverflow.com/u/27846293/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Periodic Line in Gmsh Python api: affineTransform needed?

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.

If anything seems off to you, please feel free to drop me a comment under this video.
---
Introduction

When meshing geometries with periodic boundaries—such as matching opposite edges of a rectangular surface—Gmsh’s .geo scripting language provides a straightforward syntax using Periodic Line definitions. However, the equivalent operation in the Gmsh Python API requires an explicit affine transformation matrix as part of gmsh.model.mesh.setPeriodic(), which can confuse new users.

The Challenge

In .geo scripts, periodic lines are defined simply like this:

[[See Video to Reveal this Text or Code Snippet]]

This automatically maps one boundary curve to another without specifying transformation parameters.

In the Python API though, the setPeriodic() method requires:

The dimension of the entity (e.g., 1 for lines),

A list of 'slave' entity tags,

A list of corresponding 'master' entity tags,

An affine transformation matrix (a 4x4 matrix flattened to 16 elements) describing how the master’s coordinates map to the slave’s.

Without providing this transform, an error occurs, unlike .geo where Gmsh infers it.

Setting Up Periodic Lines in Python

To replicate .geo periodic lines in Python, you must:

Build your geometry using OpenCASCADE and synchronize:

[[See Video to Reveal this Text or Code Snippet]]

Define the affine transformations explicitly:

The affine transform is a 4x4 matrix written in row-major order.

For example, to map the top line to the bottom line, or right to left, you typically need translation and possibly reflection.

Example for periodicity between opposite lines:

[[See Video to Reveal this Text or Code Snippet]]

Generate mesh and launch GUI:

[[See Video to Reveal this Text or Code Snippet]]

Key Points

You must synchronize the OpenCASCADE model with gmsh.model.occ.synchronize() before setting periodic entities.

The affine transform matrix must be 4x4 and encode any translation, rotation, or reflection to relate master and slave lines.

Geometry from .geo scripts hides these transforms, but Python requires explicit input for clarity and flexibility.

Summary

Using periodic boundary conditions in the Gmsh Python API requires an explicit affine transformation. While .geo scripting auto-infers this for simple cases, Python needs a 4x4 matrix defining how two geometry entities correspond. With careful setup of points, lines, and appropriate affine transforms, you can achieve periodic meshing just as seamlessly.

This explicit control also enables more complex periodic setups beyond rectangular cases.



References:

Gmsh Python API Documentation

Gmsh periodic meshes example

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Creating Periodic Lines in the Gmsh Python API Using Affine Transformations

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Reinforcement Learning Tutorial - RLVR with NVIDIA & Unsloth

Reinforcement Learning Tutorial - RLVR with NVIDIA & Unsloth

Is Zorin OS the Best Windows Replacement?

Is Zorin OS the Best Windows Replacement?

Algorithms and Cognition

Algorithms and Cognition

Satya Nadella demos an app he built | Microsoft AI Tour Bengaluru

Satya Nadella demos an app he built | Microsoft AI Tour Bengaluru

5 фатальных ОШИБОК на фрилансе, которые стоили мне СВОБОДЫ

5 фатальных ОШИБОК на фрилансе, которые стоили мне СВОБОДЫ

Cluster Agents Are Great... 90% of AI Coding Workflows Are Done Now

Cluster Agents Are Great... 90% of AI Coding Workflows Are Done Now

Интернет в небе: Сергей

Интернет в небе: Сергей "Флеш" о том, как «Шахеды» и «Герберы» научились работать в одной связке

Vibe Coding with Elixir: Harnessing AI to Build Real-World Apps - Micah Woods | ElixirConf US 2025

Vibe Coding with Elixir: Harnessing AI to Build Real-World Apps - Micah Woods | ElixirConf US 2025

Prezydent Zełenski: Rosja pragnie zrujnować stosunki Polski z Ukrainą

Prezydent Zełenski: Rosja pragnie zrujnować stosunki Polski z Ukrainą

Christmas Songs Playlist 🎄Top Christmas Songs of All Time 🎅 Best Christmas Music 2026

Christmas Songs Playlist 🎄Top Christmas Songs of All Time 🎅 Best Christmas Music 2026

ChatGPT Image 1.5 Just Made Editing WAY Easier

ChatGPT Image 1.5 Just Made Editing WAY Easier

KSIĄŻĘ LUBOMIRSKI-LANCKOROŃSKI, TELEFON OD WIDZA I DŁUGI. GDZIE SĄ PIENIĄDZE?

KSIĄŻĘ LUBOMIRSKI-LANCKOROŃSKI, TELEFON OD WIDZA I DŁUGI. GDZIE SĄ PIENIĄDZE?

GPT-5.2 Hands-On Testing – Is THIS OpenAI’s Best Model?

GPT-5.2 Hands-On Testing – Is THIS OpenAI’s Best Model?

CEP - W Naddniestrzu ogłoszono stan wyjątkowy. Kolejny duży problem dla Moskwy.

CEP - W Naddniestrzu ogłoszono stan wyjątkowy. Kolejny duży problem dla Moskwy.

Prezydent Nawrocki: Wizyta prezydenta Ukrainy to dobra informacja dla naszego regionu, dla Rosji zła

Prezydent Nawrocki: Wizyta prezydenta Ukrainy to dobra informacja dla naszego regionu, dla Rosji zła

Fixing href Path Issues in Navigation Bars Across Multiple HTML Pages

Fixing href Path Issues in Navigation Bars Across Multiple HTML Pages

GŁUCHY, ŚLEPY I NIEMY BUDUJĄ Z LEGO

GŁUCHY, ŚLEPY I NIEMY BUDUJĄ Z LEGO

From Prompt to Context Engineering: Spark Your Ideas the Right Way - Debbie O'Brien

From Prompt to Context Engineering: Spark Your Ideas the Right Way - Debbie O'Brien

How to Prevent a JavaScript Function from Running Multiple Times Before Completion

How to Prevent a JavaScript Function from Running Multiple Times Before Completion

Googles AI Boss Reveals What AI In 2026 Looks Like

Googles AI Boss Reveals What AI In 2026 Looks Like

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]