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

Bessel beams #304

Merged
merged 52 commits into from
Dec 19, 2021
Merged

Bessel beams #304

merged 52 commits into from
Dec 19, 2021

Conversation

stefaniagl
Copy link
Contributor

Description

Added new incident beams - high order vector Bessel beams of LE, LM, CS, CS', TEM, TEL, and generalized types.

Related issues

Fixes #209, including #285.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the contributing guidelines
  • Code compiles correctly
  • Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works. And these tests pass
  • I have added/extended necessary documentation (if appropriate)

Further comments

@stefaniagl stefaniagl marked this pull request as ready for review November 13, 2021 06:32
Copy link
Member

@myurkin myurkin left a comment

Choose a reason for hiding this comment

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

This is a first quick review to fix some unexpected changes relative to the current master.

.gitignore Show resolved Hide resolved
src/.gitignore Outdated Show resolved Hide resolved
src/GenerateB.c Outdated
@@ -31,7 +31,6 @@
#include "interaction.h"
#include "param.h"
#include "vars.h"
// system headers
Copy link
Member

Choose a reason for hiding this comment

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

this deletion should probably be reverted

src/GenerateB.c Show resolved Hide resolved
src/GenerateB.c Outdated
@@ -222,20 +320,23 @@ void InitBeam(void)
}

//======================================================================================================================

Copy link
Member

Choose a reason for hiding this comment

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

this deletion should probably be reverted

src/Makefile Outdated Show resolved Hide resolved
src/githash.h Outdated
@@ -0,0 +1 @@
#define GITHASH "bc2963d"
Copy link
Member

Choose a reason for hiding this comment

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

This file should be removed

src/ocl/Makefile Outdated
@@ -21,9 +21,9 @@
# Depending on a particular OpenCL installation one may need to manually specify paths to corresponding headers and
Copy link
Member

Choose a reason for hiding this comment

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

No changes are expected in this file (with respect to the current master)

src/const.h Outdated
#define MAX_N_BEAM_PARMS 10 // maximum number of beam parameters
#define MAX_N_BEAM_PARMS 13 // maximum number of beam parameters
Copy link
Member

Choose a reason for hiding this comment

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

This change should probably be reverted (due to usage of -beam_center)

src/parbas.h Outdated
@@ -25,7 +25,7 @@
* removed, then even MPI 2.0 will do.
*/
#define MPI_VER_REQ 2
#define MPI_SUBVER_REQ 1
#define MPI_SUBVER_REQ 0
Copy link
Member

Choose a reason for hiding this comment

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

This change should probably be reverted.

@myurkin myurkin self-assigned this Dec 5, 2021
- disables all code related to Bessel beams when NO_FORTRAN is used
- edits a lot of help and information messages, including names of some Bessel beams types
- beam center in laboratory reference frame is now specified always (even when at origin)
- calculation of Cext through F(0) is now used only for default position of the plane wave
- fixes processing of imaginary part of matrix M (for Bessel beams), by changing the type to doublecomplex
- removes beam-center position in descriptive strings for beams (since it is printed separately in param.c)
- plane wave in surface mode now works fine with -beam_center. Removes a lot of redundant code there (probably was used long ago for alternative calculation of Cext)

minor/stylistic changes:
- shortens define handles for Bessel beams
- changes required number of subarguments for '-beam dipole' to UNDEF
- moves beam_center below beam in lists of command line options (to be in alphabetical order)
- renames use_beam_center and use_beam_subopt into beam_center_used and deprecated_bc_used, respectively
- adds auxiliary function ScanDouble3Error() in param.c
- removes redundant checks for number of arguments for most Bessel beam types
- processing of deprecated specification of beam center as an argument to '-beam' is now in param.c
- updates instructions for adding new beams
- updates .gitignore
- removes mentioning of eIncRefl[3],eIncTran[3] from crosssec.c
- beam_center_0 is now defined in vars.c/h
Copy link
Member

@myurkin myurkin left a comment

Choose a reason for hiding this comment

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

  1. Please first carefully review and test the changes to the code, that I recently pushed.
  2. Then, take care of the comments here.
  3. We need to discuss the phase of the amplitude matrix (e.g. when -scat_grid is used)

src/GenerateB.c Outdated Show resolved Hide resolved
src/GenerateB.c Outdated
case B_BES_TML:
if (surface) PrintError("Currently, Bessel incident beam is not supported for '-surf'");
// initialize parameters
n0=round(beam_pars[0]);
Copy link
Member

Choose a reason for hiding this comment

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

Test the input order to be integer. See the function ConvertToInteger

src/GenerateB.c Outdated
if (surface) PrintError("Currently, Bessel incident beam is not supported for '-surf'");
// initialize parameters
n0=round(beam_pars[0]);
alpha0=beam_pars[1];
Copy link
Member

Choose a reason for hiding this comment

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

The input angle should be in degrees (as other input angles in ADDA - this already described as such in help strings). See function Rad2Deg.
Moreover, we should probably check it to be between 0 and 90 degrees. Angle 0 should not be allowed unless the order is 0 (or some specific matrix M for orders +-1 or +-2 - I am not sure, please look carefully at the formulae). Similar issue is for angle 90.

src/GenerateB.c Outdated
Comment on lines 208 to 211
M[0]=beam_pars[2]+I*beam_pars[6];
M[1]=beam_pars[3]+I*beam_pars[7];
M[2]=beam_pars[4]+I*beam_pars[8];
M[3]=beam_pars[5]+I*beam_pars[9];
Copy link
Member

Choose a reason for hiding this comment

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

Imaginary parts are not necessarily defined in the command line. The number of beam parameters should be checked before this code to avoid undefined behavior (they are not necessarily zero).

src/GenerateB.c Show resolved Hide resolved
src/GenerateB.c Outdated Show resolved Hide resolved
stefaniagl and others added 7 commits December 11, 2021 15:54
…sel beams

- corrects accounting for beam vorticity, when computing amplitude matrix (for scat_plane and scat_grid)
- renames variables for Bessel beams to avoid confusion
- slightly changes alignment in the code and descriptive string for Bessel beams
- merges two cases for Bessel beams in InitBeam() into one
- replaces several cexp(I*...) by imExp(...)
- adds several TODO comments for further improvement
- quick tests show that amplitude matrix remains invariant under 90-degree rotation for symmetric shapes (comparing
@myurkin myurkin merged commit 7ef46af into adda-team:master Dec 19, 2021
myurkin added a commit that referenced this pull request Jan 7, 2022
- updates ignores in `comp2exec` so that all tests pass (after recent #304)
- adds -beam_center to various lines in test suites

* Corrections in `GenerateB.c`:
- removes redundant EOL in multi-line beam descriptions
- fixes incorrect calculation of incident plane wave for grazing incidence in surface mode (when prop_z is on the order of 1e-16). For that the code was completely rewritten to specifically calculate potentially small quantities (e.g., expm1 instead of exp and rcp1=rc+1 instead of rc).
- removes duplicate initialization of `prIncRefl`
- mentions `vorticity` in instructions for adding new beam
- in several places (when accounting for `beam_center`) `LinComb()` was replaced by `vSubtr()`.

* Other changes:
- adds functions `imExpM1()` and `cExpM1()` to `cmplx.h`
- definitions of `prIncRelf` and `prIncTran` are now semi-global (only in `GenerateB.c` and `param.c`)
- updates copyright year in `param.c`

Co-authored-by: Maxim Yurkin <[email protected]>
stefaniagl added a commit to stefaniagl/adda that referenced this pull request Mar 29, 2022
commit 443f00a
Author: Maxim Yurkin <[email protected]>
Date:   Tue Mar 29 13:34:30 2022 +0700

    Minor changes in figure spacing

commit 581bec6
Author: stefaniagl <[email protected]>
Date:   Tue Mar 29 00:03:24 2022 +0700

    Bessel 0 (adda-team#315)

    Tests and examples for Bessel beams:
    - test using equivalent command line strings `tests/equiv/bb_equiv.py`
    - simple examples `examples/bessel`
    - scripts to reproduce 4 figures in a recent paper (submitted)

    Fixes a bug in TML type of Bessel beams.

commit d7e6169
Author: Maxim Yurkin <[email protected]>
Date:   Mon Feb 21 23:35:49 2022 +0700

    Makes the test for inconsistencies in the input shape format more sensitive. Detects extra number present in a line for ADDA formats (both single- and multi-domain). The formats themselves are now defines instead of static strings.

commit 887a63c
Author: Maxim Yurkin <[email protected]>
Date:   Mon Feb 21 14:48:46 2022 +0700

    - All math constants are now given to 35 significant digits (was 32 in most places)
    - This includes the LDR constants (for which a separate calculation procedure was performed)
    - Improves a few related comments

commit a993a91
Author: Maxim Yurkin <[email protected]>
Date:   Tue Feb 15 10:21:53 2022 +0700

    - renames find_adda.sh into find_adda (and sets executable flag)
    - this script now returns ADDA path to stdout, hence does not need to be sourced (was a bad idea due to potential variables collision)
    - updates all calling scripts

commit c8ea4ed
Author: Maxim Yurkin <[email protected]>
Date:   Mon Jan 31 14:52:02 2022 +0700

    minor formatting changes

commit a6be5f4
Author: Maxim Yurkin <[email protected]>
Date:   Mon Jan 31 14:31:10 2022 +0700

    - adds a special script to locate ADDA binaries (to be used by various examples).
    - updates existing examples in `examples/papers/2021_WKBr/` and `misc/near_field/` accordingly
    - other minor changes to `examples/papers/2021_WKBr/calc.sh`

commit 2896575
Author: inzhevatkin <[email protected]>
Date:   Sun Jan 30 11:40:56 2022 +0700

    WKBr scripts (adda-team#311)

    * Adds scripts to reproduce Figs.15 and 16 from paper (Inzhevatkin & Yurkin, 2022)
    * Includes general-purpose scripts to generate internal field in a sphere in the framework of the WKBr approximation (two modifications).
    * Also includes interface with Mie-theory calculations.

    Co-authored-by: Maxim Yurkin <[email protected]>

commit 6c0b401
Merge: 49e6c23 deebdbf
Author: Maxim Yurkin <[email protected]>
Date:   Tue Jan 11 19:11:38 2022 +0700

    Merge branch 'master' of github.com:adda-team/adda

commit 49e6c23
Author: Maxim Yurkin <[email protected]>
Date:   Tue Jan 11 19:09:51 2022 +0700

    Updates extracting of gcc version in Makefile to be compatible with all possible configurations of gcc.

commit deebdbf
Author: stefaniagl <[email protected]>
Date:   Fri Jan 7 17:44:39 2022 +0700

    Changes in tests (adda-team#310)

    - updates ignores in `comp2exec` so that all tests pass (after recent adda-team#304)
    - adds -beam_center to various lines in test suites

    * Corrections in `GenerateB.c`:
    - removes redundant EOL in multi-line beam descriptions
    - fixes incorrect calculation of incident plane wave for grazing incidence in surface mode (when prop_z is on the order of 1e-16). For that the code was completely rewritten to specifically calculate potentially small quantities (e.g., expm1 instead of exp and rcp1=rc+1 instead of rc).
    - removes duplicate initialization of `prIncRefl`
    - mentions `vorticity` in instructions for adding new beam
    - in several places (when accounting for `beam_center`) `LinComb()` was replaced by `vSubtr()`.

    * Other changes:
    - adds functions `imExpM1()` and `cExpM1()` to `cmplx.h`
    - definitions of `prIncRelf` and `prIncTran` are now semi-global (only in `GenerateB.c` and `param.c`)
    - updates copyright year in `param.c`

    Co-authored-by: Maxim Yurkin <[email protected]>

commit 6a9ec2e
Author: Maxim Yurkin <[email protected]>
Date:   Mon Jan 3 00:02:33 2022 +0700

    adds ignoring of errors when getting commit hash (i.e. when compiling from downloaded source code, not from git repository)
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