Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2d1061a
Preliminary version of FEM solver.
jbrezmorf Nov 12, 2023
11080f1
Improved interpolation fields stability.
jbrezmorf Dec 12, 2023
e7b552f
Merge remote-tracking branch 'origin/master' into JB_homo
jbrezmorf Mar 20, 2024
6b28638
Equivalent scalar and tensor properties.
jbrezmorf Mar 26, 2024
8c48cb1
Improved FEM test.
jbrezmorf Mar 26, 2024
7cb5cc1
Add bgem.core from Endorse
jbrezmorf Mar 26, 2024
8902654
Reference solution for two-scale homogenization test.
jbrezmorf Mar 26, 2024
25fd13b
Working anisotropic homogenization, test_rasterize
jbrezmorf Apr 3, 2024
489aa00
Minor improvements and fixes.
jbrezmorf Apr 3, 2024
f54c4ca
El and dof natural numbering consistent with ndarray.
jbrezmorf Apr 7, 2024
b20ad52
Fix numberings in test_two_scale
jbrezmorf Apr 7, 2024
e139429
Triangle and tetra refinement.
jbrezmorf Apr 11, 2024
58d01cd
Sparce FEM solver, refinement flow123d projection
jbrezmorf Apr 15, 2024
9084559
Improved creation of Population
jbrezmorf Apr 19, 2024
d621ac8
Merge branch 'JB_e' into JB_homo
jbrezmorf Apr 26, 2024
0c1ef6d
Fix attrs package usage.
jbrezmorf May 2, 2024
90ce12b
Add decovalex_transform to make reference voxelization work.
jbrezmorf May 2, 2024
b6eac0f
Sparse mesh missing dependencies.
jbrezmorf May 2, 2024
4827c9c
DFN refactoring (WIP)
jbrezmorf May 2, 2024
8ef0f34
Stub of new test files
jbrezmorf May 2, 2024
94c370b
stub changes to carfully review
jbrezmorf May 2, 2024
f319612
Merge modifications from stash.
jbrezmorf May 2, 2024
c065538
Merge branch 'master' into JB_homo
jbrezmorf May 2, 2024
b6c3562
Fix core.config for yamlinclude
jbrezmorf Jun 12, 2024
1128610
Refactoring of the stochastic fracture generation.
jbrezmorf Jun 12, 2024
790cb99
Upscaling and voxelization tools update.
jbrezmorf Jun 12, 2024
5cee57f
Split FEM into Grid and FEM
jbrezmorf Jun 20, 2024
d98adfd
Elementary PyVista plotting
jbrezmorf Jun 25, 2024
80dcb34
Fixes in DFN
jbrezmorf Jul 30, 2024
d8e957e
Vectorized transfom matrix for fractures.
jbrezmorf Jul 30, 2024
74fbdcc
Fixed vectorised transform_mat
jbrezmorf Aug 2, 2024
84d6457
FractureSet AABB, inv_transfomr
jbrezmorf Aug 14, 2024
95d6a39
More robust tests and fixes of transform_mat
jbrezmorf Aug 17, 2024
b02506c
Working intersection tests
jbrezmorf Aug 18, 2024
62fc5e6
Basic functionality of intersection field interpolation.
jbrezmorf Aug 20, 2024
1cf3363
Push some temporary work on ObjectSet.
jbrezmorf Nov 5, 2024
0af3f74
Some new operations, need tests and review.
jbrezmorf Nov 5, 2024
b057e88
Make vectorized rotation staticmethod
jbrezmorf Dec 23, 2024
3307d7a
Add several functions working over dimtags.
Paulie14 Jan 14, 2025
2116fcb
Check file exists in importShapes function.
Paulie14 Mar 20, 2025
d8eab61
Add dimtag object copy (kind of shallow copy).
Paulie14 Apr 4, 2025
e9e3290
Fix numpy product in fractures.
Paulie14 Apr 4, 2025
428aecb
Add gmsh mesh option RandomSeed.
Paulie14 Sep 19, 2025
59161f8
Improve and debug gamma computation in heal mesh.
Paulie14 Sep 30, 2025
b1b6146
Fixed all stochastic tests
jbrezmorf Oct 2, 2025
27a639b
Add construction of fracture family both with p30 and p32.
Paulie14 Dec 9, 2025
092791d
Fix missing attrs dependence.
Paulie14 May 5, 2026
f9863c4
Add unit test for functions operating just over dimtags.
Paulie14 May 5, 2026
6dda222
Add codex agent config file.
Paulie14 May 5, 2026
c320233
Merge branch 'JB_homo' into PE_JB_homo_merge
Paulie14 May 6, 2026
f11ea72
Fix GeometryOcc singleton and guard gmsh initialized flag.
Paulie14 May 6, 2026
fe2f8e9
Minor numpy fix in poewr law size sampling.
Paulie14 May 12, 2026
2448e4c
Revert "Some new operations, need tests and review."
Paulie14 May 14, 2026
48b648e
Move gmsh finalize.
Paulie14 May 14, 2026
84f26b4
Propert dim_tags_set instead of dt_equal for comparing ObjectSets.
Paulie14 May 15, 2026
1cfb4c4
Add copy and deepcopy functions.
Paulie14 May 15, 2026
d3c0767
Add get mass function.
Paulie14 May 15, 2026
3dace96
Merge pull request #76 from GeoMop/PE_JB_homo_merge
jbrezmorf May 18, 2026
9870fe8
Fix FrFamily from_cfg construtor with p_30.
Paulie14 May 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tests/upscale/2d_flow_homo_samples
# Merge
*.py.orig

Expand Down
4 changes: 2 additions & 2 deletions .run/pytest in stochastic.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<module name="bgem" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
Expand Down
4 changes: 2 additions & 2 deletions .run/pytest test_bspline_approx.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<module name="bgem" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
Expand Down
5 changes: 4 additions & 1 deletion .run/pytest test_field.run.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest test_field" type="tests" factoryName="py.test">
<module name="bgem" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="DEBUG_JUST_MY_CODE" value="true" />
<option name="RUN_TOOL" value="" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;-s&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
Expand Down
5 changes: 4 additions & 1 deletion .run/pytest test_gmsh.run.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="pytest test_gmsh" type="tests" factoryName="py.test">
<module name="bgem" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="DEBUG_JUST_MY_CODE" value="true" />
<option name="RUN_TOOL" value="" />
<option name="_new_keywords" value="&quot;&quot;" />
<option name="_new_parameters" value="&quot;&quot;" />
<option name="_new_additionalArguments" value="&quot;&quot;" />
Expand Down
4 changes: 2 additions & 2 deletions .run/pytest in gmsh.run.xml → .run/test in gmsh.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<module name="bgem" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
Expand Down
4 changes: 2 additions & 2 deletions .run/test_brep_writer.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<module name="bgem" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<option name="_new_keywords" value="&quot;&quot;" />
Expand Down
3 changes: 2 additions & 1 deletion .run/tox all.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<module name="bgem" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="/usr/bin/python3" />
<option name="SDK_NAME" value="Python 3.10 (2)" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
Expand Down
4 changes: 3 additions & 1 deletion .run/tox in gmsh.run.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="tox in gmsh" type="Tox" factoryName="Tox">
<module name="bgem" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="/usr/bin/python3" />
<option name="SDK_NAME" value="Python 3.10 (2)" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
Expand Down
3 changes: 2 additions & 1 deletion .run/tox in stochastic.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<module name="bgem" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="SDK_HOME" value="/usr/bin/python3" />
<option name="SDK_NAME" value="Python 3.10 (2)" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
Expand Down
96 changes: 96 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# CODEX context for BGEM library

## Project summary

Bgem library is a intended as an extension or wrapper of GMSH python API.
It helps to keep tracks of the geometry objects during geometrical operations;
it introduces `ObjectSet` class keeping the tracks of dimtags and provides wrapper
functions to GMSH API calls.

Further it provides better interface to GMSH fields, reader/writer for GMSH meshes
and a HealMesh class that can help fixing degenerated elements in a given mesh.

Submodule called `Stochastic` provides generator for DFN (Discrete Fracture Network)
based on distributions used in geology.

## Project summary (short)

Robust open source tool for creation of parametric geometries and computational meshes via. Python code.
Primary focus are hydrogeological applications with geometries including both random fractures and deterministic natural or anthropogenic features.
Bgem library is a intended as an extension and/or wrapper of GMSH python API.

## CODEX Ignore Folders
- Not specified

## CODEX Readonly Folders
- Not specified

## Project Structure
- `src/bgem` - source files
- `tests` - pytest based unit tests of individual source blocks
- `tutorials` - integrated tests, currently insufficient

## `src/bgem/` Project Source Structure

- `bspline/` -
- `geometry/` -
- `gmsh/` - main functions providing interface for GMSH API
- `polygons/` -
- `stochastic/` - code for DFN generation


## CODEX Guidelines
- treat keyword 'AGENT:' in comments as a source context dependent message for your further development
- any comment containing `AGENT:` is an active developer instruction
- NEVER remove, rewrite, or move an `AGENT:` comment unless you implement that instruction in the same change
- if you make only a local fix around an `AGENT:` comment, leave the comment untouched
- if an `AGENT:` instruction looks outdated or wrong, ask before removing it
- never stage or commit changes yourself
- Always review your changes before finishing for human review.
- Do not touch anything outside the repository directory, unless directly asked!

## Status tracking
- `STATUS.md` is the handoff log for interrupted or multi-turn work. Update it when a session ends with unfinished relevant work, when the user asks for a status review, or when a fresh checkpoint would help the next session continue without re-discovery.
- Keep newest entry first. Do not rewrite older entries except to fix clearly factual mistakes.
- Start each entry with one line in this form:
`` `YYYY-MM-DD`: `<commit>` @ `<branch>` by `<author>` ``
- Under each entry keep exactly these sections in order:
`## Goal`
short statement of the intended task or checkpoint scope
`## Changes summary`
flat bullets describing committed changes first, then important staged/unstaged/untracked changes if they are relevant to continuing the task
`## Verified`
flat bullets with commands actually run and the important observed result
`## Open items`
flat bullets for remaining risks, missing verification, known breakage, or next recommended step
- Record only repo-relevant facts that help continuation. Skip conversational history, speculation, and incidental noise.
- When the worktree is dirty, explicitly distinguish committed, staged, unstaged, and untracked changes, but mention only files relevant to the tracked task.
- Prefer clickable file links for important files mentioned in `STATUS.md`.
- If verification was partial, say so plainly. Do not imply a full test pass when only compile checks, a single testcase, or CLI smoke checks were run.
- If a run failed, record the failing command and the actionable failure mode instead of hiding it.
- Before finishing a task that changed the practical project state, review whether `STATUS.md` still matches the actual branch/worktree state and update it if needed.

## Coding rules
- Best code, is no code!
- prefer functional style with poor functions;
ideally do not change objects after construction, all methods do calculations
only reading the data in the class
- prefer high level code: numpy, pandas, xarray instead loops and native python structures (lists, dicts)
- use logging
- Use logging for debug outputs.
- use pathlib
- use attrs for dataclasses
- use attrs staticmethod/classmethod technique to construct from other data then is stored in the dataclass
- Be defensive, with strong checks, but only for the user input data.
That means error inputs must raise early. Therefore only check for existing keys in input dicts
if these will be required down in a long calculation. Otherwise just let KeyError do the job.
- do not use "guess" default values, only obvious defaults
- Do not use other config keys in the case of a KeyError, just throw early.
- Do just basic asserts for consistency for function inputs.
- Can add more asserts if needed during debugging.
- NEVER resolve test errors by try blocks
- NEVER add runtime fallbacks or import shims to compensate for a broken or incomplete environment.
If a declared dependency or tool is missing, report the environment problem plainly and fix the environment or tests around it, but do not implement code workarounds.
- NEVER write "self explanatory" into comments
- in comments indicate by ?? if you are not certain about intent of particular variable, function, parameter ...

8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pytest
numpy
scipy
bih

# some test plottings that are not part of auto test suite
matplotlib
joblib
plotly
pyvista # fem plot
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
# eg: 'keyword1', 'keyword2', 'keyword3',
],

packages=['bgem', 'bgem.polygons', 'bgem.bspline', 'bgem.gmsh', 'bgem.external', 'bgem.geometry', 'bgem.stochastic'], #setuptools.find_packages(where='src'),
packages=['bgem', 'bgem.polygons', 'bgem.bspline', 'bgem.gmsh', 'bgem.external', 'bgem.geometry', 'bgem.stochastic',
'bgem.core', 'bgem.upscale'], #setuptools.find_packages(where='src'),
package_dir={'': 'src'},
#py_modules=[os.path.splitext(os.path.basename(path))[0] for path in glob.glob('src/*.py')],
# package_data={
Expand All @@ -56,7 +57,7 @@
include_package_data=True,
zip_safe=False,
#install_requires=['numpy', 'scipy', 'bih', 'gmsh-sdk<=4.5.1'],
install_requires=['numpy>=1.13.4', 'pandas', 'scipy', 'bih', 'gmsh>=4.10.4'],
install_requires=['numpy>=1.13.4', 'pandas', 'scipy', 'gmsh>=4.10.4', 'pyyaml-include', 'bih', 'nptyping', 'pyamg', 'attrs'],
# incompatible changes in SDK in release 4.6.0 to be changed in the new release of bgem
python_requires='>=3',
# extras_require={
Expand Down
7 changes: 7 additions & 0 deletions src/bgem/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .memoize import EndorseCache, memoize, File
from .common import substitute_placeholders, sample_from_population, workdir, array_attr
from .config import dotdict, load_config, apply_variant, dump_config
from .report import report
from .flow_call import call_flow, FlowOutput

year = 365.2425 * 24 * 60 * 60
Loading