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

Support of complex numbers #14

Open
kostyfisik opened this issue Oct 24, 2019 · 6 comments
Open

Support of complex numbers #14

kostyfisik opened this issue Oct 24, 2019 · 6 comments

Comments

@kostyfisik
Copy link
Contributor

In physics for numerical simulations we often use complex valued parameters, e.g. dielectric permittivity, impedance, frequency, etc., so it would be natural to support them. At the moment it can be done via array input, however, it is not very convenient...

@szaghi
Copy link
Owner

szaghi commented Oct 24, 2019

@kostyfisik

Hi, give me more details, how do you like to have formatted the input?

An example is really helpful.

@kostyfisik
Copy link
Contributor Author

E.g. at the moment I use the following config:

[cylinder]
radius = 100.
; material
eps_real = 80.
eps_imag = 0.0001
; aspect ratio sweep settings
rl_min = 0.45
rl_max = 0.75
rl_steps = 15

complex number are nonstandard for INI files, so we can use Fortran standard notation, e.g. it would be nice jus to set it as:

[cylinder]
radius = 100.
; material
epsilon  = (80., 1.0d-4) ; water permittivity
; aspect ratio sweep settings
rl_min = 0.45
rl_max = 0.75
rl_steps = 15

@szaghi
Copy link
Owner

szaghi commented Oct 24, 2019

Currently you can pass the real/imag values as a simple "tuple", e.g.

[cylinder]
radius = 100.
; material
epsilon  = 80. 1.0d-4 

(I do not remember if inline comments are allowed sorry)

Anyhow, if you want to have the notation with ( , ) I can write a dedicated parser for it.

@kostyfisik
Copy link
Contributor Author

It would be great. The final aim is just to

      call fini%get(section_name='cylinder', option_name='epsilon',
     &  val=epsilon, error=error)

to get complex(dp) :: epsilon type of variable.

I would say that

epsilon  = 80. 1.0d-4 

can be a bit cryptic for end users, who are far from programming (but still need to use fortran code to run simulations)

@szaghi
Copy link
Owner

szaghi commented Oct 24, 2019

Ok, let me few time (hours/days), I am working on other libraries, but I am close to update also FiNeR

@kostyfisik
Copy link
Contributor Author

@szaghi Thank you a lot for a really useful project! If you are interested you can check how FiNeR and FLAP are used in the wild https://github.com/wave-scattering/amos-try/blob/master/cylinder2mod/axspartclnew4.f#L1855-L1974

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants