Skip to content
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

Feature/dielectric refraction #109

Merged

Conversation

adrianarce-elemwave
Copy link

Added case for a plane wave iteration with an isotropic material

Copy link
Contributor

@lmdiazangulo lmdiazangulo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! This was the idea. I have requested some minor changes.

value = probe.df['field'][idx]
return {"time":time, "value": value}

def getRefractedField(probe:Probe) -> Dict:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the EMC&RF sector, we usually prefer to name it as "transmission" rather than "refraction". I guess "refraction" is more typical of the optics domain.

def getRefractedField(probe:Probe) -> Dict:
idx = probe.df['field'].argmin()
time = probe.df['time'][idx]
value = probe.df['field'][idx]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the direct accessor as dict:

    def __getitem__(self, key):
        return self.df[key]

Rather than .df. I should have named df as _df to indicate that is private.


expectedDelayRatio = 1/np.sqrt(_RELATIVE_PERMITTIVITY)

fn = CASES_FOLDER + "dielectric_refraction/dielectricRefraction.fdtd.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest that the folder is named "dielectric" with the idea that it can possibly store more than one case related with dielectrics. "dielectricRefraction.fdtd.json" is ok as it is a good description of the purpose of the test.


"materialAssociations": [
{
"type": "bulk",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type is no longer required within materialAssociations. We realized that it was mostly a source of confusion.


#%%
outside = Probe(solver.getSolvedProbeFilenames("outside")[0])
plt.plot(outside.df['time'], outside.df['field'], label='outside')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case I need to add .to_numpy(), as:
plt.plot(outside.df['time'].to_numpy(), outside.df['field'].to_numpy(), label='outside')

Maybe due to a difference in pandas version

plt.legend()
#%%
inside = Probe(solver.getSolvedProbeFilenames("inside")[0])
plt.plot(inside.df['time'], inside.df['field'], label='inside')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

plt.legend()
#%%
reflected = Probe(solver.getSolvedProbeFilenames("reflected")[0])
plt.plot(reflected.df['time'], reflected.df['field'], label='reflected')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Contributor

@lmdiazangulo lmdiazangulo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost

return {"time":time, "value": value}

def getTransmitedField(probe:Probe) -> Dict:
idx = probe.__getitem__('field').argmin()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better using brackets

@adrianarce-elemwave adrianarce-elemwave force-pushed the feature/dielectricRefraction branch from ea5a871 to d04db03 Compare January 10, 2025 11:27
@lmdiazangulo lmdiazangulo merged commit 4b41864 into OpenSEMBA:dev Jan 10, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants