Migrating from phipict.grid
Code that builds grids with phipict.grid.shapes and sets up blocks by hand
can move to phipict.meshing step by step. The shortest step keeps the
existing grid and only wraps it:
import torch
import phipict.meshing as pm
from phipict.grid import shapes
grid = shapes.make_wall_refined_ortho_grid(
64, 32, corner_lower=(0, -1), corner_upper=(4, 1),
wall_refinement=["-y", "+y"], base=1.05,
)
walls = pm.Patch("walls", pm.Wall())
block = pm.MeshBlock.from_coords(grid, patches=pm.FacePatches(y_minus=walls, y_plus=walls))
mesh = pm.Mesh([block])
mesh.make_periodic("x")
The replacements below reproduce the legacy grids: the test suite rebuilds the fluidgym cylinder, airfoil and Rayleigh-Bénard meshes with them and compares the vertices.
Functions
|
|
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Two differences in meaning:
The legacy
x_weightsofgenerate_grid_vertices_2Ddistribute the vertices along y (they are the weights of the x borders); here every grading belongs to the axis it is given for.The legacy
refinementofmake_weights_expnames where the exponent starts, sobase < 1refines the other end.Geometrickeeps that behaviour for exact reproduction; for new code,SimpleandSymmetricstate the refinement directly.
Domain setup
Before |
With |
|---|---|
|
|
|
nothing: coinciding faces are connected |
|
|
|
a patch with |
|
a patch with |
|
a patch with |
|
a patch with |
|
|
|
|
examples/hartmann.py and examples/duct.py show the result for two simple
cases, tests/meshing/test_references.py for the fluidgym geometries.