Repository navigation
Improve Geometry class and fix CAD functions in psydac.cad - #527
Merged
Merged
Conversation
- Write 3D geometry in parallel without `mpi_dims_mask` - Read 3D geometry in parallel with `mpi_dims_mask` - Verify correct distribution of domain for any number of MPI processes
Add parameter `mpi_dims_mask` to class method `from_discrete_mapping` and bound method `read`.
Use new variable for dictionary with number of cells for each patch.
test methods from_discrete_mapping and from_topological_domain with mpi_dims_mask
- Add new constructor Geometry.from_file - Remove `filename` from __init__ parameters
commit ccbd6e3 Author: Yaman Güçlü <yaman.guclu@gmail.com> Date: Wed Oct 1 06:25:42 2025 +0200 Allow `mpi_dims_mask` with geometry file (#526) Add the optional parameter `mpi_dims_mask` to the constructor of class `Geometry`, as well as its class methods `from_discrete_mapping` and `from_topological_domain`. Add unit tests to verify that the domain is correctly decomposed. --------- Co-authored-by: Alisa Kirkinskaia <alisa.kirkinskaia@tum.de> Co-authored-by: Alisa Kirkinskaia <alisa.kirkinsk@gmail.com>
- Add function `get_available_mappings` - Clean up function `discrete_mapping` and add docstring to it
3 tasks done
yguclu
marked this pull request as draft
October 17, 2026 16:19
yguclu
marked this pull request as ready for review
October 17, 2026 16:19
Member
Author
|
@campospinto I have tried to address all of your comments |
campospinto
requested changes
Oct 19, 2026
campospinto
left a comment
Collaborator
There was a problem hiding this comment.
Thanks ! I see one possible issue, described in a comment, then I would approve the PR
…k profile of isort
yguclu
marked this pull request as draft
October 19, 2026 13:57
yguclu
marked this pull request as ready for review
October 19, 2026 13:57
campospinto
approved these changes
Oct 19, 2026
campospinto
left a comment
Collaborator
There was a problem hiding this comment.
thanks! I think the PR is now good to go
…h5py >= 3.16 requires mpi4py >= 4)
yguclu
marked this pull request as draft
October 19, 2026 16:31
yguclu
marked this pull request as ready for review
October 19, 2026 16:31
Member
Author
|
@campospinto Thanks for the review! I am doing some final cleanup and running the CI workflows once again. I am going to merge this PR shortly afterwards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve the
Geometryclass inpsydac.cad.geometry, so that all its constructors share the same__init__method and behave consistently in serial and parallel runs. Fix several bugs in the CAD functions ofpsydac.cad, and test them extensively.Geometryclass__init__(domain, *, ddm, pdim, mappings=None):ddmis aDomainDecomposition(one patch) or aMultiPatchDomainDecomposition(several patches); the number of cells, the periodicity, and the MPI communicator are obtained from itpdim(number of physical dimensions) is mandatory; before, it was always set equal to the number of logical dimensionsmappingsis optional; if given, each spline mapping must be defined on the domain decomposition of its patchncells,periodic,filename,comm, andmpi_dims_maskwere removed__init__is discouraged: users should call the factory class methodsfrom_file(filename, *, domain=None, comm=None, mpi_dims_mask=None), which replacesGeometry(filename=...)and the methodread(removed):domainis given, it is kept after checking that it matches the topological domain in the file: dimension, patch names, parametric bounds, and interfaces (including their orientation). An error is raised if a patch has no mapping or an analytical mappingpdim=1now works (fixesGeometrycannot read multipatch geometries withpdim=1#617)patch_10is sorted beforepatch_2)from_discrete_mapping(mapping, *, name=None)uses the domain decomposition of the mapping's space; argumentscommandmpi_dims_maskwere removedfrom_topological_domainrequires all the patches of its input domain to beNCubeInteriorobjects of the same dimension (i.e. all lines, all squares, or all cubes)from_topological_domainandfrom_discrete_mappinguse the physical dimension of the mappings (before, it was always equal to the logical dimension)mappings,ncells, andperiodicare dictionaries keyed by the names of the domain interiors, in the same order;ncellsandperiodiccontain tuplesis_parallelexportraises aValueErrorbefore creating the file if a patch has no spline mapping, instead of anAttributeErrorwith a partially written file (fixesGeometry.exportfails withAttributeErrorfor a geometry without spline mappings #631)CAD functions in
psydac.cad.cadandpsydac.cad.galleryelevateandrefineuse Cartesian control points (as expected by igakit), and the NURBS functions ofpsydac.cad.galleryreturn Cartesian (not homogeneous) control points (fixes Inconsistent NURBS control-point conventions distort geometries fromcad.gallery,elevateandrefine#608)translatekeeps the weights of NURBS mappings (fixescad.translatedrops the weights of NURBS mappings #609)elevateandrefineaccept spline mappings (fixescad.elevateandcad.refinereject spline mappings #610)elevateandrefinework for distributed mappings (fixescad.elevateandcad.refineare wrong for distributed mappings #611)elevateandrefinework for mappings withpdim=1(fixespsydac.cad.elevateandrefinefail for mappings withpdim=1#618)refineworks when inserting a value which is already a knot (fixespsydac.cad.refinefails when inserting a value which is already a knot #619)elevateandrefine, add docstring totranslate, and remove the obsolete__main__demo frompsydac.cad.cad__main__demo inpsydac/cad/gallery.pyis left for a separate PR (see Add exact NURBS geometries frompsydac.cad.gallerytopsydac mesh, with an option to plot #620)Other library changes
discretize(domain, filename=...)creates the geometry withGeometry.from_file(filename, domain=domain, ...), hence it keeps the given domain after checking that it matches the filediscretize_spaceandPostProcessManagerlook up the spline mappings by interior name onlyNurbsMapping.__init__checks that the weights field belongs to the mapping's space (fixesNurbsMapping.__init__does not check the weights field #616)DomainDecompositionstoresmpi_dims_mask(new property), which is kept byTensorFemSpace.add_refined_spaceandpsydac.cad.cad.refine(fixesDomainDecompositiondoes not storempi_dims_mask, which breaks refined spaces #622). Fix the number of local cells inDomainDecomposition.refine(fixesDomainDecomposition.refinereturns a decomposition with wronglocal_ncells#623)psydac.fem.partitioning.partition_coefficientsraises aValueErrorwith an explanation, instead of anAssertionError, when an MPI process owns too few coefficientspsydac.mapping.discrete_gallery, add functionget_available_mappings, add optionmpi_dims_masktodiscrete_mapping, give it explicit keyword-only arguments and a docstringshapeof NumPy arrays (deprecated since NumPy 2.5) inKroneckerLinearSolver, and use the latest version of Igakit (commit dalcinl/igakit@2a0c9ee), which includes the same fixNameErrorwas raised instead) inget_max_degree_of_one_space0.20.0, always provide the interface orientation toDomain.join, and add the interface orientation to the multipatch geometry files inpsydac/cad/mesh/multipatchGeometryAPI: factory methods and local imports inpoisson_2d.py, andfrom_discrete_mappingwithoutcomminpolar_model_2d.pypsydac/cad/__init__.pyno longer imports the submodules ofpsydac.cadUnit tests
psydac.cad.tests.test_cad: check thattranslate,elevate, andrefinepreserve the geometry, for spline and NURBS mappings, for curves in 1D/2D/3D, surfaces in 2D/3D, and volumes in 3D, both in serial and in parallelpsydac.cad.tests.test_gallery: check the circular edges of the NURBS gallery mappingspsydac.cad.tests.test_geometry:from_discrete_mapping, in 1D and 2D, and for NURBS curves in 1D/2D/3D and surfaces in 3Dfrom_filewith correct and wrong domains, with one and two patches, in 1D and 2Dfrom_filewith 11 patches, to check that the patches are paired with the domain interiors by nameexportraises aValueError, without creating a file, for a geometry without spline mappings__init__without mappings, and reading a multipatch geometry filetmp_pathfrom Pytest andmpi_tmp_pathfrompytest-mpi), so that the tests can run in parallel withpytest-xdistpsydac.api.tests.test_discretization, testingget_max_degree_of_one_spaceandget_max_degreeNurbsMapping.__init__psydac.ddm.tests.test_cart: test the propertympi_dims_maskofDomainDecomposition, and check thatDomainDecomposition.refinekeeps the process grid (DomainDecompositiondoes not storempi_dims_mask, which breaks refined spaces #622) and the number of local cells (DomainDecomposition.refinereturns a decomposition with wronglocal_ncells#623), in parallelpsydac.fem.tests.test_partitioning: check thatpartition_coefficientsraises aValueErrorwhen an MPI process owns too few coefficients, for periodic and non-periodic spaces (at least 2 processes)Continuous integration and developer tools
ubuntu_installationsaction indocumentationworkflow, and name the checkout step intestingworkflowpyproject.toml, and configure isort with the profile of black, so that the two tools agreeAGENTS.mdwith developer rules: project overview, tech stack, code standards, testing conventions (including MPI tests), file structure, workflow (squash merge, CHANGELOG format, issues), and lint checks to run on the changed files