-
Notifications
You must be signed in to change notification settings - Fork 16
Electrostatic solver #149
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
Electrostatic solver #149
Changes from 33 commits
be1a1d8
dc044f8
1a36066
d8707a2
7f71c6b
293512f
03e22a0
8fc4d33
ae8fa27
096eae0
8148cf6
b690c2b
51b1e4d
ee2be7c
6986d49
a3dcd81
554450b
117f5fc
e72ffbd
538df5f
3702d0b
3091469
48b8948
e435d4b
c9a1dbc
b720ec2
6f3919f
4510aff
8c092af
b324a53
7201d89
7280631
aa09196
3250eec
4c33a98
6097798
0b1f079
f0ddd9e
e38bb84
954f003
dfe18af
710f775
9fa0cd4
e8d43c9
5c6bd9b
3f848ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,164 @@ | ||
| PostOperation Get_global UsingPost EleSta { | ||
| // energy stored in air | ||
| Print[ energy[Domain], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"Energy_Stored_Component.dat"], LastTimeStepOnly, StoreInVariable $energy_Component]; | ||
| Print[ energy[Air], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"Energy_Stored_Air.dat"], LastTimeStepOnly, StoreInVariable $energy_Air]; | ||
| Print[ energy[Core], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"Energy_Stored_Core.dat"], LastTimeStepOnly, StoreInVariable $energy_Core]; | ||
| // Print[ energy[Insulation_bobbin], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"Energy_Stored_bobbin.dat"], LastTimeStepOnly, StoreInVariable $energy_bobbin]; | ||
| // Print[ energy[Insulation_cond], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"Energy_Stored_Cond_insulation.dat"], LastTimeStepOnly, StoreInVariable $energy_cond_insulation]; | ||
|
|
||
| // average voltage of the core | ||
| Print[ Avg_Voltage_Core[Core], OnGlobal, Format TimeTable, File > StrCat[DirResCirc,"Avg_Core_voltage.dat"], LastTimeStepOnly, StoreInVariable $Avg_Voltage_Core]; | ||
|
|
||
| // Charges | ||
| Print[ Charge[Air], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"charge_Air.dat"], LastTimeStepOnly, StoreInVariable $Charge_Air]; | ||
| Print[ Charge[Core], OnGlobal, Format TimeTable, File > StrCat[DirResVals,"charge_Core.dat"], LastTimeStepOnly, StoreInVariable $Charge_Core]; | ||
| // voltage and charges on windings | ||
| For n In {1:n_windings} | ||
| Print[ U, OnRegion Winding~{n}, Format TimeTable, File > Sprintf[StrCat[DirResCirc,"U_%g.dat"], n] , LastTimeStepOnly]; | ||
| EndFor | ||
| For n In {1:n_windings} | ||
| Print[ Q, OnRegion Winding~{n}, Format TimeTable, File > Sprintf[StrCat[DirResCirc,"Q_%g.dat"], n] , LastTimeStepOnly]; | ||
| EndFor | ||
| Print[ Q, OnRegion Core, Format TimeTable, File > Sprintf[StrCat[DirResCirc,"Q_Core.dat"]] , LastTimeStepOnly]; | ||
|
|
||
| // print charge and voltage for each turn in separate file (Just another way) | ||
| For winding_number In {1:n_windings} | ||
| nbturns~{winding_number} = NbrCond~{winding_number} / SymFactor; | ||
|
|
||
| // Print charge for each turn in the winding | ||
| For turn_number In {1:nbturns~{winding_number}} | ||
| Print[ U, OnRegion Turn~{winding_number}~{turn_number}, Format TimeTable, | ||
| File > Sprintf[StrCat[DirResCirc, "U_%g_%g.dat"], winding_number, turn_number], LastTimeStepOnly]; | ||
| Print[ Q, OnRegion Turn~{winding_number}~{turn_number}, Format TimeTable, | ||
| File > Sprintf[StrCat[DirResCirc, "Q_%g_%g.dat"], winding_number, turn_number], LastTimeStepOnly]; | ||
| EndFor | ||
| EndFor | ||
|
|
||
| // print voltages for each turn | ||
| For winding_number In {1:n_windings} | ||
| nbturns~{winding_number} = NbrCond~{winding_number} / SymFactor; | ||
|
|
||
| // Print voltage for each turn in the winding | ||
| For turn_number In {1:nbturns~{winding_number}} | ||
| Print[ U~{winding_number}~{turn_number}, | ||
| OnRegion Turn~{winding_number}~{turn_number}, Format Table, File > Sprintf[StrCat[DirResValsVoltage~{winding_number}, | ||
| "voltage_%g_%g.dat"], winding_number, turn_number], LastTimeStepOnly, StoreInVariable $U~{winding_number}~{turn_number}]; | ||
| EndFor | ||
| EndFor | ||
|
|
||
| // print charges for each turn | ||
| For winding_number In {1:n_windings} | ||
| nbturns~{winding_number} = NbrCond~{winding_number} / SymFactor; | ||
|
|
||
| // Print charge for each turn in the winding | ||
| For turn_number In {1:nbturns~{winding_number}} | ||
| Print[ Q~{winding_number}~{turn_number}, | ||
| OnRegion Turn~{winding_number}~{turn_number}, Format Table, File > Sprintf[StrCat[DirResValsCharge~{winding_number}, | ||
| "Charge_%g_%g.dat"], winding_number, turn_number], LastTimeStepOnly, StoreInVariable $Q~{winding_number}~{turn_number}]; | ||
| EndFor | ||
| EndFor | ||
|
|
||
|
|
||
| // Calculate and print capacitance through the stored energy | ||
| If (Flag_voltage) | ||
| For winding_number In {1:n_windings} | ||
| nbturns~{winding_number} = NbrCond~{winding_number} / SymFactor; | ||
|
|
||
| // Loop through each turn as the reference turn | ||
| For turn_number1 In {1:nbturns~{winding_number}} | ||
| // Loop through every other turn, including the reference turn itself | ||
| Print[ Capacitance_Between_Turns_Core~{winding_number}~{turn_number1}, | ||
| OnRegion DomainCond~{winding_number}~{turn_number1}, Format Table, File > Sprintf[StrCat[DirResValsTurn~{turn_number1}, | ||
| "C_%g_%g_Core.dat"], winding_number, turn_number1], LastTimeStepOnly]; | ||
| For turn_number2 In {1:nbturns~{winding_number}} | ||
| // Print the calculated capacitance between each pair of turns | ||
| /*Print[ Capacitance_Between_Turns~{winding_number}~{turn_number1}~{turn_number2}[Domain], | ||
| OnGlobal, Format TimeTable, | ||
| File > Sprintf[StrCat[DirResValsTurn~{turn_number1}, "C_%g_%g_%g.dat"], winding_number, turn_number1, turn_number2] ];*/ | ||
| // Using this for $... | ||
| Print[ Capacitance_Between_Turns~{winding_number}~{turn_number1}~{turn_number2}, | ||
| OnRegion DomainCond~{winding_number}~{turn_number1}, Format Table, File > Sprintf[StrCat[DirResValsTurn~{turn_number1}, | ||
| "C_%g_%g_%g.dat"], winding_number, turn_number1, turn_number2], LastTimeStepOnly]; | ||
| EndFor | ||
| // Print capacitance between this turn and turns in other windings | ||
| For other_winding_number In {1:n_windings} | ||
| If (other_winding_number != winding_number) | ||
| nbturns~{other_winding_number} = NbrCond~{other_winding_number} / SymFactor; | ||
|
|
||
| // Loop through each turn in the other winding | ||
| For turn_number2 In {1:nbturns~{other_winding_number}} | ||
| // Print the calculated capacitance between each pair of turns in different windings | ||
| Print[ Capacitance_Cross~{winding_number}~{turn_number1}~{other_winding_number}~{turn_number2}, | ||
| OnRegion DomainCond~{winding_number}~{turn_number1}, Format Table, File > Sprintf[StrCat[DirResValsTurn~{turn_number1}, | ||
| "C_Cross_%g_%g_%g_%g.dat"], winding_number, turn_number1, other_winding_number, turn_number2], LastTimeStepOnly]; | ||
| EndFor | ||
| EndIf | ||
| EndFor | ||
| EndFor | ||
| EndFor | ||
| EndIf | ||
|
|
||
|
|
||
|
|
||
| // Capacitances from QV relation on each turn of the same winding | ||
| If (Flag_voltage) | ||
| // Capacitance Calculation Between Turns for Each Winding (from charges) | ||
| For winding_number In {1:n_windings} | ||
| nbturns~{winding_number} = NbrCond~{winding_number} / SymFactor; | ||
|
|
||
| // Loop through each turn to define its capacitance relative to other turns | ||
| For turn_number1 In {1:nbturns~{winding_number}} | ||
| // Print the self-capacitance value | ||
| Print[Capacitance_Turn_Core~{winding_number}~{turn_number1}, | ||
| OnRegion Turn~{winding_number}~{turn_number1}, | ||
| Format Table, | ||
| File > Sprintf[StrCat[DirResValsCapacitanceFromQV~{winding_number}, "C_%g_%g_Core.dat"], winding_number, turn_number1], | ||
| LastTimeStepOnly]; | ||
| For turn_number2 In {1:nbturns~{winding_number}} | ||
| // Calculate capacitance for every pair of turns, where turn_number1 is the reference voltage turn | ||
| If (turn_number1 == turn_number2) | ||
| // Print the self-capacitance value | ||
| Print[Capacitance_Turn_Self~{winding_number}~{turn_number1}, | ||
| OnRegion Turn~{winding_number}~{turn_number1}, | ||
| Format Table, | ||
| File > Sprintf[StrCat[DirResValsCapacitanceFromQV~{winding_number}, "C_%g_%g_%g.dat"], winding_number, turn_number1, turn_number2], | ||
| LastTimeStepOnly]; | ||
| Else | ||
| // Print the mutual capacitance value | ||
| Print[Capacitance_Turn~{winding_number}~{turn_number1}~{turn_number2}, | ||
| OnRegion Turn~{winding_number}~{turn_number1}, | ||
| Format Table, | ||
| File > Sprintf[StrCat[DirResValsCapacitanceFromQV~{winding_number}, "C_%g_%g_%g.dat"], winding_number, turn_number1, turn_number2], | ||
| LastTimeStepOnly]; | ||
| EndIf | ||
| EndFor | ||
| EndFor | ||
| EndFor | ||
| EndIf | ||
|
|
||
| // Print Capacitance Between Turns of Different Windings | ||
| For winding_number1 In {1:n_windings} | ||
| nbturns1~{winding_number1} = NbrCond~{winding_number1} / SymFactor; | ||
|
|
||
| For winding_number2 In {1:n_windings} | ||
| If (winding_number1 != winding_number2) | ||
| nbturns2~{winding_number2} = NbrCond~{winding_number2} / SymFactor; | ||
|
|
||
| For turn_number1 In {1:nbturns1~{winding_number1}} | ||
| For turn_number2 In {1:nbturns2~{winding_number2}} | ||
| // Print the mutual capacitance value between different windings | ||
| Print[Capacitance_Turn_Windings~{winding_number1}~{turn_number1}~{winding_number2}~{turn_number2}, | ||
| OnRegion Turn~{winding_number1}~{turn_number1}, | ||
| Format Table, | ||
| File > Sprintf[StrCat[DirResValsCapacitanceFromQV~{winding_number1}, | ||
| "C_%g_%g_%g_%g.dat"], winding_number1, turn_number1, winding_number2, turn_number2], | ||
| LastTimeStepOnly]; | ||
| EndFor | ||
| EndFor | ||
| EndIf | ||
| EndFor | ||
| EndFor | ||
|
|
||
|
|
||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| PostOperation Map_local UsingPost EleSta { | ||
|
|
||
| // Potentials for the entire domain | ||
| ExtGmsh = ".pos"; | ||
| Print[ u0, OnElementsOf Region[{Domain}], Name "Potential / V", File StrCat[DirResFields, "Potential", ExtGmsh], LastTimeStepOnly ] ; | ||
| Print[ u0, OnElementsOf Region[{Core}], Name "Average Potential on Core / V", File StrCat[DirResFields, "Voltage_Core_Map", ExtGmsh], LastTimeStepOnly ]; | ||
|
|
||
| // Electric Field vector in the entire domain | ||
| Print[ e, OnElementsOf Region[{Domain}], Name "Electric Field", File StrCat[DirResFields, "Efield", ExtGmsh], LastTimeStepOnly ] ; | ||
| //Print[ Welocal, OnElementsOf Region[{Domain}], Name "Stored Energy", File StrCat[DirResFields, "We", ExtGmsh], LastTimeStepOnly ] ; | ||
| Print[ MagE, OnElementsOf Region[{Domain}], Name "Magnitude Electric Field / V/m", File StrCat[DirResFields, "MagE", ExtGmsh], LastTimeStepOnly ] ; | ||
|
|
||
| // Displacement Field vector in the entire domain | ||
| Print[ d, OnElementsOf Region[{Domain}], Name "Electric Field Density", File StrCat[DirResFields, "Dfield", ExtGmsh], LastTimeStepOnly ] ; | ||
| Print[ MagD, OnElementsOf Region[{Domain}], Name "Magnitude Electric Field Density / C/m^2", File StrCat[DirResFields, "MagD", ExtGmsh], LastTimeStepOnly ] ; | ||
|
|
||
|
|
||
| // Settings for visualization output (optional) | ||
| Echo[ Str["View[PostProcessing.NbViews-1].Light=0; | ||
| View[PostProcessing.NbViews-1].LineWidth = 2; | ||
| View[PostProcessing.NbViews-1].RangeType=3; | ||
| View[PostProcessing.NbViews-1].IntervalsType=1; | ||
| View[PostProcessing.NbViews-1].NbIso = 25;"], | ||
| File OptionPos]; | ||
| } |
|
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. why is there an empty file?
Contributor
Author
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. it is deleted |
Uh oh!
There was an error while loading. Please reload this page.