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

User defined Ez chirp in SALAME algorithm #852

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

AlexanderSinn
Copy link
Member

@AlexanderSinn AlexanderSinn commented Jan 16, 2023

Use

hipace.salame_Ez_target(zeta,zeta_initial,Ez_initial) = "Ez_initial"

For a flat Ez field at the SALAME beam (this is the default) or something more custom if needed

hipace.salame_Ez_target(zeta,zeta_initial,Ez_initial) = "
x=(zeta-zeta_initial+0.1)*100;
Ez_initial*(1-0.05*
if(x<-7, 0,
    if(x<-3, 3*sqrt(1-x^2/49),
        if(x<-1, (6*sqrt(10)/7 + (1.5-0.5*abs(x)) - (6*sqrt(10)/14)*sqrt(4-(abs(x)-1)^2) ),
            if(x<-0.75, 9-8*abs(x),
                if(x<-0.5, 3*abs(x)+0.75,
                    if(x<=0.5, 2.25,
                        if(x<=0.75, 3*abs(x)+0.75,
                            if(x<=1, 9-8*abs(x),
                                if(x<=3, (6*sqrt(10)/7 + (1.5-0.5*abs(x)) - (6*sqrt(10)/14)*sqrt(4-(abs(x)-1)^2) ),
                                    if(x<=7, 3*sqrt(1-x^2/49),
                                        0
                                    )
                                )
                            )
                        )
                    )
                )
            )
        )
    )
)/3)"

image

  • Small enough (< few 100s of lines), otherwise it should probably be split into smaller PRs
  • Tested (describe the tests in the PR description)
  • Runs on GPU (basic: the code compiles and run well with the new module)
  • Contains an automated test (checksum and/or comparison with theory)
  • Documented: all elements (classes and their members, functions, namespaces, etc.) are documented
  • Constified (All that can be const is const)
  • Code is clean (no unwanted comments, )
  • Style and code conventions are respected at the bottom of https://github.com/Hi-PACE/hipace
  • Proper label and GitHub project, if applicable

@AlexanderSinn AlexanderSinn added the component: beam About the beam species label Jan 16, 2023
Copy link
Member

@MaxThevenet MaxThevenet left a comment

Choose a reason for hiding this comment

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

Great PR, thanks!

// - 1 because this is for the Ez field of the next slice
const amrex::Real zeta = (islice-1) * hipace->Geom(lev).CellSize(2) +
GetPosOffset(2, hipace->Geom(lev), hipace->Geom(lev).Domain());
// update target with user funciton
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// update target with user funciton
// update target with user function

@MaxThevenet MaxThevenet merged commit 56b24a8 into Hi-PACE:development Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: beam About the beam species
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants