diff --git a/_unittest/test_03_Materials.py b/_unittest/test_03_Materials.py index 7fc62a651e3..73f141114cf 100644 --- a/_unittest/test_03_Materials.py +++ b/_unittest/test_03_Materials.py @@ -237,3 +237,9 @@ def test_11_material_case(self): assert self.aedtapp.materials["Aluminum"] == self.aedtapp.materials["aluminum"] assert self.aedtapp.materials["Aluminum"].name == "aluminum" assert self.aedtapp.materials.add_material("AluMinum") == self.aedtapp.materials["aluminum"] + + def test_12_material_model(self): + mat = self.aedtapp.materials.add_material("ds_material") + self.aedtapp["$dk"] = 3 + self.aedtapp["$df"] = 0.01 + assert mat.set_djordjevic_sarkar_model(dk="$dk", df="$df") diff --git a/pyaedt/modules/Material.py b/pyaedt/modules/Material.py index 59ae4b45045..b770a0fe7e7 100644 --- a/pyaedt/modules/Material.py +++ b/pyaedt/modules/Material.py @@ -2278,6 +2278,52 @@ def is_dielectric(self, threshold=100000): """ return not self.is_conductor(threshold) + @pyaedt_function_handler + def set_djordjevic_sarkar_model( + self, + dk=4, + df=0.02, + i_freq=1e9, + sigma_dc=1e-12, + freq_hi=159.15494e9, + ): + """Set Djordjevic-Sarkar model. + + Parameters + ---------- + dk : int, float, str, optional + Dielectric constant at input frequency. + df : int, float, str, optional + Loss tangent at input frequency. + i_freq : int, float, optional. + Input frequency in Hz. + sigma_dc : int, float, optional + Conductivity at DC. + freq_hi : int, float, optional + High Frequency corner in Hz. + + Returns + ------- + bool + ``True`` if successful, ``False`` otherwise. + """ + + # K = f"({dk} * {df} - {sigma_dc} / (2 * pi * {i_freq} * e0)) / atan({freq_hi} / {i_freq})" + K = "({} * {} - {} / (2 * pi * {} * e0)) / atan({} / {})".format(dk, df, sigma_dc, i_freq, freq_hi, i_freq) + epsilon_inf = "({} - {} / 2 * ln({}**2 / {}**2 + 1))".format(dk, K, freq_hi, i_freq) + freq_low = "({} / exp(10 * {} * {} / ({})))".format(freq_hi, df, epsilon_inf, K) + + ds_er = "{} + {} / 2 * ln(({}**2 + Freq**2) / ({}**2 + Freq**2))".format(epsilon_inf, K, freq_hi, freq_low) + cond = "{} + 2 * pi * Freq * e0 * ({}) * (atan(Freq / ({})) - atan(Freq / {}))".format( + sigma_dc, K, freq_low, freq_hi + ) + # ds_tande = "{} / (e0 * {} * 2 * pi * Freq)".format(cond, ds_er) + + self.conductivity = cond + self.permittivity = ds_er + + return self.update() + @pyaedt_function_handler() def update(self): """Update the material in AEDT.