初版gui

This commit is contained in:
xinxiao
2026-03-16 16:57:25 +08:00
parent 748c50fb44
commit 0e8421ec4f
19 changed files with 3467 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
# App Quickstart
## Launch
From MATLAB, open the app with:
```matlab
launch_edfm_simulator_app
```
File:
- `gui_support/app/launch_edfm_simulator_app.m`
## Current Scope
The app currently provides:
- tab layout by Part
- template loading
- config import/export as MAT
- result import/export as MAT
- unified run entry through `run_case(config)`
- run log capture
- basic result summary and plotting
## Current Editing Style
For large arrays and cell data, the app currently uses MATLAB literal text areas.
Examples:
- numeric arrays: `[1 2 3]`
- matrices: `[1 2; 3 4]`
- cell arrays: `{'w1', 1, [1 1 1], 0.089, 0, 1}`
This keeps the first App Designer style version flexible while the parameter schema is still being stabilized.
## Notes
- The flow models are mutually exclusive.
- The GUI only uses the active `flow_model` branch at runtime.
- The current result page is a first-pass implementation.
- The current app class is written in App Designer style (`matlab.apps.AppBase`) as a text `.m` class instead of a binary `.mlapp`.
+90
View File
@@ -0,0 +1,90 @@
# Case Template Summary
This file captures the first-pass differences among the 7 existing example cases.
The goal is to turn these into GUI presets later instead of keeping 7 separate hard-coded entry scripts.
## Shared Structure
All current example `main1.m` scripts follow the same 8-part flow:
1. model selection
2. matrix grid definition
3. fracture input
4. discretization
5. flow model and initial state
6. well and schedule
7. solver setup
8. execution
## Template Summary
| Case | Folder | Grid | Grid Model | Flow Model | Fracture Wells | Schedule Phases | Notes |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | `算例1-组分流-不规则非均质计算域` | `20 x 10 x 1` | SP | Multi-component | 1 | 3 | Component transport, surfactant/salt injection |
| 2 | `算例2-组分流-无效网格` | `20 x 20 x 3` | SP | Multi-component | 1 | 3 | Similar to case 1, but multi-layer and invalid-grid theme |
| 3 | `算例3-单重双重离散裂缝混合模型` | `20 x 10 x 1` | DP | Multi-component | 1 | 3 | Dual-medium setup |
| 4 | `算例4-气水两相流-压力导数曲线` | `20 x 10 x 1` | SP | Gas-water | 1 | 5 | Pressure derivative style schedule with very small early timesteps |
| 5 | `算例5-油水两相流-注焖采` | `20 x 10 x 1` | SP | Oil-water | 1 | 3 | Injection-soak-production schedule |
| 6 | `算例6-油水两相流-直井注压裂水平井采` | `20 x 10 x 2` | SP | Oil-water | 1 | 1 | Contains both conventional wells and fracture well |
| 7 | `算例7-油水两相流-不同裂缝制度不同` | `20 x 10 x 1` | SP | Oil-water | 6 | 4 | Multiple fracture-well controls with different stages |
## Key Template Differences
### Grid
- Most cases use `dx = 50 * ones(1, 20)`.
- Most cases use `dy = 50 * ones(1, 10)`.
- `dz` differs by case:
- case 1: 1 layer
- case 2: 3 layers
- case 3: 1 layer
- case 4: 1 layer
- case 5: 1 layer
- case 6: 2 layers
- case 7: 1 layer
### Discretization
- Cases 1, 2, 4, 5, 6, 7 use single-medium mode.
- Case 3 uses dual-medium mode.
### Flow Physics
- Cases 1, 2, 3 use multi-component flow.
- Case 4 uses gas-water flow.
- Cases 5, 6, 7 use oil-water flow.
### Wells
- Cases 1 to 5 mainly define fracture well completions through `welloc`.
- Case 6 includes conventional wells in `well1` plus one fracture well in `well2`.
- Case 7 splits six fracture locations into six separately controlled fracture wells.
### Schedule
- Cases 1, 2, 3: 3-stage schedule
- Case 4: 5-stage schedule with aggressive timestep ramping
- Case 5: 3-stage schedule
- Case 6: 1-stage schedule
- Case 7: 4-stage schedule
## Preset Design Recommendation
Later, each GUI preset should contain:
- display name
- source folder
- default `config`
- supported flow model
- supported grid model
- notes for the result page
Suggested preset IDs:
- `case01_multicomponent_irregular`
- `case02_multicomponent_invalid_grid`
- `case03_multicomponent_dp`
- `case04_gas_water_pressure_derivative`
- `case05_oil_water_huff_n_puff`
- `case06_oil_water_vertical_inj_fractured_horizontal_prod`
- `case07_oil_water_multi_fracture_regimes`
+386
View File
@@ -0,0 +1,386 @@
# GUI Parameter And Run Architecture
## Decision
Use MATLAB `struct` as the primary runtime and persistence format.
Reasons:
- App Designer works naturally with nested `struct` data.
- Existing solver code already expects MATLAB variables and structs, not object models.
- `struct` avoids unnecessary conversion while the GUI is being built.
- JSON can still be added later as an optional export/import layer.
Recommended flow:
1. Load a case template into `config` as a MATLAB struct.
2. Let the GUI edit `config`.
3. Save or load `config` directly as MATLAB data first.
4. Convert `config` into solver inputs through a single entry point later: `run_case(config)`.
## Unified Config Layout
The GUI should be built around the following top-level fields:
```matlab
config.meta
config.model
config.grid
config.fracture
config.discretization
config.flow
config.initial
config.wells
config.schedule
config.solver
config.output
```
## Part Mapping
The existing `main1.m` scripts are structurally consistent and map well to the GUI:
1. `model`: model selection
2. `grid`: matrix grid definition
3. `fracture`: fracture input and geometry
4. `discretization`: SP/DP discretization and medium setup
5. `flow` + `initial`: flow model, PVT, relative permeability, initial state
6. `wells` + `schedule`: wells, perforations, stage schedule
7. `solver`: nonlinear and timestep controls
8. `output`: run execution and result presentation
## Parameter Layers
The previous inventory mixed together direct inputs and fields created during preprocessing.
The GUI should distinguish them explicitly.
### Layer A: Editable Input Parameters
These are the parameters the GUI should expose directly or through advanced panels.
### Layer B: Derived Or Runtime Fields
These are generated by preprocessing, discretization, solver assembly, or postprocessing.
They should usually be displayed or logged, but not edited directly.
## Core Parameter Inventory
This is the revised first-pass grouping of parameters already identified in the repository.
### `meta`
- `case_name`
- `case_id`
- `description`
- `source_case_folder`
- `created_from_template`
- `version`
### `model`
- `modelflag`
- `grid_model`
- `flow_model`
Known values:
- `modelflag`: currently fixed to classical EDFM in all 7 examples
- `grid_model`: `1` single-medium, `2` dual-medium
- `flow_model`: `1` gas-water, `2` oil-water, `3` multi-component
### `grid`
Editable inputs:
- `dx`
- `dy`
- `dz`
- `nx`
- `ny`
- `nz`
- `NTG`
Derived by `GridProp_pre` and later preprocessing:
- `coordinates`
- `nodes`
- `nP`
- `nmc`
- `dxv`
- `dyv`
- `dzv`
- `vm`
- `zm`
- `xrao`
- `yrao`
- `zrao`
- `cell_mid_coords`
Important correction:
- `boundary` is not defined in `GridProp_pre.m`.
- In case 1 it is defined in `grid_discretization_SP_model.m`.
- This means geometric grid size and reservoir validity boundary are separate parameter groups and should not be merged.
### `fracture`
- `input_style`
- `input_content`
- `f`
- `fellip`
- `fractureLines`
- `fractureHeights`
- `flowBarrierFlags`
- `frac_information`
- `nf`
Observed input modes:
- Engineering input table
- Vector input
- 2D line input
- Reserved `.fab` import mode
### `discretization`
Editable inputs:
- `grid_model`
- `boundary`
- `invalid_layer`
- `valid_grids` generation rule
- matrix permeability definition rule
- matrix porosity definition rule
- matrix reference pressure `prpor`
- matrix compressibility `cpor`
- rock density `rock_density`
- fracture permeability `Kf`
- fracture aperture `Wf`
- fracture porosity `Porf`
- fracture reference pressure `prporf`
- fracture compressibility `cporf`
- `stress_factor_fracture`
- `stress_factor_matrix`
- `stress_factor_ref_pressure`
- dual-medium only:
- `kx_matrixLayer`
- `ky_matrixLayer`
- `kz_matrixLayer`
- `pori_matrixLayer`
- `sigma`
Observed editable rock-property expressions in current cases:
- case 1 SP:
- polygon `boundary`
- `kx/ky/kz` as spatial functions of `cell_mid_coords`
- `pori` as spatial function of `cell_mid_coords`
- cases 2/4/6:
- constant matrix properties
- `invalid_layer` controls inactive layers
- cases 5/7:
- constant matrix properties, different values from cases 2/4/6
- case 3 DP:
- fracture-layer permeability set
- matrix-layer permeability set
- matrix-layer porosity
- shape factor `sigma`
Derived fields:
- fracture-matrix discretization result
- fracture-fracture discretization result
- EDFM connection data
- operator generation inputs for `OperatorRS`
- runtime fields added onto `r`, including `rock_density`, `valid_grids`, stress-factor fields, and dual-medium derived fields
### `flow`
Shared categories:
- phase density
- reference pressure
- formation volume factor
- compressibility
- viscosity
- viscosity-pressure coefficient
- capillary pressure switch
- non-Darcy coefficient
- threshold pressure gradient
- matrix relative permeability table
- fracture relative permeability table
Additional note:
- Many of these are hidden inside helper files such as `gas_water_flow.m`, `oil_water_flow.m`, and `multi_component_flow.m`, so they must be treated as editable physics parameters even though they are not visible in `main1.m`.
Gas-water specific:
- `gas_prop.VL`
- `gas_prop.PL`
- `gas_prop.Kn`
- `gas_prop.Kn_modified_factor`
- `gas_prop.beta_non_Darcy_flow`
- `density_g_sc`
- `gas_model`
- gas PVT table or generated PVT parameters
Oil-water specific:
- `density_o_sc`
- `oil_model`
- oil PVT table or generated PVT parameters
Multi-component specific:
- `Ds`
- `Db`
- adsorption table `c_ca_table`
- chemistry parameters `R`, `Vm`, `Temperature`, `chemistry_cof`
- dynamic relative permeability tables `cs_Nc`, `kr_nosurf`, `kr_surf`, `PC`
- fracture counterparts of the same tables
- `number_state_variables`
### `initial`
Gas-water and oil-water:
- `P`
- `Sw`
Multi-component:
- `P`
- `Sw`
- `Cs`
- `Cb`
### `wells`
Conventional well definition:
- `well1`
- well name
- perforation count
- perforation grid indices
- wellbore radius
- skin
- well type
Fracture-well definition:
- `num_fracture_wells`
- `welloc`
- `perfnum`
- `well2`
Combined runtime well structure:
- `Wellc`
### `schedule`
- `number_phases`
- `well_schedules`
- `time`
- `dtmax`
- `dtmin`
Per-row schedule fields observed:
- well name
- well state
- well role
- control mode
- target value 1
- target value 2
- optional `Cs_inj`
- optional `Cb_inj`
### `solver`
- `yitap`
- `yitas`
- `omega`
- `Nmax`
- `epsave`
- `epsmax`
### `output`
Runtime outputs observed:
- `Times`
- `OutputRs`
- `Wellpara`
- `trun`
Useful progress fields for the future GUI:
- current stage index
- current simulation time
- current `dt`
- Newton iteration count
- cumulative linear solve time
- cumulative Jacobian assembly time
## Preset Strategy
The seven example folders should be treated as presets, not as independent long-term entry points.
Recommended future structure:
- `load_case_template(1)` ... `load_case_template(7)`
- each template returns a complete `config`
- GUI edits the `config`
- `run_case(config)` executes the solver
This avoids binding the GUI to seven different hard-coded scripts.
## Run Page Scope
Pause and abort are explicitly deferred for now.
Current target for the run page:
- show active case name
- show active stage
- show current simulation time
- show current timestep
- show Newton count
- show text log
- optionally plot selected well response during run
The existing solver already prints progress with `fprintf`, but the proper GUI solution will be to add a progress callback later.
## File-Level Sources Confirmed So Far
Primary input sources already confirmed:
- `main1.m`
- `GridProp_pre.m`
- `grid_discretization_SP_model.m`
- `grid_discretization_DP_model.m`
- `preprocess_heterogeneous.m`
- `gas_water_flow.m`
- `oil_water_flow.m`
- `multi_component_flow.m`
This matters because not all user-facing parameters live in `main1.m`.
The parameter registry must therefore be built from the full call chain, not from entry scripts only.
## Next Implementation Steps
1. Build a complete field-level parameter registry file from the 7 case folders.
2. Keep `create_empty_config` as the primary configuration skeleton.
3. Use `run_case(config)` as the single runtime entry point for all three flow models.
4. Build App Designer pages around model-specific parameter panels.
## Runtime Status
Current runtime direction:
- `run_case(config)` is now the unified execution entry.
- `flow_model` is treated as mutually exclusive.
- GUI should only show the active model's parameter set.
- Non-active model parameters should remain hidden and unused.
+351
View File
@@ -0,0 +1,351 @@
# Parameter Registry
This registry maps the current hard-coded parameters to a unified `config` structure.
It is intentionally field-oriented so the future GUI can be built against a stable schema.
## Conventions
- `Config Path`: target field in the unified config
- `Source Variable`: current variable name in code
- `Source File`: current MATLAB file where the parameter is defined
- `Cases`: which example folders currently use the field
- `Editable`: whether the GUI should expose the field
- `Notes`: behavior, enum meaning, or shape
## Meta
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `meta.case_name` | none | template-level | all | yes | Display name |
| `meta.case_id` | none | template-level | all | yes | Stable preset ID |
| `meta.description` | none | template-level | all | yes | Free text |
| `meta.source_case_folder` | folder name | template-level | all | no | Traceability |
| `meta.created_from_template` | none | template-level | all | no | Preset source |
| `meta.version` | none | config system | all | no | Schema version |
## Model
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `model.modelflag` | `modelflag` | `main1.m` | 1-7 | yes | Current examples use `1` |
| `model.grid_model` | `grid_model` | `main1.m` | 1-7 | yes | `1` SP, `2` DP |
| `model.flow_model` | `flow_model` | `main1.m` | 1-7 | yes | `1` gas-water, `2` oil-water, `3` multi-component |
## Grid Geometry
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `grid.dx` | `dx` | `main1.m` | 1-7 | yes | Vector |
| `grid.dy` | `dy` | `main1.m` | 1-7 | yes | Vector |
| `grid.dz` | `dz` | `main1.m` | 1-7 | yes | Vector |
| `grid.nx` | `nx` | `main1.m` | 1-7 | no | Derived from `dx` |
| `grid.ny` | `ny` | `main1.m` | 1-7 | no | Derived from `dy` |
| `grid.nz` | `nz` | `main1.m` | 1-7 | no | Derived from `dz` |
| `grid.NTG` | `NTG` | `main1.m` | 1-7 | no | Array sized `nx*ny*nz` |
Derived fields produced by `GridProp_pre.m`:
- `grid.coordinates`
- `grid.nodes`
- `grid.nP`
- `grid.nmc`
- `grid.dxv`
- `grid.dyv`
- `grid.dzv`
- `grid.zm`
- `grid.vm`
- `grid.xrao`
- `grid.yrao`
- `grid.zrao`
- `grid.cell_mid_coords`
## Fracture Input
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `fracture.input_style` | `input_style` | `main1.m` | 1-7 | yes | 1 engineering, 2 vector, 3 2D lines, 4 fab reserved |
| `fracture.input_content` | `input_content` | `main1.m` | 1-7 | yes | Engineering fracture table |
| `fracture.f` | `f` | `main1.m` / helper outputs | 1-7 | advanced | Vector fracture representation |
| `fracture.fellip` | `fellip` | `main1.m` / helper outputs | 1-7 | advanced | Elliptic fractures |
| `fracture.fractureLines` | `fractureLines` | `main1.m` | 1-7 | yes | Used in mode 3 |
| `fracture.fractureHeights` | `fractureHeights` | `main1.m` | 1-7 | yes | Used in mode 3 |
| `fracture.flowBarrierFlags` | `flowBarrierFlags` | `main1.m` | 1-7 | yes | Optional |
| `fracture.frac_information` | `frac_information` | helper outputs | 1-7 | no | Generated by helper functions |
| `fracture.nf` | `nf` | `main1.m` | 1-7 | no | Derived fracture count |
## Discretization Selection
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `discretization.mode` | `grid_model` | `main1.m` | 1-7 | yes | Mirrors `model.grid_model` |
| `discretization.use_operator` | implicit | `main1.m` | 1-7 | no | `OperatorRS` is always called currently |
## SP Rock And Boundary Parameters
These are critical editable parameters and were previously undercounted.
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `discretization.sp.boundary_polygon` | `boundary` | `grid_discretization_SP_model.m` | 1 | yes | Irregular domain polygon |
| `discretization.sp.invalid_layer` | `invalid_layer` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Layer indices disabled from simulation |
| `discretization.sp.valid_grids` | `valid_grids` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | no | Derived from boundary/layers |
| `discretization.sp.matrix.kx` | `kx` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Array or generated field |
| `discretization.sp.matrix.ky` | `ky` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Array or generated field |
| `discretization.sp.matrix.kz` | `kz` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Array or generated field |
| `discretization.sp.matrix.pori` | `pori` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Array or generated field |
| `discretization.sp.matrix.prpor` | `prpor` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Matrix reference pressure |
| `discretization.sp.matrix.cpor` | `cpor` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Matrix compressibility |
| `discretization.sp.matrix.rock_density` | `rock_density` / `density_rock` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Naming is inconsistent across cases |
| `discretization.sp.fracture.Kf` | `Kf` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Fracture permeability |
| `discretization.sp.fracture.Wf` | `Wf` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Fracture aperture |
| `discretization.sp.fracture.Porf` | `Porf` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Fracture porosity |
| `discretization.sp.fracture.prporf` | `prporf` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Fracture reference pressure |
| `discretization.sp.fracture.cporf` | `cporf` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Fracture compressibility |
| `discretization.sp.stress.fracture_factor` | `stress_factor_fracture` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Stress sensitivity |
| `discretization.sp.stress.matrix_factor` | `stress_factor_matrix` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Stress sensitivity |
| `discretization.sp.stress.ref_pressure` | `stress_factor_ref_pressure` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Reference pressure |
| `discretization.sp.stress.Rpt` | `Rpt` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Unknown |
| `discretization.sp.stress.cf` | `cf` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Unknown |
| `discretization.sp.stress.ca` | `ca` | `grid_discretization_SP_model.m` | 1,2,4,5,6,7 | yes | Unknown |
Case-specific notes:
- Case 1 uses spatial functions and an irregular polygon boundary.
- Cases 2 and 4 use `invalid_layer` to deactivate the second layer when applicable.
- Cases 5 and 7 use different constant matrix properties than cases 2, 4, and 6.
## DP Rock Parameters
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `discretization.dp.fracture_layer.kx` | `kx` | `grid_discretization_DP_model.m` | 3 | yes | Dual-medium fracture layer |
| `discretization.dp.fracture_layer.ky` | `ky` | `grid_discretization_DP_model.m` | 3 | yes | Dual-medium fracture layer |
| `discretization.dp.fracture_layer.kz` | `kz` | `grid_discretization_DP_model.m` | 3 | yes | Dual-medium fracture layer |
| `discretization.dp.fracture_layer.pori` | `pori` | `grid_discretization_DP_model.m` | 3 | no | Dual-medium fracture layer porosity |
| `discretization.dp.matrix_layer.kx` | `kx_matrixLayer` | `grid_discretization_DP_model.m` | 3 | yes | Matrix layer permeability |
| `discretization.dp.matrix_layer.ky` | `ky_matrixLayer` | `grid_discretization_DP_model.m` | 3 | yes | Matrix layer permeability |
| `discretization.dp.matrix_layer.kz` | `kz_matrixLayer` | `grid_discretization_DP_model.m` | 3 | yes | Matrix layer permeability |
| `discretization.dp.matrix_layer.pori` | `pori_matrixLayer` | `grid_discretization_DP_model.m` | 3 | yes | Matrix layer porosity |
| `discretization.dp.shape_factor` | `sigma` | `grid_discretization_DP_model.m` | 3 | yes | Interporosity shape factor |
| `discretization.dp.valid_grids` | `valid_grids` | `grid_discretization_DP_model.m` | 3 | no | All ones in current example |
| `discretization.dp.NTG` | `NTG` | `grid_discretization_DP_model.m` | 3 | yes | Reassigned in file |
| `discretization.dp.prpor` | `prpor` | `grid_discretization_DP_model.m` | 3 | yes | Reference pressure |
| `discretization.dp.cpor` | `cpor` | `grid_discretization_DP_model.m` | 3 | yes | Compressibility |
| `discretization.dp.fracture.Kf` | `Kf` | `grid_discretization_DP_model.m` | 3 | yes | Fracture permeability |
| `discretization.dp.fracture.Wf` | `Wf` | `grid_discretization_DP_model.m` | 3 | yes | Fracture aperture |
| `discretization.dp.fracture.Porf` | `Porf` | `grid_discretization_DP_model.m` | 3 | yes | Fracture porosity |
| `discretization.dp.fracture.prporf` | `prporf` | `grid_discretization_DP_model.m` | 3 | yes | Fracture reference pressure |
| `discretization.dp.fracture.cporf` | `cporf` | `grid_discretization_DP_model.m` | 3 | yes | Fracture compressibility |
| `discretization.dp.stress.fracture_factor` | `stress_factor_fracture` | `grid_discretization_DP_model.m` | 3 | yes | Stress sensitivity |
| `discretization.dp.stress.matrix_factor` | `stress_factor_matrix` | `grid_discretization_DP_model.m` | 3 | yes | Stress sensitivity |
| `discretization.dp.stress.ref_pressure` | `stress_factor_ref_pressure` | `grid_discretization_DP_model.m` | 3 | yes | Reference pressure |
| `discretization.dp.rock_density` | `rock_density` | `grid_discretization_DP_model.m` | 3 | yes | Rock density |
| `discretization.dp.Rpt` | `Rpt` | `grid_discretization_DP_model.m` | 3 | yes | Unknown |
| `discretization.dp.cf` | `cf` | `grid_discretization_DP_model.m` | 3 | yes | Unknown |
| `discretization.dp.ca` | `ca` | `grid_discretization_DP_model.m` | 3 | yes | Unknown |
## Flow: Gas-Water
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `flow.gas_water.gas_prop.VL` | `gas_prop.VL` | `gas_water_flow.m` | 4 | yes | Langmuir volume |
| `flow.gas_water.gas_prop.PL` | `gas_prop.PL` | `gas_water_flow.m` | 4 | yes | Langmuir pressure |
| `flow.gas_water.gas_prop.Kn` | `gas_prop.Kn` | `gas_water_flow.m` | 4 | yes | Knudsen number |
| `flow.gas_water.gas_prop.Kn_modified_factor` | `gas_prop.Kn_modified_factor` | `gas_water_flow.m` | 4 | no | Derived |
| `flow.gas_water.gas_prop.beta_non_darcy_flow` | `gas_prop.beta_non_Darcy_flow` | `gas_water_flow.m` | 4 | yes | High-velocity term |
| `flow.gas_water.p_grad_threshold` | `p_grad_threshold` | `gas_water_flow.m` | 4 | yes | Threshold pressure gradient |
| `flow.gas_water.density_g_sc` | `density_g_sc` | `gas_water_flow.m` | 4 | yes | Gas density at standard conditions |
| `flow.gas_water.density_w_sc` | `density_w_sc` | `gas_water_flow.m` | 4 | yes | Water density at standard conditions |
| `flow.gas_water.gas_model` | `gas_model` | `gas_water_flow.m` | 4 | yes | 1 generated PVT, 2 tabulated PVT |
| `flow.gas_water.prg` | `prg` | `gas_water_flow.m` | 4 | yes | Only in model 1 |
| `flow.gas_water.Bgi` | `Bgi` | `gas_water_flow.m` | 4 | yes | Only in model 1 |
| `flow.gas_water.cg` | `cg` | `gas_water_flow.m` | 4 | yes | Only in model 1 |
| `flow.gas_water.vgi` | `vgi` | `gas_water_flow.m` | 4 | yes | Only in model 1 |
| `flow.gas_water.cvg` | `cvg` | `gas_water_flow.m` | 4 | yes | Only in model 1 |
| `flow.gas_water.Ppr` | `Ppr` | `gas_water_flow.m` | 4 | yes | Table or generated |
| `flow.gas_water.BG` | `BG` | `gas_water_flow.m` | 4 | yes | Table or generated |
| `flow.gas_water.MUG` | `MUG` | `gas_water_flow.m` | 4 | yes | Table or generated |
| `flow.gas_water.prw` | `prw` | `gas_water_flow.m` | 4 | yes | Water reference pressure |
| `flow.gas_water.Bwi` | `Bwi` | `gas_water_flow.m` | 4 | yes | Water volume factor |
| `flow.gas_water.cw` | `cw` | `gas_water_flow.m` | 4 | yes | Water compressibility |
| `flow.gas_water.vwi` | `vwi` | `gas_water_flow.m` | 4 | yes | Water viscosity |
| `flow.gas_water.cvw` | `cvw` | `gas_water_flow.m` | 4 | yes | Water viscosity-pressure coefficient |
| `flow.gas_water.ifpcgl` | `ifpcgl` | `gas_water_flow.m` | 4 | yes | Capillary pressure switch |
| `flow.gas_water.matrix_relperm_table` | `RPGW` | `gas_water_flow.m` | 4 | yes | Matrix table |
| `flow.gas_water.fracture_relperm_table` | `PRF` | `gas_water_flow.m` | 4 | yes | Fracture table |
## Flow: Oil-Water
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `flow.oil_water.density_o_sc` | `density_o_sc` | `oil_water_flow.m` | 5,6,7 | yes | Oil density |
| `flow.oil_water.density_w_sc` | `density_w_sc` | `oil_water_flow.m` | 5,6,7 | yes | Water density |
| `flow.oil_water.oil_model` | `oil_model` | `oil_water_flow.m` | 5,6,7 | yes | 1 generated PVT, 2 tabulated |
| `flow.oil_water.pro` | `pro` | `oil_water_flow.m` | 5,6,7 | yes | Oil ref pressure |
| `flow.oil_water.Boi` | `Boi` | `oil_water_flow.m` | 5,6,7 | yes | Oil volume factor |
| `flow.oil_water.co` | `co` | `oil_water_flow.m` | 5,6,7 | yes | Oil compressibility |
| `flow.oil_water.voi` | `voi` | `oil_water_flow.m` | 5,6,7 | yes | Oil viscosity |
| `flow.oil_water.cvo` | `cvo` | `oil_water_flow.m` | 5,6,7 | yes | Oil viscosity-pressure coefficient |
| `flow.oil_water.Ppr` | `Ppr` | `oil_water_flow.m` | 5,6,7 | yes | Table or generated |
| `flow.oil_water.BO` | `BO` | `oil_water_flow.m` | 5,6,7 | yes | Table or generated |
| `flow.oil_water.MUO` | `MUO` | `oil_water_flow.m` | 5,6,7 | yes | Table or generated |
| `flow.oil_water.prw` | `prw` | `oil_water_flow.m` | 5,6,7 | yes | Water ref pressure |
| `flow.oil_water.Bwi` | `Bwi` | `oil_water_flow.m` | 5,6,7 | yes | Water volume factor |
| `flow.oil_water.cw` | `cw` | `oil_water_flow.m` | 5,6,7 | yes | Water compressibility |
| `flow.oil_water.vwi` | `vwi` | `oil_water_flow.m` | 5,6,7 | yes | Water viscosity |
| `flow.oil_water.cvw` | `cvw` | `oil_water_flow.m` | 5,6,7 | yes | Water viscosity-pressure coefficient |
| `flow.oil_water.ifpcow` | `ifpcow` | `oil_water_flow.m` | 5,6,7 | yes | Capillary pressure switch |
| `flow.oil_water.matrix_relperm_table` | `PRM` | `oil_water_flow.m` | 5,6,7 | yes | Matrix table |
| `flow.oil_water.fracture_relperm_table` | `PRF` | `oil_water_flow.m` | 5,6,7 | yes | Fracture table |
| `flow.oil_water.beta_non_darcy_flow` | `beta_non_Darcy_flow` | `oil_water_flow.m` | 5,6,7 | yes | Non-Darcy coefficient |
| `flow.oil_water.p_grad_threshold` | `p_grad_threshold` | `oil_water_flow.m` | 5,6,7 | yes | Threshold gradient |
## Flow: Multi-Component
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `flow.multi_component.Ds` | `Ds` | `multi_component_flow.m` | 1,2,3 | yes | Surfactant diffusion |
| `flow.multi_component.Db` | `Db` | `multi_component_flow.m` | 1,2,3 | yes | Salt diffusion |
| `flow.multi_component.c_ca_table` | `c_ca_table` | `multi_component_flow.m` | 1,2,3 | yes | Adsorption table |
| `flow.multi_component.cs_data` | `cs_data` | `multi_component_flow.m` | 1,2,3 | no | Derived from table |
| `flow.multi_component.cb_data` | `cb_data` | `multi_component_flow.m` | 1,2,3 | no | Derived from table |
| `flow.multi_component.csa_data` | `csa_data` | `multi_component_flow.m` | 1,2,3 | no | Derived from table |
| `flow.multi_component.cba_data` | `cba_data` | `multi_component_flow.m` | 1,2,3 | no | Derived from table |
| `flow.multi_component.R` | `R` | `multi_component_flow.m` | 1,2,3 | yes | Chemistry constant |
| `flow.multi_component.Vm` | `Vm` | `multi_component_flow.m` | 1,2,3 | yes | Molar volume |
| `flow.multi_component.Temperature` | `Temperature` | `multi_component_flow.m` | 1,2,3 | yes | Temperature |
| `flow.multi_component.chemistry_cof` | `chemistry_cof` | `multi_component_flow.m` | 1,2,3 | no | Derived |
| `flow.multi_component.x_matrix!!!!` | `xm` | `multi_component_flow.m` | 1,2,3 | yes | Chemistry activity factor for matrix cells |
| `flow.multi_component.x_fracture!!!` | `xf` | `multi_component_flow.m` | 1,2,3 | yes | Chemistry activity factor for fracture cells |
| `flow.multi_component.cs_Nc` | `cs_Nc` | `multi_component_flow.m` | 1,2,3 | yes | Dynamic relative permeability mapping |
| `flow.multi_component.Nc_nosurf` | `Nc_nosurf` | `multi_component_flow.m` | 1,2,3 | no | Derived |
| `flow.multi_component.Nc_surf` | `Nc_surf` | `multi_component_flow.m` | 1,2,3 | no | Derived |
| `flow.multi_component.kr_nosurf` | `kr_nosurf` | `multi_component_flow.m` | 1,2,3 | yes | Relative permeability table |
| `flow.multi_component.kr_surf` | `kr_surf` | `multi_component_flow.m` | 1,2,3 | yes | Relative permeability table |
| `flow.multi_component.PC` | `PC` | `multi_component_flow.m` | 1,2,3 | yes | Capillary pressure table |
| `flow.multi_component.cs_Nc_fracture` | `cs_Nc_fracture` | `multi_component_flow.m` | 1,2,3 | yes | Fracture table |
| `flow.multi_component.kr_nosurf_fracture` | `kr_nosurf_fracture` | `multi_component_flow.m` | 1,2,3 | yes | Fracture table |
| `flow.multi_component.kr_surf_fracture` | `kr_surf_fracture` | `multi_component_flow.m` | 1,2,3 | yes | Fracture table |
| `flow.multi_component.PC_fracture` | `PC_fracture` | `multi_component_flow.m` | 1,2,3 | yes | Fracture capillary table |
| `flow.multi_component.ifpcgl` | `ifpcgl` | `multi_component_flow.m` | 1,2,3 | yes | Capillary pressure switch |
| `flow.multi_component.p_grad_threshold` | `p_grad_threshold` | `multi_component_flow.m` | 1,2,3 | yes | Threshold gradient |
| `flow.multi_component.gas_prop.VL` | `gas_prop.VL` | `multi_component_flow.m` | 1,2,3 | yes | Often zero for oil-like use |
| `flow.multi_component.gas_prop.PL` | `gas_prop.PL` | `multi_component_flow.m` | 1,2,3 | yes | Langmuir pressure |
| `flow.multi_component.gas_prop.Kn` | `gas_prop.Kn` | `multi_component_flow.m` | 1,2,3 | yes | Knudsen number |
| `flow.multi_component.gas_prop.Kn_modified_factor` | `gas_prop.Kn_modified_factor` | `multi_component_flow.m` | 1,2,3 | no | Derived |
| `flow.multi_component.gas_prop.stress_factor_fracture` | `gas_prop.stress_factor_fracture` | `multi_component_flow.m` | 1,2,3 | yes | Present in case-specific flow files |
| `flow.multi_component.gas_prop.stress_factor_matrix` | `gas_prop.stress_factor_matrix` | `multi_component_flow.m` | 1,2,3 | yes | Present in case-specific flow files |
| `flow.multi_component.gas_prop.stress_factor_ref_pressure` | `gas_prop.stress_factor_ref_pressure` | `multi_component_flow.m` | 1,2,3 | yes | Present in case-specific flow files |
| `flow.multi_component.gas_prop.beta_non_darcy_flow` | `gas_prop.beta_non_Darcy_flow` | `multi_component_flow.m` | 1,2,3 | yes | Non-Darcy coefficient |
| `flow.multi_component.density_g_sc` | `density_g_sc` | `multi_component_flow.m` | 1,2,3 | yes | Standard density |
| `flow.multi_component.gas_model` | `gas_model` | `multi_component_flow.m` | 1,2,3 | yes | 1 generated, 2 tabulated |
| `flow.multi_component.prg` | `prg` | `multi_component_flow.m` | 1,2,3 | yes | Ref pressure |
| `flow.multi_component.Bgi` | `Bgi` | `multi_component_flow.m` | 1,2,3 | yes | Volume factor |
| `flow.multi_component.cg` | `cg` | `multi_component_flow.m` | 1,2,3 | yes | Compressibility |
| `flow.multi_component.vgi` | `vgi` | `multi_component_flow.m` | 1,2,3 | yes | Viscosity |
| `flow.multi_component.cvg` | `cvg` | `multi_component_flow.m` | 1,2,3 | yes | Viscosity-pressure coefficient |
| `flow.multi_component.Ppr` | `Ppr` | `multi_component_flow.m` | 1,2,3 | yes | Table or generated |
| `flow.multi_component.BG` | `BG` | `multi_component_flow.m` | 1,2,3 | yes | Table or generated |
| `flow.multi_component.MUG` | `MUG` | `multi_component_flow.m` | 1,2,3 | yes | Table or generated |
| `flow.multi_component.density_w_sc` | `density_w_sc` | `multi_component_flow.m` | 1,2,3 | yes | Water density |
| `flow.multi_component.prw` | `prw` | `multi_component_flow.m` | 1,2,3 | yes | Water ref pressure |
| `flow.multi_component.Bwi` | `Bwi` | `multi_component_flow.m` | 1,2,3 | yes | Water volume factor |
| `flow.multi_component.cw` | `cw` | `multi_component_flow.m` | 1,2,3 | yes | Water compressibility |
| `flow.multi_component.vwi` | `vwi` | `multi_component_flow.m` | 1,2,3 | yes | Water viscosity |
| `flow.multi_component.cvw` | `cvw` | `multi_component_flow.m` | 1,2,3 | yes | Water viscosity-pressure coefficient |
| `flow.multi_component.number_state_variables` | `number_state_variables` | `multi_component_flow.m` | 1,2,3 | no | Fixed as 4 in current code |
## Initial Conditions
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `initial.pressure` | `P` | flow files | 1-7 | yes | Initial pressure array |
| `initial.sw` | `Sw` | flow files | 1-7 | yes | Initial water saturation array |
| `initial.cs` | `Cs` | `multi_component_flow.m` | 1,2,3 | yes | Initial surfactant concentration |
| `initial.cb` | `Cb` | `multi_component_flow.m` | 1,2,3 | yes | Initial salt concentration |
## Wells
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `wells.well1` | `well1` | `main1.m` | 1-7 | yes | Conventional wells table |
| `wells.num_fracture_wells` | `num_fracture_wells` | `main1.m` | 1-7 | yes | Count |
| `wells.welloc` | `welloc` | `main1.m` | 1-7 | yes | Fracture well coordinates |
| `wells.perfnum` | `perfnum` | helper output | 1-7 | no | Derived from `findWelloc` |
| `wells.well2` | `well2` | `main1.m` | 1-7 | yes | Fracture-well table |
| `wells.Wellc` | `Wellc` | helper output | 1-7 | no | Combined runtime structure |
Conventional well row shape:
- well name
- perforation count
- perforation grid index matrix
- well radius
- skin
- well type
Fracture-well row shape:
- well name
- perforation count
- perforation indices
- well radius
- skin
- well type
## Schedule
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `schedule.number_phases` | `number_phases` | `main1.m` | 1-7 | yes | Stage count |
| `schedule.well_schedules` | `well_schedules` | `main1.m` | 1-7 | yes | Per-stage control rows |
| `schedule.time` | `time` | `main1.m` | 1-7 | yes | Stage duration vector |
| `schedule.dtmax` | `dtmax` | `main1.m` | 1-7 | yes | Max timestep per stage |
| `schedule.dtmin` | `dtmin` | `main1.m` | 1-7 | yes | Min timestep per stage |
Schedule row fields observed:
- well name
- well state
- well role
- control mode
- target value 1
- target value 2
- optional `Cs_inj`
- optional `Cb_inj`
## Solver
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `solver.yitap` | `yitap` | `main1.m` | 1-7 | yes | Adaptive timestep control |
| `solver.yitas` | `yitas` | `main1.m` | 1-7 | yes | Adaptive timestep control |
| `solver.omega` | `omega` | `main1.m` | 1-7 | yes | Adaptive timestep control |
| `solver.Nmax` | `Nmax` | `main1.m` | 1-7 | yes | Max Newton iterations |
| `solver.epsave` | `epsave` | `main1.m` | 1-7 | yes | Average residual tolerance |
| `solver.epsmax` | `epsmax` | `main1.m` | 1-7 | yes | Max residual tolerance |
## Runtime / Output
| Config Path | Source Variable | Source File | Cases | Editable | Notes |
| --- | --- | --- | --- | --- | --- |
| `output.result_name` | none | future GUI | all | yes | Result label |
| `output.save_input_path` | none | future GUI | all | yes | Save location |
| `output.save_result_path` | none | future GUI | all | yes | Save location |
| `output.plot_requests` | none | future GUI | all | yes | Requested result plots |
Runtime-only outputs:
- `Times`
- `OutputRs`
- `Wellpara`
- `trun`
## Known Inconsistencies To Normalize
- `rock_density` and `density_rock` are both used in SP discretization files.
- Some fields are editable expressions in one case and constant arrays in another, especially `kx`, `ky`, `kz`, and `pori`.
- `boundary` exists in case 1 but not in the other SP examples.
- DP mode introduces extra fields absent from SP mode.
These inconsistencies are exactly why the GUI must be built on a normalized `config` instead of the raw scripts.
+369
View File
@@ -0,0 +1,369 @@
# EDFM GUI Project Status Overview
## Project Goal
Build a MATLAB GUI for the existing EDFM simulator so that users can:
- edit simulation parameters through a graphical interface
- load and save input configurations
- run the solver from the GUI
- view run status and basic results
- import and export results
- eventually call existing plotting functions from the result page
The current solver code already exists.
The main work is:
1. extracting and organizing parameters from the existing case scripts and helper files
2. building a GUI around a unified configuration format and runtime entry point
## Functional Scope Agreed So Far
### GUI Structure
The GUI should be organized by the `Part1` to `Part8` logic already present in the case `main1.m` files.
Recommended page split:
- `Part1 模型`
- `Part2 网格`
- `Part3 裂缝`
- `Part4 离散化/岩性`
- `Part5 流动模型`
- `Part6 井与制度`
- `Part7 求解器`
- `结果`
There is also a top toolbar for:
- template loading
- config import/export
- run
- result import/export
### Data Management
The main editable runtime format is now defined as MATLAB `struct`.
Current persistence direction:
- config import/export: `.mat`
- result import/export: `.mat`
JSON is not the current priority.
It can be added later if needed.
### Runtime Model Handling
The three flow models are mutually exclusive:
- `1`: gas-water
- `2`: oil-water
- `3`: multi-component
The GUI should only show the active flow model's parameters.
Inactive model parameters should not be shown or used during runtime.
## What Has Been Completed
## 1. Parameter extraction and organization
The repository has been reviewed across:
- all 7 example case folders
- `main1.m`
- `GridProp_pre.m`
- `grid_discretization_SP_model.m`
- `grid_discretization_DP_model.m`
- `gas_water_flow.m`
- `oil_water_flow.m`
- `multi_component_flow.m`
- solver entry and main runtime functions
Completed documents:
- [`gui_parameter_plan.md`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\docs\gui_parameter_plan.md)
- [`case_template_summary.md`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\docs\case_template_summary.md)
- [`parameter_registry.md`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\docs\parameter_registry.md)
These already cover:
- overall GUI architecture
- 7-case summary
- field-level parameter registry
- separation of editable parameters and derived runtime fields
## 2. Unified config skeleton
Created:
- [`create_empty_config.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\config\create_empty_config.m)
Current config structure includes:
- `meta`
- `model`
- `grid`
- `fracture`
- `discretization`
- `flow`
- `initial`
- `wells`
- `schedule`
- `solver`
- `output`
It now includes all major editable parameter groups identified so far.
## 3. Config and result MAT import/export helpers
Created:
- [`load_config_mat.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\config\load_config_mat.m)
- [`save_config_mat.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\config\save_config_mat.m)
- [`load_results_mat.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\results\load_results_mat.m)
- [`save_results_mat.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\results\save_results_mat.m)
## 4. Unified runtime entry point
Created:
- [`run_case.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\runtime\run_case.m)
This is now the intended runtime entry point instead of calling each case's `main1.m` directly.
Current status:
- grid preprocessing is routed through unified config
- fracture inputs are routed through unified config
- well and schedule setup are routed through unified config
- solver invocation is routed through unified config
- all three `flow_model` branches are now supported through the unified runtime path
## 5. First template support
Created:
- [`load_case_template.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\templates\load_case_template.m)
- [`load_case_template_case01.m`](C:\Users\Administrator\Videos\3D_EDFM_simulator_20260305\gui_support\templates\load_case_template_case01.m)
Current template coverage:
- `case01`
This is enough to validate the unified config and runtime direction, but not yet enough for final GUI delivery.
## 6. App Designer direction clarified
Important conclusion:
- a pure `.m` app class is not the right final form for this project if the user wants to edit the GUI in MATLAB App Designer
- the final GUI should be built as a real `.mlapp`
- the current recommended workflow is:
- manually draw the layout in App Designer
- keep stable component names
- then bind code to those components
## What Still Needs To Be Done
## 1. Draw the real `.mlapp` interface
This is the next main task.
Need to complete:
- top toolbar
- all main tabs
- model-specific sub-tabs or dynamic sections
- all editable controls
- result page layout
The drawing guide has been prepared conceptually, but the actual `.mlapp` still needs to be built manually in App Designer.
## 2. Bind `.mlapp` code to existing backend
After the UI is drawn, code still needs to be connected for:
- startup default config loading
- template switching
- config import/export
- result import/export
- reading values from controls into `config`
- writing `config` back into controls
- calling `run_case(config)`
- refreshing result plots
## 3. Expand template coverage
Currently only `case01` has a template loader.
Still needed:
- `case02`
- `case03`
- `case04`
- `case05`
- `case06`
- `case07`
These should eventually all become presets in the GUI.
## 4. Strengthen flow-model config coverage
The unified runtime path now supports all three model branches, but more practical work is still needed:
- make sure default template values are complete for each model
- validate that GUI fields map cleanly to backend config fields
- ensure inactive model fields do not interfere with execution
## 5. Improve editing experience for complex parameters
Right now, many large arrays or nested cell structures are still best represented as text expressions.
This is acceptable for early integration but not ideal for end users.
Likely future upgrades:
- use `UITable` for well definitions
- use `UITable` for schedules
- use `UITable` for fracture engineering input
- use dedicated table editors for relperm/PVT/adsorption data
## 6. Results page enhancement
The final result page should support:
- summary text
- well response curves
- Newton-vs-time or runtime diagnostics
- 2D and 3D plots
- selected existing post-processing functions
This is only partially addressed so far.
## Hard Parts
## 1. Parameters are not only in `main1.m`
This is the biggest structural difficulty.
Important parameters are scattered across:
- case `main1.m`
- grid preprocessing files
- SP/DP discretization files
- physics setup files
- solver-related helper files
This makes GUI extraction error-prone if only entry scripts are inspected.
## 2. Same function names appear in multiple case folders
Several case folders contain same-named files such as:
- `grid_discretization_SP_model.m`
- `multi_component_flow.m`
This means runtime path resolution can break if the working directory or MATLAB path is not controlled carefully.
The current backend addresses this by resolving case folders explicitly before running.
## 3. MATLAB App Designer is not Qt-style UI-file driven
Unlike Qt `.ui`, MATLAB `.mlapp` is not a simple open text UI definition format.
This means:
- generating App Designer GUI purely by external text editing is unreliable
- manual drawing inside App Designer is the safer workflow
## 4. Complex data entry is awkward in basic controls
Several parameters are naturally tabular or nested:
- fracture engineering input
- well definitions
- well schedules
- relperm tables
- adsorption tables
These need careful component choice.
If handled with only `TextArea`, the app will work but will not be user-friendly.
## 5. Encoding and Chinese path issues
Some files and folders contain Chinese names.
Some comments also appear to have encoding issues.
Risks:
- MATLAB string/path handling may be fine, but external tooling and generated code may display garbage text
- hardcoding such paths in generated code is risky
ASCII-safe identifiers and runtime folder resolution are preferred where possible.
## Easy-To-Break Areas
## 1. Component naming drift
If the `.mlapp` component names are changed casually after backend code is written, callbacks and data binding will break quickly.
Recommendation:
- finalize component names early
- keep names stable
## 2. Array/cell parsing from UI text
If text areas are used for MATLAB expressions, malformed input can break parsing.
Examples:
- missing brackets
- malformed cell arrays
- inconsistent row widths
Recommendation:
- use text areas only as an intermediate step
- replace key inputs with `UITable` later
## 3. Flow-model mutual exclusivity
Gas-water, oil-water, and multi-component are mutually exclusive.
If the GUI keeps unrelated fields visible and active, users may edit values that are silently ignored or accidentally used.
Recommendation:
- show only the active model section
- hide or disable the others
## 4. Schedule and well table consistency
The solver expects consistent relations among:
- `well1`
- `welloc`
- `well2`
- `well_schedules`
- `time`
- `dtmin`
- `dtmax`
If the user edits one without updating the others, runtime errors are likely.
## 5. Case-specific discretization assumptions
Case 1 includes irregular boundary polygon logic.
Case 3 uses DP-specific fields.
Other cases use different rock defaults.
If the GUI over-generalizes too early, it may hide case-specific assumptions that are required for correct runs.
## Recommended Next Step
The highest-value next step is:
1. manually build the `.mlapp` layout in App Designer
2. keep component names fixed
3. then connect each page to the existing backend functions and config structure
That is the safest path to a maintainable App Designer application.