Skip to content

Commit

Permalink
OpenSemba | Fixed voltage mode for wire probes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianarce-elemwave committed Jan 17, 2025
1 parent 1901ce2 commit 1c61028
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/parsers/json/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,10 @@ outputRequest::OutputRequest::Type strToOutputType(std::string str) {
return outputRequest::OutputRequest::Type::magneticFieldNormals;
}
else if (str.compare("current") == 0) {
return outputRequest::OutputRequest::Type::current;;
return outputRequest::OutputRequest::Type::current;
}
else if (str.compare("voltage") == 0) {
return outputRequest::OutputRequest::Type::voltage;
}
else if (str.compare("bulkCurrentElectric") == 0) {
return outputRequest::OutputRequest::Type::bulkCurrentElectric;
Expand Down
6 changes: 5 additions & 1 deletion test/parsers/json/ParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ TEST_F(ParserJSONParserTest, b2)
ASSERT_NO_THROW(Parser{ getFilename("b2") }.read());
}

TEST_F(ParserJSONParserTest, wire_probes)
{
ASSERT_NO_THROW(Parser{ getFilename("wire_probes") }.read());
}

TEST_F(ParserJSONParserTest, b2_detailed)
{
auto data{ Parser{getFilename("b2") }.read() };
Expand Down Expand Up @@ -397,7 +402,6 @@ TEST_F(ParserJSONParserTest, threeWiresDetailed)
EXPECT_THAT(thirdBundle.getElemIds(), ::testing::ElementsAre(thirdPolyline->getId()));
}


TEST_F(ParserJSONParserTest, bundleAndTwoWiresDetailed)
{
std::ifstream stream(getFolder() + "/wires/cable_bundle_and_two_wires.smb.json");
Expand Down
179 changes: 179 additions & 0 deletions testData/wire_probes/wire_probes.smb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
{
"_version": "0.16",
"_format": "Semba Data File in JSON format",
"analysis": {
"solver": "ugrfdtd",
"runSimulation": false,
"timeStep": 3.0813331224743534e-12,
"forceRestarting": false,
"resumeSimulation": false,
"flush": 0.0,
"compositesModel": "MIBC",
"wiresFlavor": "holland",
"mtln": false,
"minDistanceWires": 0.5,
"mesherOptions": {
"contourRefinement": false,
"unwantedConnectionsInfo": false,
"structuredCellsInfo": false,
"mesher": "DMesher",
"mode": "Structured",
"forbiddenLength": 0.25,
"slantedWires": false,
"vtkExport": true,
"postmshExport": false,
"postsmbExport": false,
"slantedThreshold": 0.25
},
"cfl": 0.8,
"mapVTK": false,
"geometryScalingFactor": 0.001,
"finalTime": 3e-08
},
"grids": [
{
"gridType": "gridCondition",
"type": "Number_of_cells",
"numberOfCells": "{55 55 55}",
"layerBox": "{106.04761400000001 105.00000000000001 105.00000000000001 -5.0 -5.0 -5.0}"
}
],
"model": {
"layers": [
{
"id": 1,
"name": "Plane"
},
{
"id": 2,
"name": "Plane001"
},
{
"id": 3,
"name": "Wire"
}
],
"materials": [
{
"materialId": 1,
"name": "PEC",
"materialType": "PEC"
},
{
"materialId": 2,
"name": "Wirematerial",
"materialType": "Wire",
"wireType": "Standard",
"radius": 0.0001,
"resistance": 100.0,
"inductance": 0.0
},
{
"name": "Short",
"materialType": "Connector",
"connectorType": "Conn_short",
"materialId": 3
}
],
"coordinates": [
" 1 +1.00000000e+02 +1.00000000e+02 +0.00000000e+00",
" 2 +0.00000000e+00 +1.00000000e+02 +0.00000000e+00",
" 3 +0.00000000e+00 +0.00000000e+00 +0.00000000e+00",
" 4 +1.00000000e+02 +0.00000000e+00 +0.00000000e+00",
" 5 +1.00000000e+02 +1.00000000e+02 +1.00000000e+02",
" 6 +0.00000000e+00 +1.00000000e+02 +1.00000000e+02",
" 7 +0.00000000e+00 +0.00000000e+00 +1.00000000e+02",
" 8 +1.00000000e+02 +0.00000000e+00 +1.00000000e+02",
" 9 +5.00000000e+01 +5.00000000e+01 +0.00000000e+00",
" 10 +5.00000000e+01 +5.00000000e+01 +2.00000000e+01",
" 11 +5.00000000e+01 +5.00000000e+01 +4.00000000e+01",
" 12 +5.00000000e+01 +5.00000000e+01 +6.00000000e+01",
" 13 +5.00000000e+01 +5.00000000e+01 +8.00000000e+01",
" 14 +5.00000000e+01 +5.00000000e+01 +1.00000000e+02"
],
"elements": {
"node": [
" 6 0 0 9",
" 7 0 0 11",
" 8 0 0 13",
" 9 3 3 9",
" 10 3 3 14"
],
"line": [
],
"polyline": [
" 5 2 3 9 10 11 12 13 14"
],
"triangle": [
" 1 1 1 1 2 3",
" 2 1 1 1 3 4",
" 3 1 2 5 6 7",
" 4 1 2 5 7 8"
]
},
"cables": [
{
"name": "Cable",
"materialId": 2,
"initialConnectorId": 3,
"endConnectorId": 3,
"elemIds": [
5
]
}
]
},
"sources": [
{
"sourceType": "generator",
"type": "voltage",
"elemIds": [
6
],
"magnitude": {
"type": "Gaussian",
"frequencyMaximum": 1000000000.0
}
}
],
"probes": [
{
"gidOutputType": "OutRq_on_point",
"name": "Wire probe current",
"type": "current",
"domain": {
"initialTime": 0.0,
"finalTime": 0.0,
"samplingPeriod": 0.0
},
"elemIds": [
7
]
},
{
"gidOutputType": "OutRq_on_point",
"name": "Wire probe voltage",
"type": "voltage",
"domain": {
"initialTime": 0.0,
"finalTime": 0.0,
"samplingPeriod": 0.0
},
"elemIds": [
8
]
}
],
"boundary": {
"lower": [
"PML",
"PML",
"PML"
],
"upper": [
"PML",
"PML",
"PML"
]
}
}

0 comments on commit 1c61028

Please sign in to comment.