Skip to content

refactor(vfp1d): add grid#244

Open
jpbrodrick89 wants to merge 6 commits intomainfrom
jpb/vfp1d-grid
Open

refactor(vfp1d): add grid#244
jpbrodrick89 wants to merge 6 commits intomainfrom
jpb/vfp1d-grid

Conversation

@jpbrodrick89
Copy link
Copy Markdown
Contributor

I tried to mirror what you guys were doing in Vlasov1D and move towards dependency inject, just a quick pass to check that its in keeping with where you're going and I'm not doing anything silly, cheers

@jpbrodrick89
Copy link
Copy Markdown
Contributor Author

Ok think this should be ready now, are you ok to give this another pass when next at your desk? @johnbcoughlin 🙏🏻

tau: UREG.Quantity

# Electron density (may differ from normalization density n0)
ne: UREG.Quantity | None = None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This isn't suitable to put on the Normalization object in my opinion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok I tried dependency inject it into initialize distribution function instead. I'm a bit meh about the whole set up here for now, but I think it'll do.


T0 = UREG.Quantity(cfg_units["reference electron temperature"])
ne = UREG.Quantity(cfg_units["reference electron density"]).to("1/cc")
n0 = UREG.Quantity("9.0663e21/cm^3")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't really understand why the normalization object needs to store both ne and n0. It should only need one number density, which is the density in 1/cc that "1" means in a simulation. If the actual ne in simulation is different than that, then that's a property of the simulation / initial condition, not the normalization.

ne: UREG.Quantity | None = None
# Coulomb logarithms
logLambda_ei_val: float | None = None
logLambda_ee_val: float | None = None
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can these be methods like logLambda_ee below, rather than fields?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Its a bit tricky because it depends on Z and ni and they might be spatially dependent, I'm not completely clear about your architectural decision and what the advantages of using a method are, happy for you to explain further.

n0 = u.Quantity("9.0663e21/cm^3")
ion_species = self.cfg["units"]["Ion"]
ne = norm.ne
Te = norm.T0.to("eV")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be more readable to convert to eV and extract the magnitude on the same line, or name this Te_eV.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

renamed Te_eV

vth = norm.v0.to("m/s")
beta = 1.0 / norm.speed_of_light_norm()
# Elementary charge in Gaussian CGS units (Franklin)
e_gauss = UREG.Quantity(4.803204712570263e-10, "Fr")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this isn't necessary, you can just use UREG.e and it will automatically do the conversions for you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This doesn't seem to work as conversion beween gaussian and SI doesn't work with the ureg/jpu's model it seems. I don't want to rewrite the fomrula in SI as more ugly.

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