beach-bem 0.6.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. beach_bem-0.6.2/AGENTS.md +67 -0
  2. beach_bem-0.6.2/LICENSE +201 -0
  3. beach_bem-0.6.2/MANIFEST.in +18 -0
  4. beach_bem-0.6.2/Makefile +61 -0
  5. beach_bem-0.6.2/PKG-INFO +173 -0
  6. beach_bem-0.6.2/README.md +161 -0
  7. beach_bem-0.6.2/SPEC.md +176 -0
  8. beach_bem-0.6.2/app/main.f90 +347 -0
  9. beach_bem-0.6.2/beach/__init__.py +43 -0
  10. beach_bem-0.6.2/beach/cli/__init__.py +1 -0
  11. beach_bem-0.6.2/beach/cli/animate_fortran_history.py +144 -0
  12. beach_bem-0.6.2/beach/cli/estimate_fortran_workload.py +968 -0
  13. beach_bem-0.6.2/beach/cli/inspect_fortran_output.py +164 -0
  14. beach_bem-0.6.2/beach/cli/plot_fortran_potential_slices.py +281 -0
  15. beach_bem-0.6.2/beach/cli_animate_fortran_history.py +5 -0
  16. beach_bem-0.6.2/beach/cli_estimate_fortran_workload.py +25 -0
  17. beach_bem-0.6.2/beach/cli_inspect_fortran_output.py +5 -0
  18. beach_bem-0.6.2/beach/cli_plot_fortran_potential_slices.py +5 -0
  19. beach_bem-0.6.2/beach/fortran_results/__init__.py +51 -0
  20. beach_bem-0.6.2/beach/fortran_results/animation.py +188 -0
  21. beach_bem-0.6.2/beach/fortran_results/constants.py +3 -0
  22. beach_bem-0.6.2/beach/fortran_results/coulomb.py +140 -0
  23. beach_bem-0.6.2/beach/fortran_results/facade.py +463 -0
  24. beach_bem-0.6.2/beach/fortran_results/history.py +315 -0
  25. beach_bem-0.6.2/beach/fortran_results/io.py +158 -0
  26. beach_bem-0.6.2/beach/fortran_results/mesh.py +88 -0
  27. beach_bem-0.6.2/beach/fortran_results/plotting.py +240 -0
  28. beach_bem-0.6.2/beach/fortran_results/potential.py +325 -0
  29. beach_bem-0.6.2/beach/fortran_results/selection.py +123 -0
  30. beach_bem-0.6.2/beach/fortran_results/types.py +216 -0
  31. beach_bem-0.6.2/beach_bem.egg-info/PKG-INFO +173 -0
  32. beach_bem-0.6.2/beach_bem.egg-info/SOURCES.txt +92 -0
  33. beach_bem-0.6.2/beach_bem.egg-info/dependency_links.txt +1 -0
  34. beach_bem-0.6.2/beach_bem.egg-info/entry_points.txt +5 -0
  35. beach_bem-0.6.2/beach_bem.egg-info/requires.txt +5 -0
  36. beach_bem-0.6.2/beach_bem.egg-info/top_level.txt +1 -0
  37. beach_bem-0.6.2/docs/fortran_parameter_file.md +276 -0
  38. beach_bem-0.6.2/docs/fortran_workflow.md +212 -0
  39. beach_bem-0.6.2/env/README.md +21 -0
  40. beach_bem-0.6.2/env/camphor.env +15 -0
  41. beach_bem-0.6.2/env/common.env +5 -0
  42. beach_bem-0.6.2/env/profile.template.env +20 -0
  43. beach_bem-0.6.2/examples/animate_fortran_history.py +20 -0
  44. beach_bem-0.6.2/examples/beach.toml +111 -0
  45. beach_bem-0.6.2/examples/estimate_fortran_workload.py +20 -0
  46. beach_bem-0.6.2/examples/inspect_fortran_output.py +20 -0
  47. beach_bem-0.6.2/examples/job_scripts/camphor_mpi_hybrid_job.sh +53 -0
  48. beach_bem-0.6.2/examples/plot_fortran_potential_slices.py +20 -0
  49. beach_bem-0.6.2/fpm.toml +69 -0
  50. beach_bem-0.6.2/install.sh +110 -0
  51. beach_bem-0.6.2/pyproject.toml +27 -0
  52. beach_bem-0.6.2/setup.cfg +4 -0
  53. beach_bem-0.6.2/setup.py +145 -0
  54. beach_bem-0.6.2/src/config/app_config_parser/bem_app_config_parser.f90 +571 -0
  55. beach_bem-0.6.2/src/config/app_config_parser/bem_app_config_parser_parse_utils.f90 +119 -0
  56. beach_bem-0.6.2/src/config/app_config_parser/bem_app_config_parser_validate.f90 +357 -0
  57. beach_bem-0.6.2/src/config/bem_app_config.f90 +15 -0
  58. beach_bem-0.6.2/src/config/bem_app_config_runtime.f90 +685 -0
  59. beach_bem-0.6.2/src/config/bem_app_config_types.f90 +181 -0
  60. beach_bem-0.6.2/src/core/bem_constants.f90 +7 -0
  61. beach_bem-0.6.2/src/core/bem_kinds.f90 +7 -0
  62. beach_bem-0.6.2/src/core/bem_mpi.F90 +198 -0
  63. beach_bem-0.6.2/src/core/bem_types.f90 +106 -0
  64. beach_bem-0.6.2/src/mesh/bem_importers.f90 +222 -0
  65. beach_bem-0.6.2/src/mesh/bem_mesh.f90 +241 -0
  66. beach_bem-0.6.2/src/mesh/bem_templates.f90 +635 -0
  67. beach_bem-0.6.2/src/particles/bem_injection.f90 +776 -0
  68. beach_bem-0.6.2/src/particles/bem_particles.f90 +44 -0
  69. beach_bem-0.6.2/src/physics/bem_boundary.f90 +98 -0
  70. beach_bem-0.6.2/src/physics/bem_collision.f90 +373 -0
  71. beach_bem-0.6.2/src/physics/bem_field.f90 +84 -0
  72. beach_bem-0.6.2/src/physics/bem_pusher.f90 +45 -0
  73. beach_bem-0.6.2/src/physics/field_solver/bem_field_solver.f90 +123 -0
  74. beach_bem-0.6.2/src/physics/field_solver/bem_field_solver_config.f90 +72 -0
  75. beach_bem-0.6.2/src/physics/field_solver/bem_field_solver_eval.f90 +105 -0
  76. beach_bem-0.6.2/src/physics/field_solver/bem_field_solver_tree.f90 +254 -0
  77. beach_bem-0.6.2/src/runtime/bem_restart.f90 +385 -0
  78. beach_bem-0.6.2/src/runtime/simulator/bem_simulator.f90 +125 -0
  79. beach_bem-0.6.2/src/runtime/simulator/bem_simulator_io.f90 +37 -0
  80. beach_bem-0.6.2/src/runtime/simulator/bem_simulator_loop.f90 +155 -0
  81. beach_bem-0.6.2/src/runtime/simulator/bem_simulator_stats.f90 +39 -0
  82. beach_bem-0.6.2/tests/fortran/test_app_config_parser.f90 +180 -0
  83. beach_bem-0.6.2/tests/fortran/test_boundary.f90 +69 -0
  84. beach_bem-0.6.2/tests/fortran/test_dynamics.f90 +265 -0
  85. beach_bem-0.6.2/tests/fortran/test_injection_sampling.f90 +182 -0
  86. beach_bem-0.6.2/tests/fortran/test_mpi_hybrid.f90 +174 -0
  87. beach_bem-0.6.2/tests/fortran/test_reservoir_injection.f90 +173 -0
  88. beach_bem-0.6.2/tests/fortran/test_restart.f90 +132 -0
  89. beach_bem-0.6.2/tests/fortran/test_simulator.f90 +149 -0
  90. beach_bem-0.6.2/tests/fortran/test_support.f90 +120 -0
  91. beach_bem-0.6.2/tests/fortran/test_templates_importers_runtime.f90 +253 -0
  92. beach_bem-0.6.2/tests/python/test_cli_error_messages.py +29 -0
  93. beach_bem-0.6.2/tests/python/test_estimate_fortran_workload.py +536 -0
  94. beach_bem-0.6.2/tests/python/test_fortran_results.py +1137 -0
