Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

Commit 43ae6f4

Browse files
hambrickjcpelesh
andauthored
Add pflow unit tests (#197)
--------- Co-authored-by: Slaven Peles <peless@ornl.gov>
1 parent c89911c commit 43ae6f4

12 files changed

Lines changed: 341 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
### PS
1818

19+
- Added improved parser for RAW file format.
20+
- Added support for PSS/E contingecy file format
21+
1922
### PFLOW
2023

24+
- Added unit tests for PFLOW
25+
2126
### OPFLOW
2227

2328
### TCOPFLOW
23.3 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-matload_block_size 2
1.35 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-matload_block_size 2
33.9 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-matload_block_size 2

include/pflow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ PETSC_EXTERN PetscErrorCode PFLOWPrintSolution(PFLOW);
4646
PETSC_EXTERN PetscErrorCode PFLOWSetGICData(PFLOW, const char[]);
4747
PETSC_EXTERN PetscErrorCode PFLOWSaveSolutionDefault(PFLOW, const char[]);
4848
PETSC_EXTERN PetscErrorCode PFLOWSetOutputFormat(PFLOW, OutputFormat);
49+
PETSC_EXTERN PetscErrorCode PFLOWGetJacobian(PFLOW, Mat *);
4950

5051
#endif

src/pflow/pflow.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,3 +1733,22 @@ PetscErrorCode PFLOWSetSummaryStats(PFLOW pflow) {
17331733

17341734
PetscFunctionReturn(0);
17351735
}
1736+
1737+
/*
1738+
PFLOWGetJacobian - Returns the Jacobian matrix
1739+
1740+
Inputs:
1741+
. pflow - the PFLOW object
1742+
1743+
Outputs:
1744+
jac - the Jacobian matrix
1745+
*/
1746+
PetscErrorCode PFLOWGetJacobian(PFLOW pflow, Mat *jac) {
1747+
PetscErrorCode ierr;
1748+
1749+
PetscFunctionBegin;
1750+
1751+
*jac = pflow->Jac;
1752+
1753+
PetscFunctionReturn(0);
1754+
}

tests/unit/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ add_executable(test_acopf test_acopf.cpp utils/test_acopf_utils.cpp)
99
target_link_libraries(test_acopf ExaGO::OPFLOW)
1010
target_include_directories(test_acopf PRIVATE ./utils)
1111

12+
add_executable(test_pflow test_pflow.cpp utils/test_acopf_utils.cpp)
13+
target_link_libraries(test_pflow ExaGO::PFLOW)
14+
target_include_directories(test_pflow PRIVATE ./utils)
15+
1216
add_executable(test_error_handler test_error_handler.cpp)
1317
target_link_libraries(test_error_handler ExaGO::UTILS)
1418

@@ -37,6 +41,18 @@ if(EXAGO_INSTALL_TESTS)
3741
${network_files}
3842
)
3943

44+
exago_add_test(
45+
NAME
46+
"UNIT_TESTS_PFLOW"
47+
COMMAND
48+
${RUNCMD}
49+
$<TARGET_FILE:test_pflow>
50+
-validation_dir
51+
${CMAKE_SOURCE_DIR}/datafiles/test_validation
52+
NETFILES
53+
${network_files}
54+
)
55+
4056
exago_add_test(
4157
NAME UNIT_TESTS_UTILS COMMAND $<TARGET_FILE:test_error_handler>
4258
)

0 commit comments

Comments
 (0)