Open jwreep opened 3 years ago
So I think the best way to proceed here would be to have functions for generating particular loop geometries and then have a single function that calculates field-aligned gravity for any geometry, e.g. https://github.com/wtbarnes/synthesizAR/blob/69256ce3ffe12a6347df102187e49713594eb627/synthesizAR/loop.py#L169-L182
Then, we could just have a function that generates the geometry for an elliptical loop. As an example for what this could look like, here's my code for generating semi-circular loop coordinates: https://github.com/wtbarnes/synthesizAR/blob/69256ce3ffe12a6347df102187e49713594eb627/synthesizAR/models/geometry.py#L13-L69
This all could actually be really useful outside of just the context of HYDRAD too...
Is there already a function for writing out the initial.amr.gravity file?
I don't think we need to write the initial.amr.gravity
file. In pydrad
, the input looks like,
config['general']['poly_fit_gravity'] = {
'order': 6, # order of the fit
'domains': [0, 1], # domain edges
'x': s, # field-aligned coordinate from 0 to L
'y': g, # field-aligned gravity as a function of s
}
specifying this dictionary will write out a file ''poly_fit.gravity'
which HYDRAD will then pick up and use to write the initial.amr.gravity
file. All of this also applies to the magnetic field: just replace "gravity" with "magnetic_field" and 'y'
is B as a function of s.
Another approach would be to use the new piece-wise polynomial fitting class that I wrote a little while back. You can calculate gravity for whatever loop geometry you choose and then do a piece-wise fit, with each set of polynomial coefficients stored in the .gravity file, which HYDRAD then uses. This is the approach that would be used to calculate gravity (and magnetic field strength) for an extrapolated magnetic field, for example.
Cheers,
Steve
From: Will Barnes @.> Sent: Wednesday, June 16, 2021 9:30 AM To: rice-solar-physics/pydrad @.> Cc: Subscribed @.***> Subject: Re: [rice-solar-physics/pydrad] Gravity for elliptical loops (#147)
So I think the best way to proceed here would be to have functions for generating particular loop geometries and then have a single function that calculates field-aligned gravity for any geometry, e.g. https://github.com/wtbarnes/synthesizAR/blob/69256ce3ffe12a6347df102187e49713594eb627/synthesizAR/loop.py#L169-L182
Then, we could just have a function that generates the geometry for an elliptical loop. As an example for what this could look like, here's my code for generating semi-circular loop coordinates: https://github.com/wtbarnes/synthesizAR/blob/69256ce3ffe12a6347df102187e49713594eb627/synthesizAR/models/geometry.py#L13-L69
This all could actually be really useful outside of just the context of HYDRAD too...
Is there already a function for writing out the initial.amr.gravity file?
I don't think we need to write the initial.amr.gravity file. In pydrad, the input looks like,
config['general']['poly_fit_gravity'] = { 'order': 6, # order of the fit 'domains': [0, 1], # domain edges 'x': s, # field-aligned coordinate from 0 to L 'y': g, # field-aligned gravity as a function of s }
specifying this dictionary will write out a file ''poly_fit.gravity' which HYDRAD will then pick up and use to write the initial.amr.gravity file. All of this also applies to the magnetic field: just replace "gravity" with "magnetic_field" and 'y' is B as a function of s.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rice-solar-physics/pydrad/issues/147#issuecomment-862430196 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC6C7UBQHOTORMSRHDZBF3TTCYPPANCNFSM46RONKAA . https://github.com/notifications/beacon/ACC6C7QIZKWAR6AFGC6QZHDTTCYPPA5CNFSM46RONKAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGNT2H5A.gif
Another approach would be to use the new piece-wise polynomial fitting class that I wrote a little while back. You can calculate gravity for whatever loop geometry you choose and then do a piece-wise fit, with each set of polynomial coefficients stored in the .gravity file, which HYDRAD then uses. This is the approach that would be used to calculate gravity (and magnetic field strength) for an extrapolated magnetic field, for example.
I believe this is what pydrad
is already doing. I just simplified the inputs so that a user only has to specify the profiles and doesn't have to worry about doing the polynomial fits "by hand." The coefficients that go into the .gravity
file are calculated here https://github.com/rice-solar-physics/pydrad/blob/4e04e616d8a683e54deeb5d37fde91428e1ad0bb/pydrad/configure/configure.py#L392 and then it lets HYDRAD do the rest.
Seems like that would be the easiest way then; just take advantage of what is already there.
Cheers,
Steve
From: Will Barnes @.> Sent: Wednesday, June 16, 2021 9:46 AM To: rice-solar-physics/pydrad @.> Cc: sjbradshaw @.>; Comment @.> Subject: Re: [rice-solar-physics/pydrad] Gravity for elliptical loops (#147)
Another approach would be to use the new piece-wise polynomial fitting class that I wrote a little while back. You can calculate gravity for whatever loop geometry you choose and then do a piece-wise fit, with each set of polynomial coefficients stored in the .gravity file, which HYDRAD then uses. This is the approach that would be used to calculate gravity (and magnetic field strength) for an extrapolated magnetic field, for example.
I believe this is what pydrad is already doing. I just simplified the inputs so that a user only has to specify the profiles and doesn't have to worry about doing the polynomial fits "by hand." The coefficients are calculate here https://github.com/rice-solar-physics/pydrad/blob/4e04e616d8a683e54deeb5d37fde91428e1ad0bb/pydrad/configure/configure.py#L392 and then it lets HYDRAD do the rest.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rice-solar-physics/pydrad/issues/147#issuecomment-862442649 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC6C7VH6HVVNHIDYHRMNA3TTC2I3ANCNFSM46RONKAA . https://github.com/notifications/beacon/ACC6C7XKUK2BG2ZFRVFSELDTTC2I3A5CNFSM46RONKAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGNT5JGI.gif
I'd like to incorporate a function to create the gravity function for elliptical loops. I've written a function for the current paper to take in loop length, and a relative x and y (semi-major and semi-minor axis):
For example, if the semi-major axis is vertical, with a height twice as large as width,
x=1
, andy=2
.@wtbarnes, what do you think about that format? Is there already a function for writing out the
initial.amr.gravity
file?A more general possibility would be to allow the semi-major axis to be at any angle, rather than just 0 or 90 degrees . . . I'd have to think about how to implement that.