@@ -0,0 +1,67 @@
1
+ # AGENTS.md
2
+
3
+ Always review in Japanese.
4
+
5
+ ## Project overview
6
+ This repository provides **BEACH (BEM + Accumulated CHarge)**.
7
+
8
+ - Main simulation engine: **Fortran** (`src/`, `app/`, managed by fpm)
9
+ - Python layer: post-processing / visualization / workload utilities (`beach/`, `examples/`)
10
+
11
+ Core batch loop (current Fortran implementation):
12
+ 1) compute E (and optional uniform B) from boundary-element charges
13
+ 2) advance particles with Boris pusher
14
+ 3) detect first collision against triangle elements
15
+ 4) deposit charge to hit element (insulator accumulation)
16
+ 5) commit charge deltas per batch and update stats/history
17
+
18
+ v0.x focuses on insulator accumulation. Keep extension points for conductor/resistive models.
19
+
20
+ ## Repo layout
21
+ - `src/`, `app/`: Fortran runtime and physics core
22
+ - `tests/fortran`: Fortran unit/integration tests (fpm targets)
23
+ - `beach/`: Python package for reading/plotting Fortran outputs
24
+ - `tests/python`: Python tests for CLI/result utilities
25
+ - `examples/`: runnable configs and helper scripts
26
+ - `docs/`, `SPEC.md`: behavior/spec documentation
27
+
28
+ ## Setup
29
+ Python utilities:
30
+ - `python -m pip install "git+https://github.com/Nkzono99/BEACH.git"` (builds Python + Fortran `beach` binary via `make`)
31
+ - `python -m pip install -U pip setuptools wheel`
32
+ - `python -m pip install -e . --no-build-isolation`
33
+
34
+ Fortran execution/testing requires a Fortran compiler (`gfortran` etc.) and `fpm`.
35
+
36
+ ## How to run
37
+ Fortran main (recommended):
38
+ - `python -m pip install "git+https://github.com/Nkzono99/BEACH.git"`
39
+ - `beach examples/beach.toml`
40
+
41
+ Fortran main (developer direct run):
42
+ - `make`
43
+ - `fpm run --profile release --flag "-fopenmp" -- examples/beach.toml`
44
+
45
+ Python CLI examples:
46
+ - `beach-inspect outputs/latest`
47
+ - `beach-animate-history outputs/latest --quantity charge --save-gif outputs/latest/charge_history.gif`
48
+ - `beach-estimate-workload examples/beach.toml --threads 8`
49
+
50
+ ## Tests / quality
51
+ - Python tests: `pytest -q`
52
+ - Python lint: `ruff check .`
53
+ - Fortran tests: `fpm test` (or per-target via `fpm test --target <name>`)
54
+
55
+ ## Coding rules
56
+ - Do not change public APIs without updating docs + examples.
57
+ - For core simulation behavior, treat Fortran implementation and docs (`SPEC.md`) as source of truth.
58
+ - Keep algorithms correctness-first; gate performance features behind flags.
59
+ - Add/extend tests when modifying field, collision, boundary, injection, or resume logic.
60
+ - Keep Python side lightweight; avoid heavy dependencies unless justified.
61
+
62
+ ## Simulator invariants (v0.x)
63
+ - Interaction: absorption only (default).
64
+ - Surface model: insulator accumulation only.
65
+ - Batch execution: run for configured `sim.batch_count` batches.
66
+ - Per-particle advance limit: `sim.max_step`.
67
+ - `tol_rel` is currently a monitoring/output metric and **not** an early-stop condition.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,18 @@
1
+ include LICENSE
2
+ include README.md
3
+ include AGENTS.md
4
+ include SPEC.md
5
+ include pyproject.toml
6
+ include setup.py
7
+ include Makefile
8
+ include install.sh
9
+ include fpm.toml
10
+
11
+ recursive-include app *.f90
12
+ recursive-include src *.f90 *.F90
13
+ recursive-include beach *.py
14
+ recursive-include docs *.md
15
+ recursive-include env *.env *.md
16
+ recursive-include examples *.toml *.py *.sh
17
+ recursive-include tests/fortran *.f90
18
+ recursive-include tests/python *.py
@@ -0,0 +1,61 @@
1
+ .PHONY: \
2
+ install install-local install-auto install-generic install-camphor install-camphor-local \
3
+ install-intel install-intel-local \
4
+ build run test \
5
+ build-mpi run-mpi test-mpi
6
+
7
+ FPM ?= fpm
8
+ PROFILE ?= release
9
+ CONFIG ?= beach.toml
10
+ OPENMP_FLAG ?= -fopenmp
11
+ INSTALL_PROFILE ?= auto
12
+
13
+ MPI_FC ?= mpiifort
14
+ MPI_OPENMP_FLAG ?= -qopenmp
15
+ MPI_CPP_FLAG ?= -fpp -DUSE_MPI
16
+ MPI_NP ?= 2
17
+ MPI_RUNNER ?= mpirun -n $(MPI_NP)
18
+
19
+ install:
20
+ BUILD_PROFILE=$(INSTALL_PROFILE) ./install.sh
21
+
22
+ install-local:
23
+ BUILD_PROFILE=$(INSTALL_PROFILE) PREFIX=$(PWD)/.local ./install.sh
24
+
25
+ install-auto:
26
+ BUILD_PROFILE=auto ./install.sh
27
+
28
+ install-generic:
29
+ BUILD_PROFILE=generic ./install.sh
30
+
31
+ install-camphor:
32
+ BUILD_PROFILE=camphor ./install.sh
33
+
34
+ install-camphor-local:
35
+ BUILD_PROFILE=camphor PREFIX=$(PWD)/.local-intel ./install.sh
36
+
37
+ install-intel:
38
+ $(MAKE) install-camphor
39
+
40
+ install-intel-local:
41
+ $(MAKE) install-camphor-local
42
+
43
+ build:
44
+ $(FPM) build --profile $(PROFILE) --flag "$(OPENMP_FLAG)"
45
+
46
+ run:
47
+ $(FPM) run --profile $(PROFILE) --flag "$(OPENMP_FLAG)" -- $(CONFIG)
48
+
49
+ test:
50
+ $(FPM) test --profile debug --flag "$(OPENMP_FLAG)"
51
+
52
+ build-mpi:
53
+ FPM_FC=$(MPI_FC) $(FPM) build --profile $(PROFILE) --flag "$(MPI_CPP_FLAG) $(MPI_OPENMP_FLAG)"
54
+
55
+ run-mpi:
56
+ FPM_FC=$(MPI_FC) $(FPM) run --profile $(PROFILE) --flag "$(MPI_CPP_FLAG) $(MPI_OPENMP_FLAG)" \
57
+ --runner "$(MPI_RUNNER)" -- $(CONFIG)
58
+
59
+ test-mpi:
60
+ FPM_FC=$(MPI_FC) $(FPM) test --target test_mpi_hybrid --profile debug \
61
+ --flag "$(MPI_CPP_FLAG) $(MPI_OPENMP_FLAG)" --runner "$(MPI_RUNNER)"
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: beach-bem
3
+ Version: 0.6.2
4
+ Summary: BEACH (BEM + Accumulated CHarge): BEM surface-charging + test-particle prototype (insulator mode) with hybrid E-field and Boris pusher.
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: matplotlib>=3.8
9
+ Requires-Dist: numpy>=1.24
10
+ Requires-Dist: tomli>=2.0.1; python_version < "3.11"
11
+ Dynamic: license-file
12
+
13
+ # BEACH(BEM + Accumulated CHarge)
14
+
15
+ BEACH は、**BEM(境界要素法)ベースの表面帯電 + テスト粒子追跡シミュレータ**です。
16
+ 計算本体は Fortran(`fpm` 管理)、Python は後処理・可視化を担当します。
17
+
18
+ v0.x の主対象は **insulator accumulation(絶縁体への電荷蓄積)** です。
19
+
20
+ ## 推奨ワークフロー
21
+
22
+ 通常利用では、**`pip install git+...` で導入して `beach` を実行する運用**を推奨します。
23
+ `pip install -e` や `make` は、開発に参加する場合の手順として扱います。
24
+
25
+ ## 1. 利用者向けセットアップ
26
+
27
+ ### 1.1 前提ツール
28
+
29
+ ```bash
30
+ make --version
31
+ gfortran --version
32
+ fpm --version
33
+ python --version
34
+ ```
35
+
36
+ ### 1.2 Git URL から一括インストール(推奨)
37
+
38
+ ```bash
39
+ python -m pip install -U pip setuptools wheel
40
+ python -m pip install "git+https://github.com/Nkzono99/BEACH.git"
41
+ ```
42
+
43
+ このインストールでは、ビルド時に `make install` が実行され、Python 側と Fortran 実行バイナリ(`beach`)が同時に導入されます。
44
+ ユーザーインストール時は `~/.local/bin` に入るため、必要なら PATH を追加してください。
45
+ pip 経由のビルドでは既定で `INSTALL_PROFILE=auto` を使います。必要なら `INSTALL_PROFILE=camphor` などを環境変数で上書きできます。
46
+ `auto` 失敗時は既定で `generic` へフォールバックします。無効化したい場合は `BEACH_PIP_FALLBACK_GENERIC=0` を指定してください。
47
+
48
+ ```bash
49
+ export PATH="$HOME/.local/bin:$PATH"
50
+ ```
51
+
52
+ ## 2. 実行
53
+
54
+ ### 2.1 推奨: `beach` コマンド
55
+
56
+ ```bash
57
+ beach examples/beach.toml
58
+ ```
59
+
60
+ 引数なしの場合は、カレントディレクトリの `beach.toml` を自動読込します。
61
+
62
+ ### 2.2 出力確認
63
+
64
+ ```bash
65
+ ls outputs/latest
66
+ beach-inspect outputs/latest
67
+ ```
68
+
69
+ 主な出力:
70
+
71
+ - `summary.txt`
72
+ - `charges.csv`
73
+ - `mesh_triangles.csv`
74
+ - `charge_history.csv`(`history_stride > 0` のとき)
75
+
76
+ ### 2.3 可視化
77
+
78
+ ```bash
79
+ beach-inspect outputs/latest \
80
+ --save-bar outputs/latest/charges_bar.png \
81
+ --save-mesh outputs/latest/charges_mesh.png
82
+
83
+ beach-animate-history outputs/latest \
84
+ --quantity charge \
85
+ --save-gif outputs/latest/charge_history.gif \
86
+ --total-frames 200
87
+
88
+ beach-plot-potential-slices outputs/latest \
89
+ --grid-n 200 \
90
+ --vmin -20 --vmax 20 \
91
+ --save outputs/latest/potential_slices.png
92
+ ```
93
+
94
+ ## 3. 運用でよく使うコマンド
95
+
96
+ ### 3.1 負荷見積もり
97
+
98
+ ```bash
99
+ beach-estimate-workload examples/beach.toml --threads 8
100
+ ```
101
+
102
+ ### 3.2 再開実行
103
+
104
+ ```toml
105
+ [output]
106
+ dir = "outputs/latest"
107
+ resume = true
108
+ ```
109
+
110
+ 同じ `output.dir` で `beach` を再実行すると続きから計算します。
111
+
112
+ ## 4. 開発に携わる場合
113
+
114
+ ローカル開発では、Python と Fortran を分けて運用するのが便利です。
115
+
116
+ ### 4.1 Python 側(編集可能インストール)
117
+
118
+ ```bash
119
+ python -m pip install -U pip setuptools wheel
120
+ python -m pip install -e . --no-build-isolation
121
+ ```
122
+
123
+ ### 4.2 Fortran 実行系(`make`)
124
+
125
+ ```bash
126
+ make
127
+ ```
128
+
129
+ `make` のデフォルトターゲットは `install` で、`BUILD_PROFILE=auto`(ホスト自動判定)を使います。
130
+ 必要に応じて明示指定できます。
131
+
132
+ ```bash
133
+ make install-generic
134
+ make install-camphor
135
+ ```
136
+
137
+ ### 4.3 `fpm` 直接実行(開発向け)
138
+
139
+ ```bash
140
+ fpm run --profile release --flag "-fopenmp" -- examples/beach.toml
141
+ ```
142
+
143
+ MPI + OpenMP(`USE_MPI` 有効化):
144
+
145
+ ```bash
146
+ FPM_FC=mpiifort \
147
+ fpm run --profile release --flag "-fpp -DUSE_MPI -qopenmp" \
148
+ --runner "mpirun -n 4" -- examples/beach.toml
149
+ ```
150
+
151
+ ### 4.4 テスト
152
+
153
+ ```bash
154
+ pytest -q
155
+ fpm test
156
+ ```
157
+
158
+ ## 5. プロジェクト構成
159
+
160
+ - [`src/`](src/), [`app/`](app/): Fortran 本体
161
+ - [`tests/fortran/`](tests/fortran/): Fortran テスト
162
+ - [`beach/`](beach/): Python 後処理ライブラリ
163
+ - [`tests/python/`](tests/python/): Python テスト
164
+ - [`examples/`](examples/): 設定例・補助スクリプト
165
+ - [`docs/`](docs/): 運用ドキュメント
166
+ - [`SPEC.md`](SPEC.md): 現行 Fortran 実装仕様
167
+
168
+ ## 6. ドキュメント案内
169
+
170
+ - Fortran 実行フロー: [`docs/fortran_workflow.md`](docs/fortran_workflow.md)
171
+ - `beach.toml` 仕様: [`docs/fortran_parameter_file.md`](docs/fortran_parameter_file.md)
172
+ - 実装仕様(source of truth): [`SPEC.md`](SPEC.md)
173
+ - 設定サンプル: [`examples/beach.toml`](examples/beach.toml)
@@ -0,0 +1,161 @@
1
+ # BEACH(BEM + Accumulated CHarge)
2
+
3
+ BEACH は、**BEM(境界要素法)ベースの表面帯電 + テスト粒子追跡シミュレータ**です。
4
+ 計算本体は Fortran(`fpm` 管理)、Python は後処理・可視化を担当します。
5
+
6
+ v0.x の主対象は **insulator accumulation(絶縁体への電荷蓄積)** です。
7
+
8
+ ## 推奨ワークフロー
9
+
10
+ 通常利用では、**`pip install git+...` で導入して `beach` を実行する運用**を推奨します。
11
+ `pip install -e` や `make` は、開発に参加する場合の手順として扱います。
12
+
13
+ ## 1. 利用者向けセットアップ
14
+
15
+ ### 1.1 前提ツール
16
+
17
+ ```bash
18
+ make --version
19
+ gfortran --version
20
+ fpm --version
21
+ python --version
22
+ ```
23
+
24
+ ### 1.2 Git URL から一括インストール(推奨)
25
+
26
+ ```bash
27
+ python -m pip install -U pip setuptools wheel
28
+ python -m pip install "git+https://github.com/Nkzono99/BEACH.git"
29
+ ```
30
+
31
+ このインストールでは、ビルド時に `make install` が実行され、Python 側と Fortran 実行バイナリ(`beach`)が同時に導入されます。
32
+ ユーザーインストール時は `~/.local/bin` に入るため、必要なら PATH を追加してください。
33
+ pip 経由のビルドでは既定で `INSTALL_PROFILE=auto` を使います。必要なら `INSTALL_PROFILE=camphor` などを環境変数で上書きできます。
34
+ `auto` 失敗時は既定で `generic` へフォールバックします。無効化したい場合は `BEACH_PIP_FALLBACK_GENERIC=0` を指定してください。
35
+
36
+ ```bash
37
+ export PATH="$HOME/.local/bin:$PATH"
38
+ ```
39
+
40
+ ## 2. 実行
41
+
42
+ ### 2.1 推奨: `beach` コマンド
43
+
44
+ ```bash
45
+ beach examples/beach.toml
46
+ ```
47
+
48
+ 引数なしの場合は、カレントディレクトリの `beach.toml` を自動読込します。
49
+
50
+ ### 2.2 出力確認
51
+
52
+ ```bash
53
+ ls outputs/latest
54
+ beach-inspect outputs/latest
55
+ ```
56
+
57
+ 主な出力:
58
+
59
+ - `summary.txt`
60
+ - `charges.csv`
61
+ - `mesh_triangles.csv`
62
+ - `charge_history.csv`(`history_stride > 0` のとき)
63
+
64
+ ### 2.3 可視化
65
+
66
+ ```bash
67
+ beach-inspect outputs/latest \
68
+ --save-bar outputs/latest/charges_bar.png \
69
+ --save-mesh outputs/latest/charges_mesh.png
70
+
71
+ beach-animate-history outputs/latest \
72
+ --quantity charge \
73
+ --save-gif outputs/latest/charge_history.gif \
74
+ --total-frames 200
75
+
76
+ beach-plot-potential-slices outputs/latest \
77
+ --grid-n 200 \
78
+ --vmin -20 --vmax 20 \
79
+ --save outputs/latest/potential_slices.png
80
+ ```
81
+
82
+ ## 3. 運用でよく使うコマンド
83
+
84
+ ### 3.1 負荷見積もり
85
+
86
+ ```bash
87
+ beach-estimate-workload examples/beach.toml --threads 8
88
+ ```
89
+
90
+ ### 3.2 再開実行
91
+
92
+ ```toml
93
+ [output]
94
+ dir = "outputs/latest"
95
+ resume = true
96
+ ```
97
+
98
+ 同じ `output.dir` で `beach` を再実行すると続きから計算します。
99
+
100
+ ## 4. 開発に携わる場合
101
+
102
+ ローカル開発では、Python と Fortran を分けて運用するのが便利です。
103
+
104
+ ### 4.1 Python 側(編集可能インストール)
105
+
106
+ ```bash
107
+ python -m pip install -U pip setuptools wheel
108
+ python -m pip install -e . --no-build-isolation
109
+ ```
110
+
111
+ ### 4.2 Fortran 実行系(`make`)
112
+
113
+ ```bash
114
+ make
115
+ ```
116
+
117
+ `make` のデフォルトターゲットは `install` で、`BUILD_PROFILE=auto`(ホスト自動判定)を使います。
118
+ 必要に応じて明示指定できます。
119
+
120
+ ```bash
121
+ make install-generic
122
+ make install-camphor
123
+ ```
124
+
125
+ ### 4.3 `fpm` 直接実行(開発向け)
126
+
127
+ ```bash
128
+ fpm run --profile release --flag "-fopenmp" -- examples/beach.toml
129
+ ```
130
+
131
+ MPI + OpenMP(`USE_MPI` 有効化):
132
+
133
+ ```bash
134
+ FPM_FC=mpiifort \
135
+ fpm run --profile release --flag "-fpp -DUSE_MPI -qopenmp" \
136
+ --runner "mpirun -n 4" -- examples/beach.toml
137
+ ```
138
+
139
+ ### 4.4 テスト
140
+
141
+ ```bash
142
+ pytest -q
143
+ fpm test
144
+ ```
145
+
146
+ ## 5. プロジェクト構成
147
+
148
+ - [`src/`](src/), [`app/`](app/): Fortran 本体
149
+ - [`tests/fortran/`](tests/fortran/): Fortran テスト
150
+ - [`beach/`](beach/): Python 後処理ライブラリ
151
+ - [`tests/python/`](tests/python/): Python テスト
152
+ - [`examples/`](examples/): 設定例・補助スクリプト
153
+ - [`docs/`](docs/): 運用ドキュメント
154
+ - [`SPEC.md`](SPEC.md): 現行 Fortran 実装仕様
155
+
156
+ ## 6. ドキュメント案内
157
+
158
+ - Fortran 実行フロー: [`docs/fortran_workflow.md`](docs/fortran_workflow.md)
159
+ - `beach.toml` 仕様: [`docs/fortran_parameter_file.md`](docs/fortran_parameter_file.md)
160
+ - 実装仕様(source of truth): [`SPEC.md`](SPEC.md)
161
+ - 設定サンプル: [`examples/beach.toml`](examples/beach.toml)