@@ -80,36 +80,34 @@ class PMCBoundary(BoundaryEdge):
80
80
class AbstractABCBoundary (BoundaryEdge , ABC ):
81
81
"""One-way wave equation absorbing boundary conditions abstract base class."""
82
82
83
- small_conductivity_approx : bool = pd .Field (
84
- True ,
85
- title = "Small Conductivity Approximation" ,
86
- description = "If ``False`` then the effective permettivity ``eps`` in the one-wave equation"
87
- " is modified such that the equation exactly satisfy wave propagation at the central "
88
- "frequency." ,
89
- )
90
-
91
83
92
84
class ABCBoundary (AbstractABCBoundary ):
93
- """One-way wave equation absorbing boundary conditions."""
85
+ """One-way wave equation absorbing boundary conditions.
86
+ See, for example, John B. Schneider, Understanding the Finite-Difference Time-Domain Method, Chapter 6.
87
+ """
94
88
95
89
permittivity : Optional [pd .PositiveFloat ] = pd .Field (
96
90
None ,
97
91
title = "Effective Permittivity" ,
98
- description = "Enforced effective permittivity." ,
92
+ description = "Effective permittivity for determining propagation constant. "
93
+ "If ``None``, this value will be automatically inferred from the medium at "
94
+ "the domain boundary and the central frequency of the source." ,
99
95
)
100
96
101
97
conductivity : Optional [pd .NonNegativeFloat ] = pd .Field (
102
98
None ,
103
99
title = "Effective Conductivity" ,
104
- description = "Enforced effective conductivity." ,
100
+ description = "Effective conductivity for determining propagation constant."
101
+ "If ``None``, this value will be automatically inferred from the medium at "
102
+ "the domain boundary and the central frequency of the source." ,
105
103
)
106
104
107
105
@pd .validator ("conductivity" , always = True )
108
106
@skip_if_fields_missing (["permittivity" ])
109
107
def _conductivity_only_with_float_permittivity (cls , val , values ):
110
108
"""Validate that conductivity can be provided only with float permittivity."""
111
109
perm = values ["permittivity" ]
112
- if val is not None and not isinstance ( perm , float ) :
110
+ if val is not None and perm is None :
113
111
raise ValidationError (
114
112
"Field 'conductivity' in 'ABCBoundary' can only be provided "
115
113
"simultaneously with 'permittivity'."
@@ -120,25 +118,17 @@ def _conductivity_only_with_float_permittivity(cls, val, values):
120
118
class ModeABCBoundary (AbstractABCBoundary ):
121
119
"""One-way wave equation absorbing boundary conditions for absorbing a waveguide mode."""
122
120
123
- small_conductivity_approx : bool = pd .Field (
124
- False ,
125
- title = "Small Conductivity Approximation" ,
126
- description = "If ``False`` then the effective permettivity ``eps`` in the one-wave equation"
127
- " is modified such that the equation exactly satisfy wave propagation at the central"
128
- " frequency." ,
129
- )
130
-
131
121
mode_spec : ModeSpec = pd .Field (
132
122
ModeSpec (),
133
123
title = "Mode Specification" ,
134
- description = "Parameters to feed to mode solver which determine modes ." ,
124
+ description = "Parameters that determine the modes computed by the mode solver ." ,
135
125
)
136
126
137
127
mode_index : pd .NonNegativeInt = pd .Field (
138
128
0 ,
139
129
title = "Mode Index" ,
140
130
description = "Index into the collection of modes returned by mode solver. "
141
- " Specifies which mode to absorbed using these boundary conditions . "
131
+ "The absorbing boundary conditions are configured to absorb the specified mode . "
142
132
"If larger than ``mode_spec.num_modes``, "
143
133
"``num_modes`` in the solver will be set to ``mode_index + 1``." ,
144
134
)
@@ -165,19 +155,13 @@ def is_plane(cls, val):
165
155
return val
166
156
167
157
@classmethod
168
- def from_source (
169
- cls , source : ModeSource , small_conductivity_approx : bool = False
170
- ) -> ModeABCBoundary :
158
+ def from_source (cls , source : ModeSource ) -> ModeABCBoundary :
171
159
"""Instantiate from a ``ModeSource``.
172
160
173
161
Parameters
174
162
----------
175
163
source : :class:`ModeSource`
176
164
Mode source.
177
- small_conductivity_approx : bool = False,
178
- If ``False`` then the effective permettivity ``eps`` in the one-wave equation
179
- is modified such that the equation exactly satisfy wave propagation at the central
180
- frequency.
181
165
182
166
Returns
183
167
-------
@@ -197,7 +181,6 @@ def from_source(
197
181
mode_spec = source .mode_spec ,
198
182
mode_index = source .mode_index ,
199
183
frequency = source .source_time .freq0 ,
200
- small_conductivity_approx = small_conductivity_approx ,
201
184
)
202
185
203
186
@classmethod
@@ -206,7 +189,6 @@ def from_monitor(
206
189
monitor : Union [ModeMonitor , ModeSolverMonitor ],
207
190
mode_index : pd .NonNengativeInt = 0 ,
208
191
frequency : Optional [pd .PositiveFloat ] = None ,
209
- small_conductivity_approx : bool = False ,
210
192
) -> ModeABCBoundary :
211
193
"""Instantiate from a ``ModeMonitor`` or ``ModeSolverMonitor``.
212
194
@@ -218,10 +200,6 @@ def from_monitor(
218
200
Mode index.
219
201
frequency : Optional[pd.PositiveFloat] = None
220
202
Frequency for estimating propagation index of absorbed mode.
221
- small_conductivity_approx : bool = False,
222
- If ``False`` then the effective permettivity ``eps`` in the one-wave equation
223
- is modified such that the equation exactly satisfy wave propagation at the central
224
- frequency.
225
203
226
204
Returns
227
205
-------
@@ -240,7 +218,6 @@ def from_monitor(
240
218
mode_spec = monitor .mode_spec ,
241
219
mode_index = mode_index ,
242
220
frequency = frequency ,
243
- small_conductivity_approx = small_conductivity_approx ,
244
221
)
245
222
246
223
@@ -896,7 +873,6 @@ def abc(
896
873
cls ,
897
874
permittivity : Optional [pd .PositiveFloat ] = None ,
898
875
conductivity : Optional [pd .NonNegativeFloat ] = None ,
899
- small_conductivity_approx : bool = True ,
900
876
):
901
877
"""ABC boundary specification on both sides along a dimension.
902
878
@@ -907,12 +883,10 @@ def abc(
907
883
plus = ABCBoundary (
908
884
permittivity = permittivity ,
909
885
conductivity = conductivity ,
910
- small_conductivity_approx = small_conductivity_approx ,
911
886
)
912
887
minus = ABCBoundary (
913
888
permittivity = permittivity ,
914
889
conductivity = conductivity ,
915
- small_conductivity_approx = small_conductivity_approx ,
916
890
)
917
891
return cls (plus = plus , minus = minus )
918
892
@@ -923,7 +897,6 @@ def mode_abc(
923
897
mode_spec : ModeSpec = ModeSpec (),
924
898
mode_index : pd .NonNegativeInt = 0 ,
925
899
frequency : Optional [pd .PositiveFloat ] = None ,
926
- small_conductivity_approx : bool = False ,
927
900
):
928
901
"""One-way wave equation mode ABC boundary specification on both sides along a dimension.
929
902
@@ -932,15 +905,11 @@ def mode_abc(
932
905
plane: Box
933
906
Cross-sectional plane in which the absorbed mode will be computed.
934
907
mode_spec: ModeSpec = ModeSpec()
935
- Parameters to feed to mode solver which determine modes .
908
+ Parameters that determine the modes computed by the mode solver .
936
909
mode_index : pd.NonNengativeInt = 0
937
910
Mode index.
938
911
frequency : Optional[pd.PositiveFloat] = None
939
912
Frequency for estimating propagation index of absorbed mode.
940
- small_conductivity_approx : bool = False,
941
- If ``False`` then the effective permettivity ``eps`` in the one-wave equation
942
- is modified such that the equation exactly satisfy wave propagation at the central
943
- frequency.
944
913
945
914
Example
946
915
-------
@@ -953,30 +922,24 @@ def mode_abc(
953
922
mode_spec = mode_spec ,
954
923
mode_index = mode_index ,
955
924
frequency = frequency ,
956
- small_conductivity_approx = small_conductivity_approx ,
957
925
)
958
926
minus = ModeABCBoundary (
959
927
plane = plane ,
960
928
mode_spec = mode_spec ,
961
929
mode_index = mode_index ,
962
930
frequency = frequency ,
963
- small_conductivity_approx = small_conductivity_approx ,
964
931
)
965
932
966
933
return cls (plus = plus , minus = minus )
967
934
968
935
@classmethod
969
- def mode_abc_from_source (cls , source : ModeSource , small_conductivity_approx : bool = False ):
936
+ def mode_abc_from_source (cls , source : ModeSource ):
970
937
"""One-way wave equation mode ABC boundary specification on both sides along a dimension constructed from a mode source.
971
938
972
939
Parameters
973
940
----------
974
941
source : :class:`ModeSource`
975
942
Mode source.
976
- small_conductivity_approx : bool = False,
977
- If ``False`` then the effective permettivity ``eps`` in the one-wave equation
978
- is modified such that the equation exactly satisfy wave propagation at the central
979
- frequency.
980
943
981
944
Example
982
945
-------
@@ -985,12 +948,8 @@ def mode_abc_from_source(cls, source: ModeSource, small_conductivity_approx: boo
985
948
>>> source = ModeSource(size=(1, 1, 0), source_time=pulse, direction='+')
986
949
>>> abc = Boundary.mode_abc_from_source(source=source)
987
950
"""
988
- plus = ModeABCBoundary .from_source (
989
- source = source , small_conductivity_approx = small_conductivity_approx
990
- )
991
- minus = ModeABCBoundary .from_source (
992
- source = source , small_conductivity_approx = small_conductivity_approx
993
- )
951
+ plus = ModeABCBoundary .from_source (source = source )
952
+ minus = ModeABCBoundary .from_source (source = source )
994
953
return cls (plus = plus , minus = minus )
995
954
996
955
@classmethod
@@ -999,7 +958,6 @@ def mode_abc_from_monitor(
999
958
monitor : Union [ModeMonitor , ModeSolverMonitor ],
1000
959
mode_index : pd .NonNengativeInt = 0 ,
1001
960
frequency : Optional [pd .PositiveFloat ] = None ,
1002
- small_conductivity_approx : bool = False ,
1003
961
):
1004
962
"""One-way wave equation mode ABC boundary specification on both sides along a dimension constructed from a mode monitor.
1005
963
@@ -1013,13 +971,11 @@ def mode_abc_from_monitor(
1013
971
monitor = monitor ,
1014
972
mode_index = mode_index ,
1015
973
frequency = frequency ,
1016
- small_conductivity_approx = small_conductivity_approx ,
1017
974
)
1018
975
minus = ModeABCBoundary .from_monitor (
1019
976
monitor = monitor ,
1020
977
mode_index = mode_index ,
1021
978
frequency = frequency ,
1022
- small_conductivity_approx = small_conductivity_approx ,
1023
979
)
1024
980
return cls (plus = plus , minus = minus )
1025
981
0 commit comments