Skip to content

Commit d6638ee

Browse files
skip ci
1 parent db931bd commit d6638ee

22 files changed

Lines changed: 5621 additions & 4979 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ showcase
4545
papers
4646
sprint
4747
*/fem_output
48+
.github/*.md
49+
.github/instructions
50+
.github/prompts

Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
1515
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1616
EzXML = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615"
1717
ForceImport = "9dda63f9-cce7-5873-89fa-eccbb2fffcde"
18+
GetDP = "dbfd83e6-7aba-450b-9c2b-93ccd973023a"
1819
Gmsh = "705231aa-382f-11e9-3f0c-b7cb4346fdeb"
1920
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
2021
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
22+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
23+
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
2124
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
2225
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2326
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
@@ -39,10 +42,13 @@ DisplayAs = "0.1.6"
3942
DocStringExtensions = "0.9.3"
4043
EzXML = "1.2.0"
4144
ForceImport = "0.0.3"
45+
GetDP = "0.1.0"
4246
Gmsh = "0.3.1"
4347
HypertextLiteral = "0.9.5"
4448
JSON3 = "1.14.2"
4549
LinearAlgebra = "1.11.0"
50+
Logging = "1.11.0"
51+
LoggingExtras = "1.1.0"
4652
Measurements = "2.11.0"
4753
Pkg = "1.11.0"
4854
PlotlyJS = "0.18.15"

docs/src/conventions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,18 +362,18 @@ A workspace:
362362
Each module follows a consistent type hierarchy:
363363
364364
```julia
365-
AbstractProblemDefinition
366-
├── FEMProblemDefinition
365+
AbstractProblemFormulation
366+
├── FEMFormulation :> {FEMDarwin, FEMElectrodynamics, ...}
367367
├── AbstractFDEMFormulation :> {CPEarth, CIGRE, ...}
368368
├── AbstractEHEMFormulation :> {EnforceLayer, EquivalentSigma, ...}
369369
├── ...
370370
└── [Other specialized formulations, concrete or abstract]
371371
372-
AbstractSolverMethod
373-
├── FEMSolver
374-
├── EMTSolver
372+
FormulationOptions
373+
├── FEMOptions
374+
├── EMTOptions
375375
├── ...
376-
└── [Other specialized solvers]
376+
└── [Other specialized options sets]
377377
378378
AbstractWorkspace
379379
├── FEMWorkspace
@@ -416,7 +416,7 @@ This pattern ensures clean separation of concerns, making the code more maintain
416416
417417
State is managed exclusively through the Workspace, which contains:
418418
419-
1. **Configuration state**: Original system, formulation, and solver.
419+
1. **Configuration state**: Original system, formulation, and opts.
420420
2. **Entity state**: Collections of typed entities.
421421
3. **Lookup maps**: Efficient mappings between entities and properties.
422422
4. **Processing state**: Temporary calculation state.
@@ -428,7 +428,7 @@ This centralized approach eliminates global state and ensures thread safety.
428428
429429
The FEMTools module exemplifies this pattern:
430430
431-
- `FEMProblemDefinition`: Physics parameters for FEM simulation.
431+
- `FEMFormulation`: Physics parameters for FEM simulation.
432432
- `FEMSolver`: Execution parameters for meshing and solving.
433433
- `FEMWorkspace`: Central state container for all FEM operations.
434434
- Entity types: Typed data containers for different geometric elements.

examples/tutorial2.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ In this section, the cable design is examined and the calculated parameters are
344344
=#
345345

346346
# Compare with datasheet information (R, L, C values):
347-
core_df = cabledesign_todf(cable_design, :core)
347+
core_df = cabledesign_todf(cable_design, :baseparams)
348348

349349
# Obtain the equivalent electromagnetic properties of the cable:
350350
components_df = cabledesign_todf(cable_design, :components)
@@ -402,8 +402,8 @@ y0 = -1
402402
xa, ya, xb, yb, xc, yc = trifoil_formation(x0, y0, 0.035)
403403

404404
# Initialize the `LineCableSystem` with the first cable (phase A):
405-
cabledef = CableDef(cable_design, xa, ya, Dict("core" => 1, "sheath" => 0, "jacket" => 0))
406-
cable_system = LineCableSystem("tutorial", 20.0, earth_params, 1000.0, cabledef)
405+
cablepos = CablePosition(cable_design, xa, ya, Dict("core" => 1, "sheath" => 0, "jacket" => 0))
406+
cable_system = LineCableSystem("tutorial", 1000.0, cablepos)
407407

408408
# Add remaining cables (phases B and C):
409409
addto_linecablesystem!(cable_system, cable_design, xb, yb,
@@ -438,8 +438,8 @@ The final step showcases how to export the model for electromagnetic transient s
438438
=#
439439

440440
# Export to PSCAD input file:
441-
output_file = joinpath(@__DIR__, "$(cable_system.case_id)_export.pscx")
442-
export_file = export_pscad_lcp(cable_system, file_name=output_file);
441+
output_file = joinpath(@__DIR__, "$(cable_system.system_id)_export.pscx")
442+
export_file = export_pscad_lcp(cable_system, earth_params, file_name=output_file);
443443

444444
#=
445445
## Conclusion

examples/tutorial3.jl

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ y0 = -1
2121
xa, ya, xb, yb, xc, yc = trifoil_formation(x0, y0, 0.035)
2222

2323
# Initialize the `LineCableSystem` with the first cable (phase A):
24-
cabledef = CableDef(cable_design, xa, ya, Dict("core" => 1, "sheath" => 0, "jacket" => 0))
25-
cable_system = LineCableSystem("tutorial", 20.0, earth_params, 1000.0, cabledef)
24+
cablepos = CablePosition(cable_design, xa, ya, Dict("core" => 1, "sheath" => 0, "jacket" => 0))
25+
cable_system = LineCableSystem("tutorial", 1000.0, cablepos)
2626

2727
# Add remaining cables (phases B and C):
2828
addto_linecablesystem!(cable_system, cable_design, xb, yb,
@@ -35,36 +35,45 @@ addto_linecablesystem!(
3535

3636
display(cable_system)
3737

38-
# Create a FEMProblemDefinition with custom parameters
38+
# Define a LineParametersProblem with the cable system and earth model
39+
problem = LineParametersProblem(
40+
cable_system,
41+
temperature=20.0, # Operating temperature
42+
earth_props=earth_params,
43+
frequencies=[50.0], # Frequency for the analysis
44+
)
45+
46+
# Create a FEMFormulation with custom mesh definitions
3947
domain_radius = 5.0
40-
problem = FEMProblemDefinition(
48+
formulation = FEMFormulation(
4149
domain_radius=domain_radius,
42-
correct_twisting=true,
50+
domain_radius_inf=domain_radius * 1.25,
4351
elements_per_length_conductor=1,
4452
elements_per_length_insulator=2,
4553
elements_per_length_semicon=1,
4654
elements_per_length_interfaces=5,
4755
points_per_circumference=16,
48-
analysis_type=[0, 1], # Electrostatic and magnetostatic
56+
analysis_type=(FEMDarwin(), FEMElectrodynamics()),
4957
mesh_size_min=1e-6,
5058
mesh_size_max=domain_radius / 5,
5159
mesh_size_default=domain_radius / 10,
5260
mesh_algorithm=5,
5361
materials_db=materials_db
5462
)
5563

56-
# Create a FEMSolver with custom parameters
57-
solver = FEMSolver(
64+
# Define runtime FEMOptions
65+
opts = FEMOptions(
5866
force_remesh=true, # Force remeshing
59-
run_solver=false,
67+
run_solver=true,
68+
overwrite_results=true,
6069
preview_geo=false, # Preview geometry
61-
preview_mesh=true, # Preview the mesh
70+
preview_mesh=false, # Preview the mesh
6271
base_path=joinpath(@__DIR__, "fem_output"),
63-
verbosity=0, # Verbose output
64-
getdp_executable=joinpath("/home/amartins/Applications/onelab-Linux64", "getdp"), # Path to GetDP executable
72+
verbosity=2, # Verbose output
73+
getdp_executable=joinpath("/home/amartins/Applications/onelab-Linux64", "getdp"), # Path to GetDP executable
6574
)
6675

6776
# Run the FEM model
68-
workspace = run_fem_model(cable_system, problem, solver, frequency=50.0)
77+
@time _ = compute!(problem, formulation, opts)
6978

7079
println("FEM model run completed.")

0 commit comments

Comments
 (0)