-
Notifications
You must be signed in to change notification settings - Fork 129
Initial Condition Extrusion + Chem Examples #1109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
f1d47b9
389e8e7
4c26059
2404925
9ff179e
f233473
83b20f9
8513cc8
99f8829
7194c0b
4203aae
c790a73
a853cad
3310f56
5038dcf
a8126e6
c1e4a40
5baa703
0918651
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -251,8 +251,8 @@ The code provides three pre-built patches for dimensional extrusion of initial c | |||||||||
| - `case(270)`: Extrude 1D data to 2D domain | ||||||||||
| - `case(370)`: Extrude 2D data to 3D domain | ||||||||||
|
|
||||||||||
| Setup: Only requires specifying `init_dir` and filename pattern via `zeros_default`. Grid dimensions are automatically detected from the data files. | ||||||||||
| Implementation: All variables and file handling are managed in `src/pre_process/include/ExtrusionHardcodedIC.fpp` with no manual grid configuration needed. | ||||||||||
| Setup: Only requires specifying `files_dir` and filename pattern via `file_extension`. The files are located, for example, at `examples/2D_case/IC`, and their format is `prim.XX.YY.files_extension.dat`. | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Clarify the example filename format in the documentation to show a concrete example, such as
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The filename example uses Prompt for AI agents
Suggested change
|
||||||||||
| Implementation: All variables and file handling are managed in the `case.py` file of the simulation. | ||||||||||
| Usage: Ideal for initializing simulations from lower-dimensional solutions, enabling users to add perturbations or modifications to the base extruded fields for flow instability studies. | ||||||||||
|
|
||||||||||
| #### Parameter Descriptions | ||||||||||
|
|
||||||||||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,72 @@ | ||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||
| import json | ||||||||||||||
| import argparse | ||||||||||||||
| import math | ||||||||||||||
| import os | ||||||||||||||
| import cantera as ct | ||||||||||||||
|
|
||||||||||||||
| current_dir = os.path.dirname(os.path.abspath(__file__)) | ||||||||||||||
| ctfile = "sandiego.yaml" | ||||||||||||||
| sol_L = ct.Solution(ctfile) | ||||||||||||||
| sol_L.TPX = 300, 8000, "O2:2,N2:2,H2O:5" | ||||||||||||||
DimAdam-01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| L = 0.016 | ||||||||||||||
| Nx = 1199 | ||||||||||||||
| dx = L / Nx | ||||||||||||||
| dt = 1e-8 | ||||||||||||||
| Tend = 0.60e-3 | ||||||||||||||
| NT = int(Tend / dt) | ||||||||||||||
| SAVE_COUNT = 1000 | ||||||||||||||
| NS = 1000 | ||||||||||||||
| case = { | ||||||||||||||
| "run_time_info": "T", | ||||||||||||||
| "x_domain%beg": -L / 2, | ||||||||||||||
| "x_domain%end": +L / 2, | ||||||||||||||
| "m": Nx, | ||||||||||||||
| "n": 0, | ||||||||||||||
| "p": 0, | ||||||||||||||
| "dt": float(dt), | ||||||||||||||
| "t_step_start": 0, | ||||||||||||||
| "t_step_stop": NT, | ||||||||||||||
| "t_step_save": NS, | ||||||||||||||
| "t_step_print": 100, | ||||||||||||||
| "parallel_io": "F", | ||||||||||||||
| "model_eqns": 2, | ||||||||||||||
| "num_fluids": 1, | ||||||||||||||
| "num_patches": 1, | ||||||||||||||
| "mpp_lim": "F", | ||||||||||||||
| "mixture_err": "F", | ||||||||||||||
| "time_stepper": 3, | ||||||||||||||
| "weno_order": 5, | ||||||||||||||
| "weno_eps": 1e-16, | ||||||||||||||
| "weno_avg": "F", | ||||||||||||||
| "mapped_weno": "T", | ||||||||||||||
| "mp_weno": "T", | ||||||||||||||
| "riemann_solver": 2, | ||||||||||||||
| "wave_speeds": 2, | ||||||||||||||
| "avg_state": 1, | ||||||||||||||
| "bc_x%beg": -8, | ||||||||||||||
| "bc_x%end": -8, | ||||||||||||||
| "viscous": "F", | ||||||||||||||
| "files_dir": os.path.join(current_dir, "IC"), | ||||||||||||||
| "file_extension": "000000", | ||||||||||||||
| "chemistry": "T", | ||||||||||||||
| "chem_params%diffusion": "T", | ||||||||||||||
| "chem_params%reactions": "T", | ||||||||||||||
| "chem_params%transport_model": 2, | ||||||||||||||
| "format": 1, | ||||||||||||||
| "precision": 2, | ||||||||||||||
| "prim_vars_wrt": "T", | ||||||||||||||
| "patch_icpp(1)%geometry": 1, | ||||||||||||||
| "patch_icpp(1)%hcid": 170, | ||||||||||||||
| "patch_icpp(1)%x_centroid": 0, | ||||||||||||||
| "patch_icpp(1)%length_x": L, | ||||||||||||||
| "patch_icpp(1)%vel(1)": "0", | ||||||||||||||
| "patch_icpp(1)%pres": 1.01325e5, | ||||||||||||||
| "patch_icpp(1)%alpha(1)": 1, | ||||||||||||||
| "patch_icpp(1)%alpha_rho(1)": "1", | ||||||||||||||
|
Comment on lines
+63
to
+66
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Several fields in the Severity Level: Major
|
||||||||||||||
| "patch_icpp(1)%vel(1)": "0", | |
| "patch_icpp(1)%pres": 1.01325e5, | |
| "patch_icpp(1)%alpha(1)": 1, | |
| "patch_icpp(1)%alpha_rho(1)": "1", | |
| "patch_icpp(1)%vel(1)": 0, | |
| "patch_icpp(1)%alpha_rho(1)": 1, |
Steps of Reproduction ✅
1. Run the example script to emit JSON: `python examples/1D_flamelet/case.py`; the script
prints the `case` dict as JSON.
2. Parse the output JSON (e.g., `json.loads(...)`) and inspect keys "patch_icpp(1)%vel(1)"
and "patch_icpp(1)%alpha_rho(1)" defined at lines 63 and 66; both values are strings ("0"
and "1").
3. If a downstream consumer expects numeric types (e.g., performing arithmetic on these
config entries), it will receive strings and either convert them or raise a type-related
error in the consumer.
4. Observed result: mis-typed configuration values in produced JSON; behavior depends on
downstream code but can lead to incorrect numeric operations.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** examples/1D_flamelet/case.py
**Line:** 63:66
**Comment:**
*Type Error: Several fields in the `case` dict that represent numeric configuration values are provided as strings (for example `patch_icpp(1)%vel(1)` and `patch_icpp(1)%alpha_rho(1)`), which can cause downstream config parsers to treat them as strings and fail numeric operations; make these entries numeric (remove the quotes).
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gitignore negation pattern is in wrong position and will be ineffective.
The negation
!examples/**/IC/*.daton line 26 appears before the broader ignore patternexamples/**/*.daton line 47. In.gitignore, later patterns override earlier ones, so IC.datfiles will still be ignored.Move this line after line 47 (or after line 64 where similar negations exist) to ensure IC data files are properly tracked.
Suggested fix
Move line 26 to after line 64, grouping it with similar negation patterns:
examples/**/*.f90 !examples/3D_lag_bubbles_shbubcollapse/input/lag_bubbles.dat !examples/3D_lag_bubbles_bubblescreen/input/lag_bubbles.dat +!examples/**/IC/*.dat workloads/And remove the current line 26.
🤖 Prompt for AI Agents