├── utilities ├── matlab │ └── hdf5 │ │ ├── plotEn.m │ │ ├── OAM_MOV.m │ │ ├── makMov2.m │ │ ├── ploth5En.m │ │ ├── FilterField.m │ │ ├── plotElPhase.m │ │ ├── showTrPhFULL.m │ │ ├── diffr.m │ │ └── ploth5SurfPow.m ├── setup │ └── genInputs │ │ ├── fBoolean.py │ │ ├── SUF.py │ │ ├── testMTDrive.py │ │ └── matchTwiss.py ├── pyPlotting │ ├── puffdata │ │ └── __init__.py │ ├── retrieve │ │ ├── process │ │ │ └── __init__.py │ │ ├── rawpuffin │ │ │ ├── __init__.py │ │ │ ├── readField.py │ │ │ ├── pfilelists.py │ │ │ └── getIntData.py │ │ ├── __init__.py │ │ ├── getPowFromInt.py │ │ └── getEnFromInt.py │ ├── __init__.py │ └── plotEn_fromInt.py └── visit-scripts │ ├── visitLoc.py │ └── getDBNames.py ├── doc ├── manual.pdf ├── bx-field.png ├── by-field.png ├── long_draw.odg ├── long_mesh.png ├── visit0032.png ├── visit0033.png ├── visit0035.png ├── visit0036.png ├── visit0037.png ├── InputFiles.png ├── InputFiles.pptx ├── subroutines.ods ├── trans_mesh2.png ├── bfields │ ├── b-fields.png │ ├── bx-field.png │ └── by-field.png ├── PuffinMemManagement.odp ├── trans_draw_progress.odg ├── PuffinVisualisationWorkflow.pdf └── DesignOfTwissParameterStorageInPuffin.odp ├── test ├── testSuites.inc ├── testTests.pf └── testHdf5Puff.pf ├── scripts ├── README.md └── hartree │ ├── puffin.bluewonderphase1.gnu.lsf │ ├── puffin.bluewonderphase2.intel2015.lsf │ ├── puffin.bluewonderphase2.intel-impi.lsf │ └── puffin.napier.gcc491.lsf ├── .travis.yml ├── config-cmake.h.in ├── inputs ├── dist │ ├── dist_files.in │ └── seed_file.in ├── README.md └── simple │ ├── 3D │ ├── PhyOfPlasmasV19pp093119 │ │ ├── fig7a │ │ │ ├── README.txt │ │ │ └── seed_file.in │ │ └── fig7 │ │ │ └── seed_file.in │ ├── CLARA │ │ ├── seed_file.in │ │ └── single-slice │ │ │ └── seed_file.in │ ├── DXFEL │ │ └── seed_file.in │ ├── test1 │ │ └── seed_file.in │ ├── shortCSE │ │ ├── seed_file.in │ │ └── beam_file.in │ ├── single_spike_SASE │ │ └── seed_file.in │ ├── diffraction │ │ ├── seed_file.in │ │ └── beam_file.in │ └── LCLS │ │ └── lcls.beam │ └── 1D │ ├── multi-beam │ └── seed_file.in │ ├── OptCommV165pp65-70 │ ├── fig2 │ │ └── seed_file.in │ └── fig1 │ │ ├── seed_file.in │ │ └── unscaled │ │ └── seed_file.in │ ├── PREv64pp046503 │ ├── fig4 │ │ ├── seed_file.in │ │ └── beam_file.in │ ├── fig4ROUNDH │ │ ├── seed_file.in │ │ └── beam_file.in │ └── fig4ROUNDP │ │ ├── seed_file.in │ │ └── beam_file.in │ ├── PRSTABVv6pp070701 │ └── fig4 │ │ ├── seed_file.in │ │ └── beam_file.in │ ├── 2colour │ ├── seed_file.in │ ├── wdrifts │ │ ├── seed_file.in │ │ └── beam_file.in │ ├── wchicanes │ │ ├── seed_file.in │ │ └── beam_file.in │ └── beam_file.in │ └── CLARA │ └── beam_file.in ├── scimake ├── trycompile │ ├── mpi_h.cxx │ ├── mpi_mod.f90 │ ├── modulesrcfile.f90 │ ├── shared_ptr.cxx │ ├── stdabsdbl.cxx │ ├── gendeclstatics.cxx │ ├── pragma_omp_simd.cxx │ └── Makefile.am ├── CMakeLists.txt ├── Makefile.show ├── SciFortranDouble.cmake ├── Modules │ ├── FindSciDocutils.cmake │ ├── FindSciNsis.cmake │ ├── FindSciMex.cmake │ ├── FindSciCppCheck.cmake │ ├── FindSciGraphviz.cmake │ ├── FindSciChecker.cmake │ ├── FindSciPatchelf.cmake │ ├── FindSciG4userdocs.cmake │ ├── FindSciFluxgrid.cmake │ ├── FindSciNetlibLite.cmake │ ├── FindSciPng.cmake │ ├── FindSciFacetsIfc.cmake │ ├── FindSciSz.cmake │ ├── FindSciZ.cmake │ ├── FindSciFreeType.cmake │ ├── FindSciG4examples.cmake │ ├── FindSciMxml.cmake │ ├── FindSciPcre.cmake │ ├── FindSciGsl.cmake │ ├── FindSciMoab.cmake │ ├── FindSciPatoh.cmake │ ├── FindSciCuda.cmake │ ├── FindSciMagma.cmake │ ├── FindSciGtest.cmake │ ├── FindSciCusp.cmake │ ├── FindSciAdios.cmake │ ├── FindSciSquish.cmake │ ├── FindSciMdsplus.cmake │ ├── FindSciSphinx.cmake │ ├── FindSciSimD.cmake │ ├── FindSciXercesc.cmake │ ├── FindSciNtccTransport.cmake │ ├── FindSciTranspbase.cmake │ ├── FindSciMetis.cmake │ ├── FindSciThrust.cmake │ ├── FindSciNemesis.cmake │ ├── FindSciCarve.cmake │ ├── FindSciNubeam.cmake │ ├── FindSciCfitsio.cmake │ ├── FindSciLibXml2.cmake │ ├── FindSciTxPLAPACK.cmake │ ├── FindSciExodusii.cmake │ ├── FindSciFmcfm.cmake │ ├── FindSciMesa.cmake │ ├── FindSciNetcdf_cmake.cmake │ ├── FindSciDoxygen.cmake │ ├── FindSciOpenCL.cmake │ ├── FindSciMuparser.cmake │ ├── FindSciFftw.cmake │ ├── FindSciCLapackCMake.cmake │ ├── FindEpicsExtensions.cmake │ ├── FindSciEigen3.cmake │ ├── FindSciNetcdf.cmake │ ├── FindSciCubit.cmake │ ├── FindSciNetcdff.cmake │ ├── FindSciPspline.cmake │ ├── FindSciTxPhysics.cmake │ ├── FindSciGeant4.cmake │ ├── FindSciTxBase.cmake │ └── FindSciPlasmaState.cmake ├── rmcomms.sed ├── SciMpiLauncher.cmake ├── mklinks.sh └── SciStart.ctest ├── .gitattributes ├── source ├── InitDataType.f90 ├── BParallelInfoType.f90 ├── puffProvenance.f90.in ├── Aparatype.f90 ├── beamPrep.f90 ├── BFileType.f90 ├── Hrhs_vars.f90 ├── HwigglerVar.f90 └── noise.f90 └── LICENSE.txt /utilities/matlab/hdf5/plotEn.m: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/manual.pdf -------------------------------------------------------------------------------- /doc/bx-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/bx-field.png -------------------------------------------------------------------------------- /doc/by-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/by-field.png -------------------------------------------------------------------------------- /doc/long_draw.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/long_draw.odg -------------------------------------------------------------------------------- /doc/long_mesh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/long_mesh.png -------------------------------------------------------------------------------- /doc/visit0032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/visit0032.png -------------------------------------------------------------------------------- /doc/visit0033.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/visit0033.png -------------------------------------------------------------------------------- /doc/visit0035.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/visit0035.png -------------------------------------------------------------------------------- /doc/visit0036.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/visit0036.png -------------------------------------------------------------------------------- /doc/visit0037.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/visit0037.png -------------------------------------------------------------------------------- /doc/InputFiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/InputFiles.png -------------------------------------------------------------------------------- /doc/InputFiles.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/InputFiles.pptx -------------------------------------------------------------------------------- /doc/subroutines.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/subroutines.ods -------------------------------------------------------------------------------- /doc/trans_mesh2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/trans_mesh2.png -------------------------------------------------------------------------------- /doc/bfields/b-fields.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/bfields/b-fields.png -------------------------------------------------------------------------------- /doc/bfields/bx-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/bfields/bx-field.png -------------------------------------------------------------------------------- /doc/bfields/by-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/bfields/by-field.png -------------------------------------------------------------------------------- /doc/PuffinMemManagement.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/PuffinMemManagement.odp -------------------------------------------------------------------------------- /doc/trans_draw_progress.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/trans_draw_progress.odg -------------------------------------------------------------------------------- /test/testSuites.inc: -------------------------------------------------------------------------------- 1 | ADD_TEST_SUITE(testTests_suite) 2 | ADD_TEST_SUITE(testFFunctions_suite) 3 | 4 | -------------------------------------------------------------------------------- /doc/PuffinVisualisationWorkflow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/PuffinVisualisationWorkflow.pdf -------------------------------------------------------------------------------- /doc/DesignOfTwissParameterStorageInPuffin.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UKFELs/Puffin/HEAD/doc/DesignOfTwissParameterStorageInPuffin.odp -------------------------------------------------------------------------------- /test/testTests.pf: -------------------------------------------------------------------------------- 1 | @test 2 | subroutine testTests() 3 | use pfunit_mod 4 | implicit none 5 | @assertEqual("Hello World!","Hello World!") 6 | end subroutine testTests 7 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | ## Example Job Submission Scripts 2 | 3 | This directory contains some simple example job submission scripts for 4 | submitting Puffin to the job queue at different machines at Hartree. 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: sh 2 | 3 | services: 4 | - docker 5 | 6 | before_install: 7 | - export DOCKER_PUFFIN_IMAGE=ukfels/puffin-test 8 | 9 | script: 10 | - docker build -t $DOCKER_PUFFIN_IMAGE . 11 | -------------------------------------------------------------------------------- /config-cmake.h.in: -------------------------------------------------------------------------------- 1 | // the configured options and settings 2 | #define Puffin_VERSION_MAJOR @Puffin_VERSION_MAJOR@ 3 | #define Puffin_VERSION_MINOR @Puffin_VERSION_MINOR@ 4 | #define Puffin_VERSION_PATCH @Puffin_VERSION_PATCH@ 5 | -------------------------------------------------------------------------------- /inputs/dist/dist_files.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | &NBLIST 4 | nbeams = 3 5 | dtype = 'dist' 6 | / 7 | 8 | &BDLIST 9 | dist_f(1) = 'troLi16_LiPlusElec_47_1.pufin' 10 | dist_f(2) = 'troLi16_LiPlusElec_47_2.pufin' 11 | dist_f(3) = 'troLi16_LiPlusElec_47_3.pufin' 12 | / 13 | -------------------------------------------------------------------------------- /inputs/README.md: -------------------------------------------------------------------------------- 1 | ## Input Files 2 | 3 | Please see the user manual (in $PUFFIN/doc/) for an explanation of the input 4 | file decks. 5 | 6 | These subdirectories contain example input decks in the simple format (in subdirectory simple/) and using the dist input (in dist/). 7 | -------------------------------------------------------------------------------- /scimake/trycompile/mpi_h.cxx: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: mpi_h.cxx 792 2015-04-17 14:07:44Z jrobcary $ 3 | * 4 | * Copyright © 2012-2015, Tech-X Corporation, Boulder, CO. 5 | * See LICENSE file (EclipseLicense.txt) for conditions of use. 6 | */ 7 | 8 | #include 9 | 10 | int main(int argc, char** argv) { 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /utilities/setup/genInputs/fBoolean.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | def torf(bo): 6 | if (bo): 7 | res = '.TRUE. ' 8 | else: 9 | res = '.FALSE.' 10 | 11 | return res 12 | 13 | if __name__ == "__main__": 14 | import sys 15 | torf(sys.argv[1]) 16 | -------------------------------------------------------------------------------- /scimake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # CMakeLists.txt for scimake 4 | # 5 | # $Id: CMakeLists.txt 792 2015-04-17 14:07:44Z jrobcary $ 6 | # 7 | # Copyright © 2005-2015, Tech-X Corporation, Boulder, CO. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | ###################################################################### 11 | 12 | -------------------------------------------------------------------------------- /scimake/trycompile/mpi_mod.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! @file mpi_mod.f90 3 | ! 4 | ! @brief Source code for detecting module file name 5 | ! 6 | ! @version $Id: mpi_mod.f90 792 2015-04-17 14:07:44Z jrobcary $ 7 | ! 8 | ! Copyright © 2012-2015, Tech-X Corporation, Boulder, CO. 9 | ! See LICENSE file (EclipseLicense.txt) for conditions of use. 10 | ! 11 | 12 | program mpi_mod 13 | use mpi 14 | end program mpi_mod 15 | -------------------------------------------------------------------------------- /scimake/trycompile/modulesrcfile.f90: -------------------------------------------------------------------------------- 1 | ! 2 | ! @file modulesrcfile.f90 3 | ! 4 | ! @brief Source code for detecting module file name 5 | ! 6 | ! @version $Id: modulesrcfile.f90 792 2015-04-17 14:07:44Z jrobcary $ 7 | ! 8 | ! Copyright © 2012-2015, Tech-X Corporation, Boulder, CO. 9 | ! See LICENSE file (EclipseLicense.txt) for conditions of use. 10 | ! 11 | 12 | module moduleNAME 13 | integer :: j 14 | end module moduleNAME 15 | -------------------------------------------------------------------------------- /scimake/trycompile/shared_ptr.cxx: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: shared_ptr.cxx 792 2015-04-17 14:07:44Z jrobcary $ 3 | * 4 | * Copyright © 2013-2015, Tech-X Corporation, Boulder, CO. 5 | * See LICENSE file (EclipseLicense.txt) for conditions of use. 6 | */ 7 | 8 | #include 9 | 10 | struct S { 11 | int i; 12 | }; 13 | 14 | int main(int argc, char** argv) { 15 | sci_shared_ptr sptr; 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /scimake/trycompile/stdabsdbl.cxx: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: stdabsdbl.cxx 792 2015-04-17 14:07:44Z jrobcary $ 3 | * 4 | * Copyright © 2012-2015, Tech-X Corporation, Boulder, CO. 5 | * See LICENSE file (EclipseLicense.txt) for conditions of use. 6 | * 7 | * Determine whether the compiler knows std::abs. 8 | */ 9 | 10 | #include 11 | 12 | int main(int argc, char** argv) { 13 | double a = 0; 14 | double b = std::abs(a); 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /scimake/trycompile/gendeclstatics.cxx: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: gendeclstatics.cxx 792 2015-04-17 14:07:44Z jrobcary $ 3 | * 4 | * Copyright © 2012-2015, Tech-X Corporation, Boulder, CO. 5 | * See LICENSE file (EclipseLicense.txt) for conditions of use. 6 | */ 7 | 8 | template 9 | class X { 10 | public: 11 | 12 | static int r; 13 | }; 14 | 15 | template 16 | int X::r = 0; 17 | 18 | int main (int argc, char* argv[]) { 19 | X x; 20 | int rr = x.r + X::r; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /utilities/pyPlotting/puffdata/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This file is part of Puffin, a multi-frequency FEL code absent of the 7 | averaging / SVEA approximations. This file allows the Puffin data and data 8 | file classes to be used as a package. 9 | """ 10 | 11 | from .puffDataClass import puffData 12 | from .fdataClass import fdata 13 | #import readField 14 | #import filterField 15 | #import getMagPhase 16 | 17 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/process/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This file is part of Puffin, a multi-frequency FEL code absent of the 7 | averaging / SVEA approximations. This file allows for the manipulation and 8 | processing of data retirved from the Puffin output data files. 9 | """ 10 | 11 | from .filterField import filterField 12 | 13 | #import readField 14 | #import filterField 15 | #import getMagPhase 16 | 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /scimake/trycompile/pragma_omp_simd.cxx: -------------------------------------------------------------------------------- 1 | /** 2 | * $Id: pragma_omp_simd.cxx 792 2015-04-17 14:07:44Z jrobcary $ 3 | * 4 | * Code stub for determining whether the compiler supports simd pragmas 5 | * from OpenMP 4. 6 | * 7 | * Copyright © 2013-2015, Tech-X Corporation, Boulder, CO. 8 | * See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | */ 10 | #include 11 | 12 | int main(int argc, char** argv) { 13 | float a[8] = { 14 | 0.0 15 | }, b[8] = { 16 | 0.0 17 | }; 18 | #pragma omp for simd 19 | for (int i = 0; i < 8; ++i) { 20 | a[i] += b[i]; 21 | } 22 | return 0; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /scimake/Makefile.show: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # Makefile.show: A PETSc Makefile to get PETSc variables 4 | # 5 | # $Id: Makefile.show 793 2015-04-18 14:40:19Z jrobcary $ 6 | # 7 | # Copyright 2010-2013 Tech-X Corporation. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | ###################################################################### 11 | # Makefile to grab PETSc make variables 12 | # PETSC_DIR is passed though CMake 13 | include ${PETSC_DIR}/conf/rules 14 | include ${PETSC_DIR}/conf/variables 15 | showvar: 16 | -@echo -n ${${PKG_VARIABLE}} 17 | -------------------------------------------------------------------------------- /scimake/trycompile/Makefile.am: -------------------------------------------------------------------------------- 1 | ## ############################################################ 2 | ## 3 | ## File: Makefile.am 4 | ## 5 | ## Purpose: Purpose: Needed for cmake in an autotools project 6 | ## 7 | ## $Id: Makefile.am 792 2015-04-17 14:07:44Z jrobcary $ 8 | ## 9 | ## Copyright © 2012-2015, Tech-X Corporation, Boulder, CO. 10 | ## See LICENSE file (EclipseLicense.txt) for conditions of use. 11 | ## 12 | ## ############################################################ 13 | 14 | SUBDIRS = 15 | 16 | EXTRA_DIST = \ 17 | checkCompilerRTTI.cxx gendeclstatics.cxx modulesrcfile.f90 \ 18 | mpi_mod.f90 mpi_h.cxx stdabsdbl.cxx 19 | 20 | -------------------------------------------------------------------------------- /test/testHdf5Puff.pf: -------------------------------------------------------------------------------- 1 | @test 2 | subroutine testCreateIntegrated1DFloat() 3 | 4 | use pFUnit_mod 5 | use hdf5_puff 6 | 7 | implicit none 8 | 9 | real(KIND=WP) :: simtime 10 | integer(KIND=IP) :: error,nslices,tol 11 | 12 | simtime = 0.0_WP 13 | error = 0_IP 14 | nslices = 10_IP 15 | tol = 1_IP 16 | 17 | call CreateIntegrated1DFloat(simtime,error,nslices) 18 | 19 | @AssertEqualUserDefined(error,0_IP,message='Should return 0 error status') 20 | ! & 21 | ! // 'Integrated1DFloat should return with 0 error' & 22 | ! // 'status. Results checked outside pFUnit.') 23 | 24 | end subroutine testCreateIntegrated1DFloat 25 | 26 | -------------------------------------------------------------------------------- /scimake/SciFortranDouble.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # : Compute ntcc specific options 4 | # 5 | # $Id: SciFortranDouble.cmake 792 2015-04-17 14:07:44Z jrobcary $ 6 | # 7 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | # 11 | ###################################################################### 12 | 13 | set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${FC_DOUBLE_FLAGS}") 14 | # message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") 15 | message(STATUS "CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}") 16 | 17 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/rawpuffin/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This file is part of Puffin, a multi-frequency FEL code absent of the 7 | averaging / SVEA approximations. This file allows the base reading of data 8 | from the Puffin input files to be used as a single package. 9 | """ 10 | 11 | from .readField import readField 12 | from .getIntData import getIntData 13 | from .pfilelists import getFileSlices 14 | from .pfilelists import getIntFileSlices 15 | from .pfilelists import getZData 16 | 17 | #import readField 18 | #import filterField 19 | #import getMagPhase 20 | 21 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/OAM_MOV.m: -------------------------------------------------------------------------------- 1 | 2 | % Create video of synchro-squeezed wavelet analysis at steps specified by 3 | % inputs. 4 | 5 | 6 | %vid = VideoWriter('peaks.mp4','MPEG-4'); 7 | vid = VideoWriter('fig3-mov.avi'); 8 | vid.FrameRate = 4; 9 | open(vid); 10 | 11 | hf = figure; 12 | figp = get(hf,'OuterPosition'); 13 | %figp(3:4) = figp(3:4) * 1.2; 14 | set(hf,'OuterPosition',figp); 15 | 16 | 17 | for ij = 3000:3050 18 | 19 | hf = quiver(ax2(:,:,ij), ay2(:,:,ij)); 20 | xlim([34 54]); 21 | ylim([34 54]); 22 | 23 | hf = get(hf,'parent'); 24 | frame = getframe(hf); 25 | 26 | writeVideo(vid,frame); 27 | clf; 28 | 29 | end 30 | 31 | 32 | close(vid); 33 | 34 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/makMov2.m: -------------------------------------------------------------------------------- 1 | function hf = makMov2(nsteps, dstep) 2 | 3 | % Create video of synchro-squeezed wavelet analysis at steps specified by 4 | % inputs. 5 | 6 | 7 | %vid = VideoWriter('peaks.mp4','MPEG-4'); 8 | vid = VideoWriter('fig4-mov2.avi'); 9 | vid.FrameRate = 4; 10 | open(vid); 11 | 12 | steps = 0:dstep:nsteps; 13 | %steps(1) = 0; 14 | 15 | hf = figure; 16 | figp = get(hf,'OuterPosition'); 17 | %figp(3:4) = figp(3:4) * 1.2; 18 | set(hf,'OuterPosition',figp); 19 | 20 | 21 | for step = steps 22 | 23 | %hf = plotPow2(step,1); 24 | ht = wanls2(step); 25 | ht = get(hf,'parent'); 26 | frame = getframe(hf); 27 | 28 | writeVideo(vid,frame); 29 | clf; 30 | end 31 | 32 | close(vid); -------------------------------------------------------------------------------- /utilities/pyPlotting/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This file is part of Puffin, a multi-frequency FEL code absent of the 7 | averaging / SVEA approximations. This file includes the example functions 8 | for plotting Puffin output data. 9 | """ 10 | 11 | from .plotBeamRVsZ import plotBeamRVsZ 12 | from .plotMagPhase import plotMagPhase 13 | from .plotPowVsZ import plotPowVsZ 14 | from .plotPowVsZ2 import plotPowVsZ2 15 | from .plotSpecPow import plotSpecPow 16 | from .spectroAnalysis import spectroT 17 | from .writeFiltFields import writeFiltFields 18 | 19 | 20 | #import readField 21 | #import filterField 22 | #import getMagPhase 23 | 24 | -------------------------------------------------------------------------------- /source/InitDataType.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | MODULE InitDataType 6 | 7 | USE paratype 8 | 9 | IMPLICIT NONE 10 | 11 | type cInitData 12 | 13 | real(kind=wp) :: zbarTotal 14 | real(kind=wp) :: Zbarinter 15 | real(kind=wp) :: zbarlocal 16 | integer(kind=ip) :: iCsteps 17 | integer(kind=ip) :: iStep 18 | integer(kind=ip) :: iUnd_cr 19 | integer(kind=ip) :: iChic_cr 20 | integer(kind=ip) :: iDrift_cr 21 | integer(kind=ip) :: iQuad_cr 22 | integer(kind=ip) :: iModulation_cr 23 | integer(kind=ip) :: iL 24 | integer(kind=ip) :: igwr 25 | 26 | end type cInitData 27 | 28 | end module InitDataType 29 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciDocutils.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # FindSciDocutils 4 | # 5 | # $Id: FindSciDocutils.cmake 792 2015-04-17 14:07:44Z jrobcary $ 6 | # 7 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | # 11 | ###################################################################### 12 | include(FindPackageHandleStandardArgs) 13 | 14 | find_program(RST2HTML_EXECUTABLE NAMES rst2html rst2html.py) 15 | find_package_handle_standard_args(Docutils DEFAULT_MSG RST2HTML_EXECUTABLE) 16 | 17 | find_program(RST2LATEX_EXECUTABLE NAMES rst2latex rst2latex.py) 18 | find_package_handle_standard_args(Docutils DEFAULT_MSG RST2LATEX_EXECUTABLE) 19 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/ploth5En.m: -------------------------------------------------------------------------------- 1 | function hp = ploth5En(fname) 2 | 3 | 4 | 5 | dstep = 1500; 6 | nsteps = 60000; 7 | 8 | steps = 0:dstep:nsteps; 9 | 10 | % Get size of dataset 11 | 12 | fname = 'f1_main_integrated_30000.h5'; 13 | pwsInfo = h5info(fname, '/power'); 14 | 15 | numPZ2 = pwsInfo.Dataspace.Size; 16 | 17 | 18 | ind = 0; 19 | for step = steps 20 | 21 | %hf = plotPow2(step,1); 22 | power = h5read(strcat('f1_main_integrated_', int2str(step), '.h5'), ... 23 | '/power'); 24 | 25 | ind = ind+1; 26 | En(ind) = sum(power); 27 | zbar(ind) = hdf5read(strcat('f1_main_integrated_', int2str(step), '.h5'), ... 28 | '/power','zbarTotal'); 29 | 30 | end 31 | 32 | 33 | figure; semilogy(zbar,En); 34 | xlabel('zbar'); 35 | ylabel('Energy (arb units)'); 36 | 37 | -------------------------------------------------------------------------------- /scimake/rmcomms.sed: -------------------------------------------------------------------------------- 1 | #!/bin/sed -f 2 | # Simple Sed Program to remove all comments from c program 3 | # -------------------------------------------------------------------- 4 | # This is a free shell script under GNU GPL version 2.0 or above 5 | # Copyright (C) 2005 nixCraft project. 6 | # Feedback/comment/suggestions : http://cyberciti.biz/fb/ 7 | # ------------------------------------------------------------------------- 8 | # This script is part of nixCraft shell script collection (NSSC) 9 | # Visit http://bash.cyberciti.biz/ for more information. 10 | # ------------------------------------------------------------------------- 11 | # if no /* get next 12 | /\/\*/!b 13 | # here we've got an /*, append lines until get the corresponding 14 | # */ 15 | :x 16 | /\*\//!{ 17 | N 18 | bx 19 | } 20 | # delete /*...*/ 21 | s/\/\*.*\*\/// 22 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This file is part of Puffin, a multi-frequency FEL code absent of the 7 | averaging / SVEA approximations. This file defines the package for retrieving 8 | data from the Puffin output files. 9 | """ 10 | 11 | from .process import filterField 12 | from .getPow import getPow 13 | from .getPowFromInt import getPowFromInt 14 | from .getMagPhase import getMagPhase 15 | from .getEnFromInt import getEnFromInt 16 | from .rawpuffin import getIntData 17 | from .rawpuffin import readField 18 | from .rawpuffin import getFileSlices 19 | from .rawpuffin import getIntFileSlices 20 | from .rawpuffin import getZData 21 | 22 | #import readField 23 | #import filterField 24 | #import getMagPhase 25 | 26 | -------------------------------------------------------------------------------- /utilities/visit-scripts/visitLoc.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell & Jonathan Smith (Tech-X UK Ltd) 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | Defines the location of local Visit install. Edit as appropriate!! 7 | """ 8 | 9 | import sys 10 | 11 | 12 | def visitLoc(): 13 | localVisItDir = "/home/tml/bin/visit/visit2_10_3.linux-x86_64" 14 | localPythonPackageDir = "/home/tml/bin/visit/visit2_10_3.linux-x86_64/2.10.3/linux-x86_64/lib/site-packages" 15 | sys.path.insert(0,localPythonPackageDir) 16 | return localVisItDir, localPythonPackageDir 17 | 18 | 19 | #if __name__ == '__main__': 20 | # pBaseName=sys.argv[1] 21 | # eDB, iDB, localPowerAllDB = getDBNames.getDBNames(pBaseName) 22 | # visit.Launch(vdir=localVisItDir) 23 | # plotPowNorm(localPowerAllDB) 24 | # visit.OpenGUI() 25 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNsis.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNsis: Module to find include directories and 2 | # libraries for Nsis. 3 | # 4 | # Module usage: 5 | # find_package(SciNsis ...) 6 | # 7 | # May need to be changed to use SciFindPackage() 8 | 9 | ################################################# 10 | # 11 | # Find NSIS packager 12 | # 13 | # $Id: FindSciNsis.cmake 792 2015-04-17 14:07:44Z jrobcary $ 14 | # 15 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 16 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 17 | # 18 | # 19 | ################################################# 20 | 21 | if (WIN32) 22 | set(SCIC_NSIS_SEARCHPATH 23 | "$ENV{PROGRAMFILES}/NSIS" "$ENV{PROGRAMFILES(X86)}/NSIS" 24 | ) 25 | endif () 26 | 27 | find_program(MAKENSIS 28 | makensis 29 | PATHS ${SCIC_NSIS_SEARCHPATH} 30 | DOC "Location of the NSIS executable" 31 | ) 32 | if (MAKENSIS) 33 | set(MAKENSIS_FOUND TRUE) 34 | endif () 35 | 36 | -------------------------------------------------------------------------------- /scimake/SciMpiLauncher.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # Polyswift.cmake: Compute Polyswift specific options 4 | # 5 | # $Id: SciMpiLauncher.cmake 792 2015-04-17 14:07:44Z jrobcary $ 6 | # 7 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | # 11 | ###################################################################### 12 | 13 | # First look in specified path 14 | find_program(${sciexecvar} 15 | "${sciexec}" 16 | PATHS ${scipath} 17 | PATH_SUFFIXES "${sciexecsubdirs}" 18 | NO_DEFAULT_PATH 19 | DOC "Path to the ${sciexec} executable" 20 | ) 21 | 22 | # MPILAUNCHER for parallel runs 23 | if (NOT DEFINED MPILAUNCHER) 24 | set(MPILAUNCHER ${MPILAUNCHER:FILEPATH}) 25 | endif () 26 | 27 | if (NOT DEFINED NPROCS) 28 | if (ENABLE_PARALLEL) 29 | set(NPROCS "2") 30 | endif () 31 | endif () 32 | 33 | -------------------------------------------------------------------------------- /inputs/simple/3D/PhyOfPlasmasV19pp093119/fig7a/README.txt: -------------------------------------------------------------------------------- 1 | This example uses similar parameters to the example in ../fig7. 2 | 3 | The difference is in the beam, and in some sampling parameters. 4 | Since the Puffin paper was published, there have been some 5 | changes in the code, and a greater understanding of the 3D bband 6 | cases have been developed. 7 | 8 | For example, in the case of the 3D CSE from a beam with a flat-top 9 | current profile, the sudden sharp drop in current is NOT possible 10 | to model correctly in the 3D case, since we solve the diffraction in 11 | Fourier space. The diffraction of the field arising from this 12 | discontinuity causes numerical artifacts which we do not believe are 13 | physical. So we have included an alternative input file here, 14 | which does not include the sharp edges in the current profile, 15 | and instead 'rounds off' the current profile at the edges, 16 | giving a smoother radiation emission profile. 17 | 18 | -------------------------------------------------------------------------------- /scimake/mklinks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # mklinks.sh: Make links from one directory to another if 4 | # distinct. Create target. 5 | # 6 | # Args: 7 | # 1: target stamp file 8 | # 2: source directory 9 | # 3-: all files to be linked 10 | # 11 | # $Id: mklinks.sh 792 2015-04-17 14:07:44Z jrobcary $ 12 | # 13 | # Copyright © 2005-2015, Tech-X Corporation, Boulder, CO. 14 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 15 | # 16 | ###################################################################### 17 | 18 | 19 | # Get directories and files 20 | stampfile=$1 21 | shift 22 | sourcedir=`(cd $1; pwd -P)` 23 | shift 24 | destdir=`pwd -P` 25 | files="$*" 26 | echo Linking $* from $sourcedir to $destdir. 27 | if test "$destdir" = "$sourcedir"; then 28 | touch $stampfile 29 | echo "Not making links as source directory is destination directory." 30 | exit 0 31 | fi 32 | rm -f $files 33 | for i in $files; do 34 | ln -s $sourcedir/$i $destdir/$i 35 | done 36 | touch $stampfile 37 | 38 | -------------------------------------------------------------------------------- /utilities/setup/genInputs/SUF.py: -------------------------------------------------------------------------------- 1 | import tables 2 | 3 | def readSUF(fname): 4 | f=tables.open_file(fname,'r') 5 | MPs=f.root.Particles.read() 6 | f.close() 7 | return MPs 8 | 9 | def writeSUF(fname, MPs): 10 | 11 | output_file=tables.open_file(fname ,'w') 12 | 13 | # Particle data: 14 | 15 | ParticleGroup=output_file.create_array('/','Particles', MPs) 16 | 17 | # VizSchema metadata 18 | 19 | boundsGroup=output_file.create_group('/','globalGridGlobalLimits','') 20 | boundsGroup._v_attrs.vsType='limits' 21 | boundsGroup._v_attrs.vsKind='Cartesian' 22 | timeGroup=output_file.create_group('/','time','time') 23 | timeGroup._v_attrs.vsType='time' 24 | ParticleGroup._v_attrs.vsType='variableWithMesh' 25 | ParticleGroup._v_attrs.vsTimeGroup='time' 26 | ParticleGroup._v_attrs.vsNumSpatialDims = 3 27 | ParticleGroup._v_attrs.vsLimits='globalGridGlobalLimits' 28 | ParticleGroup._v_attrs.vsLabels='x,px,y,py,z,pz,NE' 29 | output_file.close() 30 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciMex.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMex: Module to find include directories and 2 | # libraries for Mex. 3 | # 4 | # Module usage: 5 | # find_package(SciMex ...) 6 | # 7 | # May need to be changed to use SciFindPackge() 8 | 9 | ######################################################################## 10 | # 11 | # FindSciMex 12 | # 13 | # $Id: FindSciMex.cmake 792 2015-04-17 14:07:44Z jrobcary $ 14 | # 15 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 16 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 17 | # 18 | # 19 | ######################################################################## 20 | 21 | find_file(MEX NAMES mex.bat mex HINTS ENV PATH) 22 | 23 | if (MEX) 24 | set(MEX_FOUND TRUE) 25 | endif () 26 | 27 | if (MEX_FOUND) 28 | if (NOT MEX_FIND_QUIETLY) 29 | message(STATUS "Found MEX: ${MEX}") 30 | endif () 31 | set(HAVE_MEX 1 CACHE BOOL "Whether have MEX") 32 | else () 33 | if (SciMex_FIND_REQUIRED) 34 | message(FATAL_ERROR "Could not find MEX") 35 | endif () 36 | endif () 37 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciCppCheck.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciCppCheck: Module to find cppcheck 2 | # 3 | # Module usage: 4 | # find_package(SciCppCheck ...) 5 | # 6 | # This module will define the following variables: 7 | # CPPCHECK_FOUND = Whether CppCheck was found 8 | # CppCheck_cppcheck = Path to cppcheck executable 9 | 10 | ###################################################################### 11 | # 12 | # SciCppCheck: Find CppCheck 13 | # 14 | # $Id: FindSciCppCheck.cmake 792 2015-04-17 14:07:44Z jrobcary $ 15 | # 16 | # Copyright 2011-2015, Tech-X Corporation, Boulder, CO. 17 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 18 | # 19 | # 20 | ###################################################################### 21 | 22 | message("") 23 | message("--------- FindSciCppCheck looking for cppcheck ---------") 24 | 25 | SciFindPackage(PACKAGE CppCheck 26 | PROGRAMS "cppcheck" 27 | ) 28 | 29 | if (CPPCHECK_FOUND) 30 | message(STATUS "CppCheck_cppcheck found.") 31 | message(STATUS "CppCheck_cppcheck = ${CppCheck_cppcheck}") 32 | endif () 33 | 34 | -------------------------------------------------------------------------------- /scripts/hartree/puffin.bluewonderphase1.gnu.lsf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #BSUB -o 3Dtest.out 3 | #BSUB -e 3Dtest.err 4 | #BSUB -R "span[ptile=16]" 5 | #BSUB -n 32 6 | #BSUB -J testPuffin 7 | #BSUB -W 360 8 | export MYHOME=`pwd` 9 | 10 | # setup modules 11 | . /etc/profile.d/modules.sh 12 | #module load puffin-gcc 13 | module load gcc/4.9.1 14 | module load openmpi-gcc/1.8 15 | source $HOME/../shared/contrib-sys-gcc491/visitall.sh 16 | export PUFFIN_DIR=$HOME/../shared/install-sys-gcc491/puffin-1.5.1/bin 17 | export MYJOB=fig7 18 | export MYINPUT=${MYJOB}.in 19 | 20 | mpirun -n 32 $PUFFIN_DIR/puffin ${MYINPUT} | tee ${MYJOB}.log 21 | #do something while this .log file is reasonably current 22 | #postprocessing - sort out fields 23 | for i in $(ls fig7_APerp_0_*.h5); do python $PUFFIN_DIR/post/ReorderColMajorFtoColMinorC.py $i; done 24 | #postprocessing - join up particles 25 | python $PUFFIN_DIR/post/mergeParticles.py fig7_electrons 26 | #postprocessing - merge power outputs 27 | python $PUFFIN_DIR/post/aggregatePower.py fig7_Power_0 28 | #reduce particles for ease of visualisation 29 | for i in $(ls fig7_electrons_*.vsh5); do python reduce_particles.py $i 10000; done -------------------------------------------------------------------------------- /utilities/matlab/hdf5/FilterField.m: -------------------------------------------------------------------------------- 1 | function [xfield yfield] = FilterField(field,crfr,distfr,nZ2,sLengthOfElmZ2, rho, q1d) 2 | 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | % filter - HARD FILTER 5 | 6 | %crfr=1.4167; 7 | %distfr=0.2; 8 | 9 | nn = round(sLengthOfElmZ2 * nZ2 * crfr / (4*pi*rho)); 10 | nns = round(sLengthOfElmZ2 * nZ2 * distfr / (4*pi*rho)); 11 | 12 | if (q1d == 1) 13 | 14 | %%%%% 1D %%%%%%% 15 | 16 | ftfield = fft(field); 17 | 18 | ftfield(1:(nn-nns)) = 0; 19 | ftfield((nn+nns):ceil(nZ2/2)) = 0; 20 | 21 | ftfield(ceil(nZ2/2) + 1:nZ2-(nn+nns)+2) = 0; 22 | ftfield((nZ2 - (nn-nns) + 2 ) : nZ2) = 0; 23 | 24 | field = ifft(ftfield); 25 | 26 | xfield = real(field); 27 | yfield = -imag(field); 28 | 29 | else 30 | 31 | %%%%% 3D %%%%%%% 32 | 33 | ftfield = fft(field,[],3); 34 | 35 | ftfield(:,:,1:(nn-nns)) = 0; 36 | ftfield(:,:,(nn+nns):ceil(nZ2/2)) = 0; 37 | 38 | ftfield(:,:,ceil(nZ2/2) + 1:nZ2-(nn+nns)+2) = 0; 39 | ftfield(:,:,(nZ2 - (nn-nns) + 2 ) : nZ2) = 0; 40 | 41 | field = ifft(ftfield,[],3); 42 | 43 | xfield = real(field); 44 | yfield = -imag(field); 45 | 46 | end 47 | 48 | %%%%%%%%%%%%%%%%%%%%%% -------------------------------------------------------------------------------- /source/BParallelInfoType.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | MODULE ParallelInfoType 6 | 7 | USE paratype 8 | 9 | IMPLICIT NONE 10 | ! 11 | !***************************************************** 12 | ! Originally created by Cynthia Nam 13 | 14 | ! Updated- Lawrence Campbell 15 | ! Place - University of Strathclyde 16 | ! Glasgow 17 | ! Scotland 18 | ! Date - 24/11/2008 19 | ! 20 | ! 21 | ! 22 | ! 23 | !***************************************************** 24 | ! 25 | TYPE cParallelInfoType 26 | INTEGER :: comm = 0_IP 27 | INTEGER :: rank = 0_IP 28 | INTEGER :: size = 0_IP 29 | LOGICAL :: QROOT = .FALSE. 30 | END TYPE cParallelInfoType 31 | ! 32 | !==================================================================== 33 | ! Define Global variables 34 | ! 35 | ! tProcInfo_G - Parallel processing information 36 | ! 37 | !===================================================================== 38 | ! 39 | ! 40 | TYPE(cParallelInfoType) :: tProcInfo_G 41 | SAVE tProcInfo_G 42 | 43 | END MODULE ParallelInfoType 44 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciGraphviz.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciGraphviz: Module to find dot 2 | # 3 | # Module usage: 4 | # find_package(SciGraphviz ...) 5 | # 6 | # This module will define the following variables: 7 | # GRAPHVIZ_FOUND = Whether Graphviz was found 8 | # Graphviz_dot = Path to dot executable 9 | 10 | ###################################################################### 11 | # 12 | # SciGraphviz: Find Graphviz 13 | # 14 | # $Id: FindSciGraphviz.cmake 798 2015-04-19 14:19:01Z jrobcary $ 15 | # 16 | # Copyright 2011-2015, Tech-X Corporation, Boulder, CO. 17 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 18 | # 19 | # 20 | ###################################################################### 21 | 22 | message("") 23 | message("--------- FindSciGraphviz looking for dot ---------") 24 | 25 | SciFindPackage(PACKAGE Graphviz 26 | PROGRAMS "dot" 27 | ) 28 | 29 | if (GRAPHVIZ_FOUND) 30 | message(STATUS "Graphviz_dot found.") 31 | message(STATUS "Graphviz_dot = ${Graphviz_dot}") 32 | else () 33 | message(STATUS "Graphviz_dot not found.") 34 | # message(STATUS "Graphviz_dot not found. API documentation cannot be built.") 35 | # set(ENABLE_DEVELDOCS FALSE) 36 | endif () 37 | 38 | -------------------------------------------------------------------------------- /source/puffProvenance.f90.in: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2017, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | !> @author 6 | !> Lawrence Campbell, 7 | !> University of Strathclyde, 8 | !> Glasgow, UK 9 | !> @brief 10 | !> This module contains definitions of provenance data about e.g. how the 11 | !> program was built, passed to Puffin from CMake 12 | 13 | 14 | module PuffProvenance 15 | 16 | use paratype 17 | 18 | ! character(200), parameter :: timeStamp = gitBranch, puffVersion, fortCompiler, & 19 | ! fortVersion, fortFlags, buildHost, hostType 20 | 21 | character(200), parameter :: timeStamp = "@CONFIGURE_TIME_STAMP@", & 22 | gitBranch = '@GIT_BRANCH@ : @GIT_REVISION@', & 23 | puffVersion = '@Puffin_VERSION_MAJOR@.@Puffin_VERSION_MINOR@.@Puffin_VERSION_PATCH@', & 24 | fortCompiler = '@Fortran_COMPILER_NAME@', & 25 | fortVersion = '@Fortran_VERSION@', & 26 | fortFlags = "@CMAKE_Fortran_FLAGS@", & 27 | buildHost = '@UQHOSTNAME@', & 28 | hostType = '@CMAKE_HOST_SYSTEM@' 29 | 30 | end module PuffProvenance 31 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciChecker.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciChecker: Module to find scan_build 2 | # 3 | # Module usage: 4 | # find_package(SciChecker ...) 5 | # 6 | # This module will define the following variables: 7 | # CHECKER_FOUND = Whether Checker was found 8 | # Checker_scan_build = Path to scan_build executable 9 | 10 | ###################################################################### 11 | # 12 | # SciChecker: Find Checker 13 | # 14 | # $Id: FindSciChecker.cmake 792 2015-04-17 14:07:44Z jrobcary $ 15 | # 16 | # Copyright 2011-2015, Tech-X Corporation, Boulder, CO. 17 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 18 | # 19 | ###################################################################### 20 | 21 | message("") 22 | message("--------- FindSciChecker looking for scan_build ---------") 23 | 24 | SciFindPackage(PACKAGE Checker 25 | PROGRAMS "scan-build" 26 | PROGRAM_SUBDIRS . 27 | ) 28 | 29 | if (CHECKER_FOUND) 30 | message(STATUS "Checker_scan_build found.") 31 | message(STATUS "Checker_scan_build = ${Checker_scan_build}") 32 | else () 33 | message(STATUS "Checker_scan_build not found. API documentation cannot be built.") 34 | set(ENABLE_DEVELDOCS FALSE) 35 | endif () 36 | 37 | -------------------------------------------------------------------------------- /source/Aparatype.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | !> @author 6 | !> Lawrence Campbell, 7 | !> University of Strathclyde, 8 | !> Glasgow, UK 9 | !> @brief 10 | !> Definitions of data types used in Puffin 11 | 12 | 13 | MODULE paratype 14 | 15 | use, intrinsic :: iso_fortran_env 16 | 17 | IMPLICIT NONE 18 | 19 | ! Definitions of data types 20 | ! used in Puffin 21 | 22 | INTEGER, PARAMETER :: short =SELECTED_INT_KIND(4), & 23 | long =SELECTED_INT_KIND(9), & 24 | spec =SELECTED_INT_KIND(14), & 25 | float =SELECTED_REAL_KIND(P=6),& 26 | double =SELECTED_REAL_KIND(P=14) 27 | 28 | INTEGER, PARAMETER :: SP =float 29 | INTEGER, PARAMETER :: WP =double 30 | INTEGER, PARAMETER :: IPL =long 31 | INTEGER, PARAMETER :: IP =long 32 | INTEGER, PARAMETER :: LP =long 33 | INTEGER, PARAMETER :: IPN =int64 34 | 35 | INTEGER, PARAMETER :: LGT =KIND(.true.) 36 | 37 | END MODULE paratype 38 | 39 | 40 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciPatchelf.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciPatchelf: Module to find patchelf 2 | # 3 | # Module usage: 4 | # find_package(SciPatchelf ...) 5 | # 6 | # This module will define the following variables: 7 | # PATCHELF_FOUND = Whether Patchelf was found 8 | # Patchelf_patchelf = Path to patchelf executable 9 | 10 | ###################################################################### 11 | # 12 | # SciPatchelf: Find Patchelf 13 | # 14 | # $Id: FindSciPatchelf.cmake 792 2015-04-17 14:07:44Z jrobcary $ 15 | # 16 | # Copyright 2011-2015, Tech-X Corporation, Boulder, CO. 17 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 18 | # 19 | ###################################################################### 20 | 21 | message("") 22 | message("--------- FindSciPatchelf looking for patchelf ---------") 23 | 24 | SciFindPackage(PACKAGE Patchelf 25 | PROGRAMS patchelf 26 | # PROGRAM_SUBDIRS bin 27 | ) 28 | set(PATCHELF_FOUND ${Patchelf_PROGRAMS_FOUND}) 29 | 30 | if (PATCHELF_FOUND) 31 | message(STATUS "Patchelf_patchelf found.") 32 | message(STATUS "Patchelf_patchelf = ${Patchelf_patchelf}") 33 | else () 34 | message(STATUS "Patchelf_patchelf not found. Cannot repair rpath.") 35 | set(ENABLE_DEVELDOCS FALSE) 36 | endif () 37 | 38 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciG4userdocs.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciG4userdcos: Module to find user docs for G4engine. 2 | # 3 | # Module usage: 4 | # find_package(SciG4userdocs ...) 5 | # 6 | 7 | ########################################################### 8 | # 9 | # Find module for G4engine user documentation installation 10 | # 11 | # $Id: FindSciG4userdocs.cmake 792 2015-04-17 14:07:44Z jrobcary $ 12 | # 13 | # Copyright 2014-2015, Tech-X Corporation, Boulder, CO. 14 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 15 | # 16 | ########################################################### 17 | 18 | if (DEFINED G4USERDOCS_DIR) 19 | message(STATUS "[FindSciG4userdocs.cmake] - G4USERDOCS_DIR is ${G4USERDOCS_DIR}") 20 | endif () 21 | 22 | SciFindPackage( 23 | PACKAGE G4userdocs 24 | INSTALL_DIR g4userdocs-lite 25 | FILES html/DagMCDocumentation.html 26 | ) 27 | 28 | if (G4USERDOCS_FOUND) 29 | get_filename_component(USERDOCS_DIR "${G4userdocs_FILES}" PATH) 30 | message(STATUS "[FindSciG4userdocs.cmake] - USERDOCS_DIR is ${USERDOCS_DIR}") 31 | else () 32 | message(STATUS "G4userdocs not found. Use -DG4USERDOCS_DIR to specify the installation directory.") 33 | if (G4userdocs_FIND_REQUIRED) 34 | message(FATAL_ERROR "Failed.") 35 | endif () 36 | endif () 37 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciFluxgrid.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciFluxgrid: Module to find include directories and libraries 2 | # for Fluxgrid. This module was implemented as there is no stock 3 | # CMake module for Fluxgrid. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciFluxgrid REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_FLUXGRID = Whether have the Fluxgrid library 10 | # Fluxgrid_INCLUDE_DIRS = Location of Fluxgrid includes 11 | # Fluxgrid_LIBRARY_DIRS = Location of Fluxgrid libraries 12 | # Fluxgrid_LIBRARIES = Required libraries 13 | # Fluxgrid_STLIBS = Location of Fluxgrid static library 14 | 15 | ###################################################################### 16 | # 17 | # FindSciFluxgrid: find includes and libraries for FLUXGRID 18 | # 19 | # $Id: FindSciFluxgrid.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | # Find shared libs 28 | SciFindPackage(PACKAGE "Fluxgrid" 29 | INSTALL_DIR "fluxgrid" 30 | PROGRAMS "fluxgrid" 31 | ) 32 | 33 | 34 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNetlibLite.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNetlibLite: Module to find include directories and 2 | # libraries for NetlibLite 3 | # 4 | # Module usage: 5 | # find_package(SciNetlibLite ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_NETLIBLITE, NETLIBLITE_FOUND = Whether libraries and includes are found 9 | # NetlibLite_INCLUDE_DIRS = Location of Polyswift includes 10 | # NetlibLite_LIBRARY_DIRS = Location of Polyswift libraries 11 | # NetlibLite_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindNetlibLite: find includes and libraries for txbase 16 | # 17 | # $Id: FindSciNetlibLite.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | if (ENABLE_PARALLEL) 26 | set(instdirs netlib_lite-ben netlib_lite) 27 | else () 28 | set(instdirs netlib_lite) 29 | endif () 30 | 31 | SciFindPackage(PACKAGE "NetlibLite" 32 | INSTALL_DIRS ${instdirs} 33 | MODULES "lsode_mod" 34 | LIBRARIES "lsode;nlother;r8slatec" 35 | ) 36 | 37 | -------------------------------------------------------------------------------- /inputs/dist/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | 38 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciPng.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciPng: Module to find include directories and 2 | # libraries for Png. 3 | # 4 | # Module usage: 5 | # find_package(SciPng ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_PNG, PNG_FOUND = Whether libraries and includes are found 9 | # Png_INCLUDE_DIRS = Location of Png includes 10 | # Png_LIBRARY_DIRS = Location of Png libraries 11 | # Png_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # SciFindPng: find includes and libraries for z(compression) 16 | # 17 | # $Id: FindSciPng.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | SciFindPackage( 26 | PACKAGE "Png" 27 | INSTALL_DIRS libpng-sersh 28 | HEADERS png.h 29 | LIBRARIES "png" 30 | ) 31 | 32 | if (PNG_FOUND) 33 | set(HAVE_PNG 1 CACHE BOOL "Whether have the Png (compression) library") 34 | else () 35 | message(STATUS "Did not find Png (compression) library.") 36 | if (SciPng_FIND_REQUIRED) 37 | message(FATAL_ERROR "Failed.") 38 | endif () 39 | endif () 40 | -------------------------------------------------------------------------------- /inputs/simple/1D/multi-beam/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/3D/CLARA/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | -------------------------------------------------------------------------------- /inputs/simple/3D/DXFEL/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | -------------------------------------------------------------------------------- /inputs/simple/3D/test1/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | -------------------------------------------------------------------------------- /inputs/simple/3D/shortCSE/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | -------------------------------------------------------------------------------- /inputs/simple/1D/OptCommV165pp65-70/fig2/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/1D/PREv64pp046503/fig4/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/1D/PRSTABVv6pp070701/fig4/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/3D/single_spike_SASE/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | -------------------------------------------------------------------------------- /inputs/simple/1D/PREv64pp046503/fig4ROUNDH/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/1D/PREv64pp046503/fig4ROUNDP/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/3D/CLARA/single-slice/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | -------------------------------------------------------------------------------- /source/beamPrep.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | !> @author 6 | !> Lawrence Campbell, 7 | !> University of Strathclyde, 8 | !> Glasgow, UK 9 | !> @brief 10 | !> Module to add additional preparation steps to the electron beam. Can add 11 | !> beam modulations in z2, and/or a linear energy chirp. 12 | 13 | module beamPrep 14 | 15 | use paratype 16 | 17 | contains 18 | 19 | subroutine addChirp(gamj, z2, Nk, center, chirp) 20 | 21 | real(kind=wp), intent(inout) :: gamj(:), z2(:) 22 | integer(kind=ipl), intent(in) :: Nk 23 | real(kind=wp), intent(in) :: center, chirp 24 | 25 | real(kind=wp), allocatable :: Qchoff(:) 26 | 27 | 28 | allocate(Qchoff(Nk)) 29 | 30 | ! Add linear chirp to the beam 31 | 32 | Qchoff = chirp*(z2 - center) 33 | gamj = gamj + Qchoff 34 | 35 | deallocate(Qchoff) 36 | 37 | end subroutine addChirp 38 | 39 | 40 | subroutine addModulation(gamj, z2, Nk, mag, fr) 41 | 42 | real(kind=wp), intent(inout) :: gamj(:), z2(:) 43 | integer(kind=ipl), intent(in) :: Nk 44 | real(kind=wp), intent(in) :: mag, fr 45 | 46 | 47 | ! Add energy modulation to the beam 48 | 49 | gamj = gamj + ( mag * cos(fr * z2) ) 50 | 51 | end subroutine addModulation 52 | 53 | 54 | end module beamPrep -------------------------------------------------------------------------------- /scripts/hartree/puffin.bluewonderphase2.intel2015.lsf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #BSUB -o 3Dtest.out 3 | #BSUB -e 3Dtest.err 4 | #BSUB -R "span[ptile=16]" 5 | #BSUB -n 32 6 | #BSUB -J testPuffin 7 | #BSUB -W 360 8 | export MYHOME=`pwd` 9 | export OMP_NUM_PROCS=4 10 | # setup modules 11 | . /etc/profile.d/modules.sh 12 | #module load puffin-gcc 13 | module load intel/15.2.164 openmpi/1.8 14 | #source $HOME/../shared/contrib-sys-gcc491/visitall.sh 15 | export PUFFIN_DIR=/gpfs/stfc/local/HCP084/bwm06/shared/volatile-intel2015-openmpi/puffin-1.5.1-nw/bin 16 | #/gpfs/stfc/local/HCP084/bwm06/shared/install-gcc491-sysopenmpi1.8/puffin-1.5.1-new-write/bin 17 | export MYJOB=fig7 18 | export MYINPUT=${MYJOB}.in 19 | 20 | mpirun -n 16 $PUFFIN_DIR/puffin ${MYINPUT} | tee ${MYJOB}.log 21 | #do something while this .log file is reasonably current 22 | #postprocessing - sort out fields 23 | for i in $(ls fig7_aperp_0_*.h5); do python $PUFFIN_DIR/post/ReorderColMajorFtoColMinorC.py $i; done 24 | #postprocessing - join up particles 25 | python $PUFFIN_DIR/post/mergeParticles.py fig7_electrons 26 | #postprocessing - merge power outputs 27 | python $PUFFIN_DIR/post/aggregatePower.py fig7_power_0 28 | python $PUFFIN_DIR/post/aggregatePower.py fig7_current_0 29 | #reduce particles for ease of visualisation 30 | for i in $(ls fig7_electrons_*.vsh5); do python reduce_particles.py $i 10000; done -------------------------------------------------------------------------------- /inputs/simple/1D/OptCommV165pp65-70/fig1/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciFacetsIfc.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciFacetsIfc: Module to find include directories and 2 | # libraries for FacetsIfc. 3 | # 4 | # Module usage: 5 | # find_package(SciFacetsIfc ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_FACETSIFC, FACETSIFC_FOUND = Whether libraries and includes are found 9 | # FacetsIfc_INCLUDE_DIRS = Location of FacetsIfc includes 10 | # FacetsIfc_LIBRARY_DIRS = Location of FacetsIfc libraries 11 | # FacetsIfc_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciGeom: find includes for FacetsIfc 16 | # 17 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 18 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 19 | # 20 | # 21 | ###################################################################### 22 | 23 | SciFindPackage(PACKAGE "FacetsIfc" 24 | HEADERS "FacetsIfc.h" 25 | ) 26 | 27 | if (FACETSIFC_FOUND) 28 | message(STATUS "Found FacetsIfc") 29 | set(HAVE_FACETSIFC 1 CACHE BOOL "Whether have FacetsIfc") 30 | else () 31 | message(STATUS "Did not find FacetsIfc. Use -DFacetsIfc_ROOT_DIR to specify the installation directory.") 32 | if (SciFacetsIfc_FIND_REQUIRED) 33 | message(FATAL_ERROR "Failed.") 34 | endif () 35 | endif () 36 | -------------------------------------------------------------------------------- /inputs/simple/3D/PhyOfPlasmasV19pp093119/fig7/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /inputs/simple/3D/PhyOfPlasmasV19pp093119/fig7a/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /inputs/simple/1D/OptCommV165pp65-70/fig1/unscaled/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 0.0 29 | sA0_Y = 0.0 30 | sSigmaF = 2.0, 2.0, 2.0 31 | qFlatTop = .false. 32 | meanZ2 = 0.0 33 | qRndFj_G = .false. 34 | sSigFj_G = 1.0 35 | / 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /inputs/simple/1D/2colour/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 2 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0, 0.4167 28 | sA0_X = 0.01, 0.01 29 | sA0_Y = 0.01, 0.01 30 | sSigmaF = 2.0, 2.0, 2.0, 2.0, 1E8, 1E8 31 | qFlatTop = .true., .true. 32 | meanZ2 = 0.0, 0.0 33 | qRndFj_G = .false., .false. 34 | sSigFj_G = 0.1, 0.1 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/3D/diffraction/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 1 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0 28 | sA0_X = 1.0 29 | sA0_Y = 1.0 30 | sSigmaF = 0.072836562039472, 0.072836562039472, 5.0 31 | qFlatTop = .true. 32 | meanZ2 = 10.0 33 | qRndFj_G = .true. 34 | sSigFj_G = 0.1 35 | qMatchS_G = .false. 36 | / 37 | 38 | -------------------------------------------------------------------------------- /inputs/simple/1D/2colour/wdrifts/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 2 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0, 0.4167 28 | sA0_X = 0.01, 0.01 29 | sA0_Y = 0.01, 0.01 30 | sSigmaF = 2.0, 2.0, 2.0, 2.0, 1E8, 1E8 31 | qFlatTop = .true., .true. 32 | meanZ2 = 0.0, 0.0 33 | qRndFj_G = .false., .false. 34 | sSigFj_G = 0.1, 0.1 35 | / 36 | -------------------------------------------------------------------------------- /inputs/simple/1D/2colour/wchicanes/seed_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN SEED FILE 2 | ! 3 | !Describes seed fields for input into puffin. Multiple seeds with 4 | !different frequencies, profiles and positions can be used. Please 5 | !refer to POP-REF for an explanation of the scaled variables used, 6 | !such as z2. 7 | ! 8 | !READ IN SEED CHARACTERISTICS 9 | !======================================================================== 10 | !PARAMETERS:- 11 | ! 12 | !freqf Ratio of seed to resonant frequency i.e. omega_s / omega_r 13 | !sA0_X Initial peak field value (real, also the x-polarized field) 14 | !sA0_Y Initial peak field value (imaginary, also the y-polarized field) 15 | !sSigmaF Seed field sigma in each spatial direction 16 | !qFlatTop =.TRUE. if flat top seed, else gaussian is assumed 17 | !meanZ2 Mean or center position of seed in Z2 18 | !qRndFj_G round edge of flat top? 19 | !sSigEj Sigma of gaussian roll off for flat top 20 | !======================================================================== 21 | 22 | &NSLIST 23 | nseeds = 2 24 | / 25 | 26 | &SLIST 27 | freqf = 1.0, 0.4167 28 | sA0_X = 0.01, 0.01 29 | sA0_Y = 0.01, 0.01 30 | sSigmaF = 2.0, 2.0, 2.0, 2.0, 1E8, 1E8 31 | qFlatTop = .true., .true. 32 | meanZ2 = 0.0, 0.0 33 | qRndFj_G = .false., .false. 34 | sSigFj_G = 0.1, 0.1 35 | / 36 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciSz.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciSz: Module to find include directories and 2 | # libraries for Sz. 3 | # 4 | # Module usage: 5 | # find_package(SciSz ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_SZ, SZ_FOUND = Whether libraries and includes are found 9 | # Sz_INCLUDE_DIRS = Location of Sz includes 10 | # Sz_LIBRARY_DIRS = Location of Sz libraries 11 | # Sz_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciSz: find includes and libraries for sz(compression) 16 | # 17 | # $Id: FindSciSz.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | if (CMAKE_Fortran_COMPILER_WORKS) 26 | set(desiredmods sz) 27 | else () 28 | set(desiredmods) 29 | endif () 30 | 31 | SciFindPackage(PACKAGE "Sz" 32 | HEADERS "szlib.h" 33 | LIBRARIES "sz" 34 | MODULES ${desiredmods} 35 | ) 36 | 37 | if (SZ_FOUND) 38 | message(STATUS "Found SZ") 39 | set(HAVE_SZ 1 CACHE BOOL "Whether have the sz(compression) library") 40 | else () 41 | if (SciSz_FIND_REQUIRED) 42 | message(FATAL_ERROR "Failed.") 43 | endif () 44 | endif () 45 | 46 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciZ.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciZ: Module to find include directories and 2 | # libraries for Z. 3 | # 4 | # Module usage: 5 | # find_package(SciZ ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_Z, Z_FOUND = Whether libraries and includes are found 9 | # Z_INCLUDE_DIRS = Location of Z includes 10 | # Z_LIBRARY_DIRS = Location of Z libraries 11 | # Z_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # SciFindZ: find includes and libraries for z(compression) 16 | # 17 | # $Id: FindSciZ.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | # Need to find paths with standard algorithm 26 | SciGetInstSubdirs(zlib zinstdirs) 27 | SciFindPackage( 28 | PACKAGE "Z" 29 | INSTALL_DIRS ${zinstdirs} 30 | LIBRARIES z zlib zlib1 OPTIONAL 31 | ) 32 | 33 | if (Z_FOUND) 34 | # message(STATUS "Found Z(compression library)") 35 | set(HAVE_Z 1 CACHE BOOL "Whether have the z(compression) library") 36 | else () 37 | message(STATUS "Did not find Z(compression).") 38 | if (SciZ_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | 43 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciFreeType.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciFreeType: Module to find include directories and 2 | # libraries for FreeType. 3 | # 4 | # Module usage: 5 | # find_package(SciFreeType ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_FREETYPE, FREETYPE_FOUND = Whether libraries and includes are found 9 | # FreeType_INCLUDE_DIRS = Location of FreeType includes 10 | # FreeType_LIBRARY_DIRS = Location of FreeType libraries 11 | # FreeType_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # SciFindFreeType: find includes and libraries for z(compression) 16 | # 17 | # $Id: FindSciFreeType.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | SciFindPackage( 26 | PACKAGE FreeType 27 | HEADERS ft2build.h 28 | INCLUDE_SUBDIRS include include/freetype2 29 | LIBRARIES freetype 30 | ) 31 | 32 | if (FREETYPE_FOUND) 33 | # message(STATUS "Found FreeType") 34 | set(HAVE_FREETYPE 1 CACHE BOOL "Whether have FreeType") 35 | else () 36 | message(STATUS "Did not find FreeType.") 37 | if (SciFreeType_FIND_REQUIRED) 38 | message(FATAL_ERROR "Failed.") 39 | endif () 40 | endif () 41 | 42 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciG4examples.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciG4examples: Module to find examples for G4engine. 2 | # 3 | # Module usage: 4 | # find_package(SciG4examples ...) 5 | # 6 | 7 | ########################################################### 8 | # 9 | # Find module for G4engine examples installation 10 | # 11 | # $Id: FindSciG4examples.cmake 792 2015-04-17 14:07:44Z jrobcary $ 12 | # 13 | # Copyright 2014-2015, Tech-X Corporation, Boulder, CO. 14 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 15 | # 16 | ########################################################### 17 | 18 | # The command line override is PKG_ROOT_DIR 19 | if (DEFINED G4EXAMPLES_ROOT_DIR) 20 | message(STATUS "[FindSciG4examples.cmake] - G4EXAMPLES_ROOT_DIR is ${G4EXAMPLES_ROOT_DIR}") 21 | endif () 22 | 23 | SciFindPackage( 24 | PACKAGE G4examples 25 | INSTALL_DIR g4examples-lite 26 | FILES description.ini 27 | ) 28 | 29 | if (G4EXAMPLES_FOUND) 30 | get_filename_component(G4examples_DIR "${G4examples_FILES}" PATH) 31 | # EXAMPLES_DIR used in TxComposerBase to install the examples into the composer. 32 | set(EXAMPLES_DIR "${G4examples_DIR}") 33 | message(STATUS "[FindSciG4examples.cmake] - EXAMPLES_DIR is ${G4examples_DIR}") 34 | else () 35 | message(STATUS "G4examples not found. Use -DEXAMPLES_DIR to specify the installation directory.") 36 | if (G4examples_FIND_REQUIRED) 37 | message(FATAL_ERROR "Failed.") 38 | endif () 39 | endif () 40 | 41 | -------------------------------------------------------------------------------- /scimake/SciStart.ctest: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # Start.ctest for any scimake project 4 | # 5 | # $Id: SciStart.ctest 792 2015-04-17 14:07:44Z jrobcary $ 6 | # 7 | # Copyright © 2008-2015, Tech-X Corporation, Boulder, CO. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | ###################################################################### 11 | 12 | set(CONFIG_SUMMARY ${CMAKE_CURRENT_BINARY_DIR}/config.summary) 13 | file(REMOVE ${CONFIG_SUMMARY}) 14 | get_filename_component(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/.. REALPATH) 15 | set(CTEST_SOURCE_DIRECTORY ${PROJECT_SOURCE_DIR}) 16 | set(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 17 | message(STATUS "CTEST_BINARY_DIRECTORY = ${CTEST_BINARY_DIRECTORY}.") 18 | include(${PROJECT_SOURCE_DIR}/scimake/SciFuncsMacros.cmake) 19 | include(${PROJECT_SOURCE_DIR}/CTestConfig.cmake) 20 | if (NOT DEFINED CTEST_MODEL) 21 | set(CTEST_MODEL Experimental) 22 | endif () 23 | ctest_start(${CTEST_MODEL}) 24 | if (NOT DEFINED CTEST_CMAKE_GENERATOR) 25 | if (WIN32) 26 | set(CTEST_CMAKE_GENERATOR "NMake Makefiles JOM") 27 | else () 28 | set(CTEST_CMAKE_GENERATOR "Unix Makefiles") 29 | endif () 30 | endif () 31 | ctest_configure(OPTIONS "${CMAKE_OPTIONS}" RETURN_VALUE res) 32 | if (CTEST_DROP_SITE AND (NOT ${CTEST_DROP_SITE} STREQUAL NONE) AND (NOT ${res} EQUAL 0)) 33 | ctest_submit() 34 | endif () 35 | 36 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciMxml.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMxml: Module to find include directories and 2 | # libraries for Mxml. 3 | # 4 | # Module usage: 5 | # find_package(SciMxml ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_MXML, MXML_FOUND = Whether libraries and includes are found 9 | # Mxml_INCLUDE_DIRS = Location of Mxml includes 10 | # Mxml_LIBRARY_DIRS = Location of Mxml libraries 11 | # Mxml_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # SciFindMxml: find includes and libraries for txbase 16 | # 17 | # $Id: FindSciMxml.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | # mxml is only built in serial 26 | SciFindPackage(PACKAGE "Mxml" 27 | INSTALL_DIR "mxml" 28 | HEADERS "mxml.h" 29 | INCLUDES "mxml" 30 | ) 31 | 32 | if (MXML_FOUND) 33 | message(STATUS "Found Mxml") 34 | set(HAVE_MXML 1 CACHE BOOL "Whether have the MXML library") 35 | else () 36 | message(STATUS "Did not find Mxml. Use -DMXML_DIR to specify the installation directory.") 37 | if (SciMxml_FIND_REQUIRED) 38 | message(FATAL_ERROR "Failing") 39 | endif () 40 | endif () 41 | 42 | 43 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/plotElPhase.m: -------------------------------------------------------------------------------- 1 | function hp = plotElPhase(fname) 2 | 3 | 4 | 5 | 6 | 7 | 8 | zbar = hdf5read(fname,'/electrons','zbarTotal'); 9 | rho = hdf5read(fname,'/runInfo','rho'); 10 | nZ2 = hdf5read(fname,'/runInfo','nZ2'); 11 | sLengthOfElmZ2 = hdf5read(fname,'/runInfo','sLengthOfElmZ2'); 12 | gammar = hdf5read(fname,'/runInfo','gamma_r'); 13 | 14 | 15 | nZ2 = double(nZ2); 16 | lenZ2 = sLengthOfElmZ2 * (nZ2-1); 17 | Z2axis = linspace(0,lenZ2,nZ2); 18 | 19 | 20 | h = 6.626e-34; % Planck constant 21 | q_e = 1.60217646e-19; % Charge on electron 22 | c_0 = 2.99792458e8; % Speed of light in vacuum 23 | 24 | NumUniquePts = ceil((nZ2+1)/2); 25 | fs = (nZ2)/lenZ2; %sampling frequency 26 | 27 | 28 | 29 | 30 | %apcz2 = h5read(fname,'/aperp',[60,60,1,1],[1,1,nZ2,2]); 31 | 32 | 33 | % For 3D 34 | %apcz2 = zeros(1,1,nZ2,1); 35 | 36 | %for iz2 = 1:nZ2 37 | % apcz2(1,1,iz2,1) = h5read(fname,'/aperp',[61,67,iz2,1],[1,1,1,1]); 38 | %end 39 | 40 | 41 | %xf = apcz2(:,:,:,1); 42 | 43 | %xf = reshape(xf,[nZ2,1]); 44 | 45 | 46 | 47 | % For 1D 48 | 49 | % Get size of dataset 50 | els = h5info(fname); 51 | 52 | numParts = els.Datasets.Dataspace.Size; 53 | numParts = numParts(2); 54 | 55 | %els = h5read(fname,'/electrons',[1,1],[1,numParts]); 56 | 57 | sElZ2 = h5read(fname,'/electrons',[3,1],[1,numParts]); 58 | 59 | sElGamma = h5read(fname,'/electrons',[6,1],[1,numParts]); 60 | 61 | 62 | figure; hp = plot(sElZ2, sElGamma, '.'); 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciPcre.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # 3 | # FindPCRE: find includes and libraries for PCRE 4 | # 5 | # $Id: FindSciPcre.cmake 792 2015-04-17 14:07:44Z jrobcary $ 6 | # 7 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 8 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 9 | # 10 | # 11 | ###################################################################### 12 | 13 | # - FindSciPCRE: Module to find include directories and 14 | # libraries for PCRE 15 | # 16 | # Module usage: 17 | # find_package(SciPcre ...) 18 | # 19 | # This module will define the following variables: 20 | # HAVE_PCRE, PCRE_FOUND = Whether libraries and includes are found 21 | # Pcre_INCLUDE_DIRS = Location of Gsl includes 22 | # Pcre_LIBRARY_DIRS = Location of Gsl libraries 23 | # Pcre_LIBRARIES = Required libraries 24 | 25 | SciFindPackage(PACKAGE "Pcre" 26 | INSTALL_DIR "pcre" 27 | HEADERS "pcre.h" 28 | LIBRARIES "pcre" 29 | INCLUDE_SUBDIRS "include" 30 | LIBRARY_SUBDIRS "lib" 31 | ) 32 | 33 | if (PCRE_FOUND) 34 | message(STATUS "Found Pcre") 35 | set(HAVE_PCRE 1 CACHE BOOL "Whether have Pcre") 36 | else () 37 | message(STATUS "Did not find Pcre. Use -DPCRE_DIR to specify the installation directory.") 38 | if (SciPcre_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciGsl.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciGsl: Module to find include directories and 2 | # libraries for Gsl. 3 | # 4 | # Module usage: 5 | # find_package(SciGsl ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_GSL, GSL_FOUND = Whether libraries and includes are found 9 | # Gsl_INCLUDE_DIRS = Location of Gsl includes 10 | # Gsl_LIBRARY_DIRS = Location of Gsl libraries 11 | # Gsl_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindGsl: find includes and libraries for GSL 16 | # 17 | # $Id: FindSciGsl.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | SciFindPackage(PACKAGE "Gsl" 26 | INSTALL_DIR "gsl" 27 | HEADERS "gsl/gsl_math.h;gsl/gsl_sf_legendre.h" 28 | LIBRARIES "gsl;gslcblas" 29 | INCLUDE_SUBDIRS "include" 30 | LIBRARY_SUBDIRS "lib" 31 | ) 32 | 33 | if (GSL_FOUND) 34 | message(STATUS "Found Gsl") 35 | set(HAVE_GSL 1 CACHE BOOL "Whether have Gsl") 36 | else () 37 | message(STATUS "Did not find Gsl. Use -DGSL_DIR to specify the installation directory.") 38 | if (SciGsl_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/showTrPhFULL.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | % (going from 34 : 54) 4 | 5 | nZ2t = 51; 6 | 7 | rhoT = rho; 8 | 9 | syslen = (nZ2t - 1) * sLengthOfElmZ2; 10 | 11 | 12 | for ix = 1:40 13 | for iy = 1:40 14 | 15 | [magxrms phasex]=getStokesf(reshape(ax2(ix,iy,100:150),[nZ2t,1]),nZ2t,rhoT,syslen); 16 | [magyrms phasey]=getStokesf(reshape(ay2(ix,iy,100:150),[nZ2t,1]),nZ2t,rhoT,syslen); 17 | 18 | 19 | mx(ix,iy) = magxrms(30); 20 | my(ix,iy) = magyrms(30); 21 | 22 | phx(ix,iy) = phasex(30); 23 | phy(ix,iy) = phasey(30); 24 | 25 | if (ix == 42) 26 | if (iy == 42) 27 | phsv = phasex(1:nZ2t); 28 | mgsv = magxrms(1:nZ2t); 29 | end 30 | end 31 | end 32 | end 33 | 34 | figure; 35 | subplot(1,2,1); 36 | hf = surf(phx); 37 | %xlim([34 54]); 38 | %ylim([34 54]); 39 | set(hf,'edgecolor','none'); 40 | shading interp; 41 | hf = get(get(hf,'parent'),'parent'); 42 | set(hf,'renderermode','man'); 43 | set(hf,'renderer','zbuffer'); 44 | view([0 90]); 45 | 46 | 47 | 48 | %figure; hf = surf(abs(my)); 49 | %subplot(1,2,2); hf = surf(abs(my)); 50 | subplot(1,2,2); hf = surf( sum(abs(ax2(:,:,100:113)).^2 + abs(ay2(:,:,100:113)).^2,3) ); 51 | %xlim([34 54]); 52 | %ylim([34 54]); 53 | set(hf,'edgecolor','none'); 54 | shading interp; 55 | hf = get(get(hf,'parent'),'parent'); 56 | set(hf,'renderermode','man'); 57 | set(hf,'renderer','zbuffer'); 58 | view([0 90]); 59 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciMoab.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMoab: Module to find include directories and 2 | # libraries for Moab. 3 | # 4 | # Module usage: 5 | # find_package(SciMoab ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_MOAB, MOAB_FOUND = Whether libraries and includes are found 9 | # Moab_INCLUDE_DIRS = Location of Moab includes 10 | # Moab_LIBRARY_DIRS = Location of Moab libraries 11 | # Moab_LIBRARIES = Required libraries 12 | # Moab_DLLS = 13 | 14 | ###################################################################### 15 | # 16 | # FindMoab: find includes and libraries for hdf5 17 | # 18 | # $Id: FindSciMoab.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | 26 | set(moabfindlibs dagmc iMesh MOAB) 27 | 28 | set(USE_PYC_LIBS TRUE) 29 | if (NOT DEFINED USE_SHARED_LIBS) 30 | set(USE_SHARED_LIBS TRUE) 31 | endif () 32 | SciGetInstSubdirs(moab instdirs) 33 | 34 | SciFindPackage(PACKAGE "Moab" 35 | INSTALL_DIRS ${instdirs} 36 | HEADERS "MBCore.hpp" 37 | LIBRARIES "${moabfindlibs}" 38 | LIBRARY_SUBDIRS lib/${CXX_COMP_LIB_SUBDIR} lib 39 | ) 40 | 41 | if (MOAB_FOUND) 42 | message(STATUS "Found Moab") 43 | else () 44 | message(STATUS "Did not find Moab. Use -DMoab_ROOT_DIR to specify the installation directory.") 45 | endif () 46 | 47 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciPatoh.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciPatoh: Module to find include directories and 2 | # libraries for Patoh. 3 | # 4 | # Module usage: 5 | # find_package(SciPatoh ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_PATOH, PATOH_FOUND = Whether libraries and includes are found 9 | # Patoh_INCLUDE_DIRS = Location of Patoh includes 10 | # Patoh_LIBRARY_DIRS = Location of Patoh libraries 11 | # Patoh_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindMuparser: find includes and libraries for muparser 16 | # 17 | # $Id: FindSciPatoh.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | 26 | SciFindPackage(PACKAGE "Patoh" 27 | INSTALL_DIR "patoh" 28 | PROGRAMS "" 29 | HEADERS "patoh.h" 30 | LIBRARIES "patoh" 31 | ) 32 | 33 | 34 | if (PATOH_FOUND) 35 | # message(STATUS "Found Patoh") 36 | set(HAVE_PATOH 1 CACHE BOOL "Whether have the Patoh library") 37 | 38 | 39 | else () 40 | message(STATUS "Did not find Patoh. Use -DPATOH_DIR to specify the installation directory.") 41 | 42 | if (SciPatoh_FIND_REQUIRED) 43 | message(FATAL_ERROR "Failing.") 44 | endif () 45 | 46 | endif () 47 | 48 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciCuda.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # - FindSciCuda: Find include directories and libraries for Cuda. 3 | # 4 | # Module usage: 5 | # find_package(SciCuda ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_OPENCL, OPENCL_FOUND = Whether libraries and includes are found 9 | # CUDA_INCLUDE_DIRS = Location of Cuda includes 10 | # CUDA_LIBRARY_DIRS = Location of Cuda libraries 11 | # CUDA_LIBRARIES = Required libraries 12 | # 13 | # Copyright 2013-2015, Tech-X Corporation, Boulder, CO. 14 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 15 | # 16 | # 17 | ###################################################################### 18 | 19 | message("") 20 | message("--------- Looking for CUDA -----------") 21 | find_package(CUDA 5.0) 22 | # find_cuda_helper_libs(cusparse) 23 | if (CUDA_CUDART_LIBRARY AND NOT CUDA_LIBRARY_DIRS) 24 | get_filename_component(CUDA_LIBRARY_DIRS ${CUDA_CUDART_LIBRARY}/.. REALPATH) 25 | endif () 26 | foreach (sfx VERSION CUDA_LIBRARY NVCC_EXECUTABLE 27 | TOOLKIT_ROOT_DIR TOOLKIT_INCLUDE INCLUDE_DIRS 28 | LIBRARY_DIRS LIBRARIES CUDART_LIBRARY 29 | curand_LIBRARY cublas_LIBRARY 30 | cusparse_LIBRARY cufft_LIBRARY npp_LIBRARY cupti_LIBRARY) 31 | SciPrintVar(CUDA_${sfx}) 32 | endforeach () 33 | if (CUDA_TOOLKIT_ROOT_DIR) 34 | set(HAVE_CUDA_TOOLKIT TRUE) 35 | else () 36 | set(HAVE_CUDA_TOOLKIT FALSE) 37 | endif () 38 | SciPrintVar(HAVE_CUDA_TOOLKIT) 39 | message("") 40 | 41 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciMagma.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMagma: Module to find the MAGMA library. 2 | # 3 | # Module usage: 4 | # find_package(SciMagma ...) 5 | # 6 | # Should probably be modified to use SciFindPackage... 7 | 8 | ###################################################################### 9 | # 10 | # FindSciMagma.cmake: Find the MAGMA library. 11 | # 12 | # $Id: FindSciMagma.cmake 792 2015-04-17 14:07:44Z jrobcary $ 13 | # 14 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 15 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 16 | # 17 | # 18 | ###################################################################### 19 | 20 | if (WIN32) 21 | set(MAGMA_LIB_PREFIX "lib") 22 | set(MAGMA_LIB_SUFFIX ".lib") 23 | else () 24 | set(MAGMA_LIB_PREFIX "lib") 25 | set(MAGMA_LIB_SUFFIX ".a") 26 | endif () 27 | 28 | SciFindPackage(PACKAGE "magma" 29 | INSTALL_DIR "${magma_ROOT_DIR}" 30 | LIBRARIES "${MAGMA_LIB_PREFIX}magma${MAGMA_LIB_SUFFIX}" 31 | HEADERS "magma.h" 32 | INCLUDE_SUBDIRS "include" 33 | LIBRARY_SUBDIRS "lib" 34 | ALLOW_LIBRARY_DUPLICATES TRUE 35 | ) 36 | 37 | if (MAGMA_FOUND) 38 | message(STATUS "Found MAGMA.") 39 | set(HAVE_MAGMA 1 CACHE BOOL "Whether have MAGMA") 40 | else () 41 | if (SciMagma_FIND_REQUIRED) 42 | message(FATAL_ERROR "Could not find MAGMA") 43 | else () 44 | if (magma_ROOT_DIR) 45 | message(STATUS "MAGMA not found in ${magma_ROOT_DIR}") 46 | else () 47 | message(STATUS "Not searching for MAGMA") 48 | endif () 49 | endif () 50 | endif () 51 | -------------------------------------------------------------------------------- /utilities/visit-scripts/getDBNames.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell & Jonathan Smith (Tech-X UK Ltd) 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | Defines the names of the datasets from Puffin from the Puffin input basename. 7 | """ 8 | 9 | import os 10 | import sys 11 | import visitLoc 12 | 13 | localVisItDir, localPythonPackageDir = visitLoc.visitLoc() 14 | sys.path.insert(0,localPythonPackageDir) 15 | 16 | import visit 17 | 18 | 19 | def getDBNames(pBaseName): 20 | 21 | currDir = os.getcwd() 22 | 23 | # Database suffixes for power, electron macroparticle and integrated data respectively 24 | 25 | pFileSffx = "_integrated_all.vsh5" 26 | eFileSffx = "_electrons_* database" 27 | iFileSffx = "_integrated_* database" 28 | fFileSffx = "_aperp_C_* database" 29 | 30 | 31 | # Full database paths 32 | 33 | if os.name == 'nt': # If OS is windows... 34 | eDB1 = "localhost:" + currDir + "\\" + pBaseName + eFileSffx 35 | iDB1 = "localhost:" + currDir + "\\" + pBaseName + iFileSffx 36 | fDB1 = "localhost:" + currDir + "\\" + pBaseName + fFileSffx 37 | localPowerAllDB1 = currDir + "\\" + pBaseName + pFileSffx 38 | else: # else assuming linux!! 39 | eDB1 = "localhost:" + currDir + "/" + pBaseName + eFileSffx 40 | iDB1 = "localhost:" + currDir + "/" + pBaseName + iFileSffx 41 | fDB1 = "localhost:" + currDir + "/" + pBaseName + fFileSffx 42 | localPowerAllDB1 = currDir + "/" + pBaseName + pFileSffx 43 | 44 | return eDB1, fDB1, iDB1, localPowerAllDB1 45 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciGtest.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciGtest: Module to find include directories and 2 | # libraries for Gtest. 3 | # 4 | # Module usage: 5 | # find_package(SciGtest ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_GTEST, GTEST_FOUND = Whether libraries and includes are found 9 | # Gtest_INCLUDE_DIRS = Location of Gtest includes 10 | # Gtest_LIBRARY_DIRS = Location of Gtest libraries 11 | # Gtest_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciGtest.cmake: Find the GTEST testing framework 16 | # 17 | # $Id: FindSciGtest.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | SciFindPackage(PACKAGE "Gtest" 26 | INSTALL_DIR "" # empty? 27 | HEADERS "gtest.h" 28 | LIBRARIES "gtest" 29 | INCLUDE_SUBDIRS "include/gtest" 30 | LIBRARY_SUBDIRS "lib/${CXX_COMP_LIB_SUBDIR};lib" 31 | ) 32 | 33 | if (GTEST_FOUND) 34 | message(STATUS "Found gtest") 35 | set(HAVE_GTEST 1 CACHE BOOL "Whether have gtest") 36 | else () 37 | message(STATUS "Did not find gtest. Use -DGTEST_DIR to specify the installation directory.") 38 | if (SciGtest_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/rawpuffin/readField.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | import numpy as np 6 | from numpy.core.fromnumeric import shape 7 | import tables 8 | from puffdata import fdata 9 | 10 | 11 | def readField(h5fname, f1D = 0, xn = None, yn = None): 12 | 13 | mdata = fdata(h5fname) 14 | h5f = tables.open_file(h5fname, mode='r') 15 | 16 | # To select temporal slice of field.... 17 | 18 | #z2s = 50 19 | #z2e = 80 20 | 21 | #z2si = int(np.floor(z2s / dz2)) 22 | #z2ei = int(np.floor(z2e / dz2)) 23 | 24 | #z2axis = (np.arange(z2si,z2ei) - z2si) * dz2 25 | 26 | # ...otherwise take full field 27 | 28 | if (xn == None): 29 | xn = int(np.rint(mdata.vars.nx / 2)) 30 | if (yn == None): 31 | yn = int(np.rint(mdata.vars.ny / 2)) 32 | 33 | 34 | if (mdata.vars.q1d == 1): 35 | xf = h5f.root.aperp[:, 0] 36 | else: 37 | if (f1D == 0): 38 | xf = h5f.root.aperp[:, :, :, 0] 39 | else: 40 | print(xn, yn) 41 | print(shape(h5f.root.aperp)) 42 | xf = h5f.root.aperp[xn, yn, :, 0] 43 | # xfs = xf[z2si:z2ei] # for selecting slice... 44 | 45 | if (mdata.vars.q1d == 1): 46 | yf = h5f.root.aperp[:,1] 47 | else: 48 | if (f1D == 0): 49 | yf = h5f.root.aperp[:, :, :, 1] 50 | else: 51 | yf = h5f.root.aperp[xn, yn, :, 1] 52 | 53 | h5f.close() 54 | 55 | return xf, yf 56 | 57 | -------------------------------------------------------------------------------- /scripts/hartree/puffin.bluewonderphase2.intel-impi.lsf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #BSUB -o 3Dtest.out 3 | #BSUB -e 3Dtest.err 4 | #BSUB -R "span[ptile=24]" 5 | #BSUB -n 48 6 | #BSUB -J testPuffin 7 | #BSUB -W 45 8 | export MYHOME=`pwd` 9 | #export OMP_NUM_PROCS=4 10 | #export OMP_NUM_PROCS=1 11 | export OMP_NUM_THREADS=1 12 | # setup modules 13 | . /etc/profile.d/modules.sh 14 | #module load puffin-gcc 15 | module load intel/15.2.164 openmpi/1.8 16 | #source $HOME/../shared/contrib-sys-gcc491/visitall.sh 17 | export PUFFIN_DIR=/gpfs/stfc/local/HCP084/bwm06/shared/volatile-intel-impi-syshdf5-sysfftw/bin/ 18 | #/gpfs/stfc/local/HCP084/bwm06/shared/install-gcc491-sysopenmpi1.8/puffin-1.5.1-new-write/bin 19 | export MYJOB=fig7 20 | export MYINPUT=${MYJOB}.in 21 | # count how many processors are allocated 22 | NP=0 23 | for TOKEN in $LSB_HOSTS 24 | do 25 | ((NP++)) 26 | done 27 | 28 | echo $NP 29 | 30 | mpiexec.hydra -np $NP $PUFFIN_DIR/puffin ${MYINPUT} | tee ${MYJOB}.log 31 | 32 | 33 | #do something while this .log file is reasonably current 34 | #postprocessing - sort out fields 35 | for i in $(ls fig7_aperp_0_*.h5); do python $PUFFIN_DIR/post/ReorderColMajorFtoColMinorC.py $i; done 36 | #postprocessing - join up particles 37 | python $PUFFIN_DIR/post/mergeParticles.py fig7_electrons 38 | #postprocessing - merge power outputs 39 | python $PUFFIN_DIR/post/aggregatePower.py fig7_power_0 40 | python $PUFFIN_DIR/post/aggregatePower.py fig7_current_0 41 | #reduce particles for ease of visualisation 42 | for i in $(ls fig7_electrons_*.vsh5); do python reduce_particles.py $i 10000; done -------------------------------------------------------------------------------- /scimake/Modules/FindSciCusp.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciCusp: Module to find include directories for cusp. 2 | # 3 | # Module usage: 4 | # find_package(SciCusp ...) 5 | # 6 | # Variables used by this module, which can be set before calling find_package 7 | # to influence default behavior 8 | # Eigen3_ROOT_DIR Specifies the root dir of the eigen3 installation 9 | # 10 | # This module will define the following variables: 11 | # HAVE_CUSP,CUSP_FOUND = Whether libraries and includes are found 12 | # Cusp_INCLUDE_DIRS = Location of cusp includes 13 | 14 | ###################################################################### 15 | # 16 | # FindSciCusp: find includes for cusp 17 | # 18 | # $Id: FindSciCusp.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | 26 | # Try to find an installation of eigen3 in the system include directory. 27 | SciFindPackage(PACKAGE "Cusp" 28 | INSTALL_DIR "cusp" 29 | HEADERS "version.h" 30 | INCLUDE_SUBDIRS include include/cusp 31 | ) 32 | 33 | if (CUSP_FOUND) 34 | message(STATUS "Found Cusp") 35 | set(HAVE_CUSP 1 CACHE BOOL "Whether have Cusp") 36 | else () 37 | message(STATUS "Did not find Cusp. Use -DCUSP_DIR to specify the installation directory.") 38 | if (SciCusp_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | 43 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/rawpuffin/pfilelists.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This retrieves a list of the required Puffin files, given a basename. 7 | """ 8 | 9 | import glob, os 10 | import tables 11 | 12 | 13 | def getFileSlices(baseName): 14 | """ getTimeSlices(baseName) gets a list of files 15 | 16 | That will be used down the line... 17 | """ 18 | filelist=glob.glob(os.getcwd()+os.sep+baseName+'_aperp_C_*.h5') 19 | 20 | dumpStepNos=[] 21 | for thisFile in filelist: 22 | thisDump=int(thisFile.split(os.sep)[-1].split('.')[0].split('_')[-1]) 23 | dumpStepNos.append(thisDump) 24 | 25 | for i in range(len(dumpStepNos)): 26 | filelist[i]=baseName+'_aperp_C_'+str(sorted(dumpStepNos)[i])+'.h5' 27 | return filelist 28 | 29 | def getIntFileSlices(baseName): 30 | """ getTimeSlices(baseName) gets a list of files 31 | 32 | That will be used down the line... 33 | """ 34 | filelist=glob.glob(os.getcwd()+os.sep+baseName+'_integrated_*.h5') 35 | 36 | dumpStepNos=[] 37 | for thisFile in filelist: 38 | thisDump=int(thisFile.split(os.sep)[-1].split('.')[0].split('_')[-1]) 39 | dumpStepNos.append(thisDump) 40 | 41 | for i in range(len(dumpStepNos)): 42 | filelist[i]=baseName+'_integrated_'+str(sorted(dumpStepNos)[i])+'.h5' 43 | return filelist 44 | 45 | 46 | def getZData(fname): 47 | h5f = tables.open_file(fname, mode='r') 48 | zD = h5f.root.runInfo._v_attrs.zTotal 49 | h5f.close() 50 | return zD 51 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciAdios.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciAdios: Module to find include directories and libraries for 2 | # Adios. This module was implemented as there is no stock CMake 3 | # module for Adios. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciAdios REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_ADIOS = Whether have the Adios library 10 | # Adios_INCLUDE_DIRS = Location of Adios includes 11 | # Adios_LIBRARY_DIRS = Location of Adios libraries 12 | # Adios_LIBRARIES = Required libraries 13 | 14 | ###################################################################### 15 | # 16 | # SciFindAdios: find includes and libraries for Adios 17 | # 18 | # $Id: FindSciAdios.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | 26 | SciFindPackage(PACKAGE "Adios" 27 | INSTALL_DIR "adios" 28 | HEADERS "adios.h" 29 | LIBRARIES "adios" 30 | MODULES "adios" 31 | ) 32 | 33 | if (ADIOS_FOUND) 34 | message(STATUS "Found Adios") 35 | set(HAVE_ADIOS 1 CACHE BOOL "Whether have the ADIOS library") 36 | else () 37 | message(STATUS "Did not find Adios. Use -DADIOS_DIR to specify the installation directory.") 38 | if (SciAdios_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed") 40 | endif () 41 | endif () 42 | 43 | -------------------------------------------------------------------------------- /source/BFileType.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | MODULE FileType 6 | 7 | USE paratype 8 | 9 | IMPLICIT NONE 10 | 11 | ! 12 | !***************************************************** 13 | ! File type definition 14 | ! 15 | ! mvar_qUnix - Unix produced file 16 | ! mvar_qFortran - Fortran written file 17 | ! mvar_qFormatted - Formatted data 18 | ! mvar_qForInput - File opened for input 19 | ! mvar_qSwap - Byte swapped file 20 | ! mvar_qAppend - File opened for append 21 | ! mvar_iPos - Position in file 22 | ! mvar_iBufPos - Position in buffer 23 | ! mvar_LastPos - Previous position in file 24 | ! mvar_iPause - Paused position in file 25 | ! mvar_iUnit - Unit stream 26 | ! mvar_Include - Include file level 27 | ! mvar_FileLength - Length of the file 28 | ! mvar_FileName - File name 29 | ! mvar_FileParent - Parent file name 30 | ! mvar_zBuffer - Input file buffer 31 | ! mvar_iPage - Page number in file 32 | !***************************************************** 33 | 34 | type cFileType 35 | 36 | character(1024_IP) :: zFileName = '' 37 | logical :: qFormatted = .false. 38 | logical :: qForInput = .false. 39 | logical :: qAppend = .false. 40 | integer(kind=ip) :: iPos = 0_IP 41 | integer(kind=ip) :: iUnit = 0_IP 42 | integer(kind=ip) :: iFileLength = 0_IP 43 | integer(kind=ip) :: iPage = 0_IP 44 | 45 | end type cFileType 46 | 47 | end module FileType 48 | -------------------------------------------------------------------------------- /utilities/pyPlotting/plotEn_fromInt.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This produces a plot of the power from Puffin field datafiles, as a function of 7 | distance through the undulator z. 8 | 9 | If the Puffin mesh type was periodic, then the power will be averaged over the 10 | temporal mesh. 11 | 12 | If the mesh type was temporal, then the power plotted will be the PEAK power in 13 | the mesh. 14 | """ 15 | 16 | import sys 17 | import numpy as np 18 | from numpy import arange 19 | import matplotlib.pyplot as plt 20 | from retrieve import getEnFromInt 21 | from retrieve import getIntFileSlices 22 | from retrieve import getZData 23 | 24 | iTemporal = 0 25 | iPeriodic = 1 26 | 27 | itemp = 0 28 | iav = 1 29 | ipeak = 2 30 | icycav = 3 31 | 32 | 33 | def plotEn(basename): 34 | 35 | filelist = getIntFileSlices(basename) 36 | print(filelist) 37 | axLab = 'Energy (J)' 38 | 39 | ens = np.zeros(len(filelist)) 40 | zData = np.zeros(len(filelist)) 41 | fcount = 0 42 | 43 | for ij in filelist: 44 | ens[fcount] = getEnFromInt(ij, qScale = 0) 45 | zData[fcount] = getZData(ij) 46 | fcount += 1 47 | 48 | 49 | ax1 = plt.subplot(111) 50 | plt.semilogy(zData, ens) 51 | plt.xlabel(r'$z (m)$') 52 | plt.ylabel(axLab) 53 | ax1.set_title('Energy') 54 | 55 | opname = basename + "-Energy.png" 56 | 57 | plt.savefig(opname) 58 | 59 | 60 | if __name__ == '__main__': 61 | basename = sys.argv[1] 62 | plotEn(basename) 63 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciSquish.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciSquish: Module to find executables and libraries 2 | # for Squish. A stock CMake FindSquish.cmake does exist but 3 | # is supported only for Squish version 3. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciSquish REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_SQUISH = Whether have the Squish library 10 | # Squish_PROGRAMS = Location of Squish executables 11 | # Squish_LIBRARY_DIRS = Location of Squish libraries 12 | # Squish_LIBRARIES = Required libraries 13 | 14 | ###################################################################### 15 | # 16 | # SciFindSquish: find includes and libraries for Squish. 17 | # 18 | # $Id: FindSciSquish.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | set(SUPRA_SEARCH_PATH ${SUPRA_SEARCH_PATH}) 26 | 27 | SciFindPackage(PACKAGE "Squish" 28 | INSTALL_DIR "squish" 29 | FILES ".squish-3-license" 30 | PROGRAMS "squishrunner;squishserver;nchcompare" 31 | LIBRARIES "squishqtpre" 32 | ) 33 | 34 | if (SQUISH_FOUND) 35 | message(STATUS "Found Squish") 36 | set(HAVE_SQUISH 1 CACHE BOOL "Whether have the SQUISH package") 37 | else () 38 | message(STATUS "Did not find Squish. Use -DSQUISH_DIR to specify the installation directory.") 39 | endif () 40 | 41 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciMdsplus.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMdsplus: Module to find include directories and 2 | # libraries for Mdsplus. 3 | # 4 | # Module usage: 5 | # find_package(SciMdsplus ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_MDSPLUS, MDSPLUS_FOUND = Whether libraries and includes are found 9 | # Mdsplus_INCLUDE_DIRS = Location of Mdsplus includes 10 | # Mdsplus_LIBRARY_DIRS = Location of Mdsplus libraries 11 | # Mdsplus_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindMdsplus: find includes and libraries for mdsplus 16 | # 17 | # $Id: FindSciMdsplus.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | SciFindPackage(PACKAGE "Mdsplus" 26 | INSTALL_DIR "mdsplus" 27 | HEADERS "mdsdescrip.h" "mdslib.h" 28 | LIBRARIES "MdsLib" 29 | INCLUDE_SUBDIRS "include" 30 | LIBRARY_SUBDIRS "lib" 31 | ) 32 | 33 | if (MDSPLUS_FOUND) 34 | message(STATUS "Found Mdsplus") 35 | set(HAVE_MDSPLUS 1 CACHE BOOL "Whether have the mdsplus library") 36 | else () 37 | message(STATUS "Did not find Mdsplus. Use -DMdsplus_ROOT_DIR to specify the installation directory.") 38 | if (SciMdsplus_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failing.") 40 | endif () 41 | endif () 42 | 43 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciSphinx.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciSphinx: This module looks for Sphinx binary 2 | # Sphinx is a documentation generation tool. Please see 3 | # http://www.sphinx.org 4 | # 5 | # This modules defines the following variables: 6 | # 7 | # Sphinx_EXECUTABLE = The path to the sphinx command. 8 | # SPHINX_FOUND = Was Sphinx found or not? 9 | # 10 | 11 | ################################################################# 12 | # Find Sphinx... 13 | # 14 | # $Id: FindSciSphinx.cmake 792 2015-04-17 14:07:44Z jrobcary $ 15 | # 16 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 17 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 18 | # 19 | # 20 | ################################################################# 21 | 22 | if (WIN32) 23 | set(sfxs Scripts) 24 | else () 25 | set(sfxs bin) 26 | endif () 27 | if (DEBUG_CMAKE) 28 | message(STATUS "Looking for sphinx-build with SUPRA_SEARCH_PATH = ${SUPRA_SEARCH_PATH} and sfxs = ${sfxs}.") 29 | endif () 30 | find_program(Sphinx_EXECUTABLE 31 | sphinx-build 32 | PATHS ${SUPRA_SEARCH_PATH} 33 | PATH_SUFFIXES ${sfxs} 34 | ) 35 | if (Sphinx_EXECUTABLE) 36 | set(SPHINX_FOUND 1 CACHE BOOL "Found Sphinx binary") 37 | message(STATUS "Sphinx_EXECUTABLE found.") 38 | message(STATUS "Sphinx_EXECUTABLE = ${Sphinx_EXECUTABLE}") 39 | else () 40 | message(STATUS "Sphinx_EXECUTABLE NOT found.") 41 | endif () 42 | 43 | # Enable setting an option 44 | # The -d flag sets the cache directory to be non-hidden 45 | set(Sphinx_OPTS "" CACHE STRING "Options to be passed to the sphinx executable") 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /utilities/setup/genInputs/testMTDrive.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import numpy as np 3 | import SUMatch as TMT 4 | from puffDataClass import puffData 5 | from undulator import undulator 6 | 7 | ##### FOR NEW OUTER DRIVER: 8 | def MTdriver(fnamein): 9 | 10 | puffVars = puffData() 11 | 12 | # Initialize CLARA base parameters 13 | 14 | puffVars.aw = 0.8745*np.sqrt(2.) # The PEAK!!! 15 | puffVars.gamma0 = 469.0 16 | puffVars.lw = 0.025 17 | puffVars.rho = 0.005 18 | puffVars.undtype = '' 19 | puffVars.ux = 1. 20 | puffVars.uy = 0. 21 | 22 | # emitx = 1.022e-9 23 | # emity = 1.022e-9 24 | 25 | # Generate the rest of the Puffin scaling from the above 26 | 27 | puffVars.genParams() # generate rest of scaled params 28 | 29 | undmod = undulator(puffVars, undtype = '', Nw = 26, ux = 1., uy = 0.) 30 | 31 | qf = 3.14 * puffVars.lg 32 | DL = 24. * puffVars.lw # Drift lengths 33 | 34 | #fnamein = 'short_CLARA_001_A2SU.h5' 35 | 36 | TMT.SU2Matched(fnamein, puffVars, undmod, qf, DL) 37 | 38 | #### For matching a segment of the beam 'by eye', specify these 39 | #### as the Twis parameters in the region you want matched 40 | 41 | # twx = [7.5e-10, 13., 3.] 42 | # twy = [7.5e-10, 4., -5.] 43 | 44 | # TMT.SU2Matched(fnamein, puffVars, undmod, qf, DL, twx1 = twx, twy1 = twy) 45 | 46 | 47 | if __name__ == '__main__': 48 | 49 | if len(sys.argv)==2: 50 | fname = sys.argv[1] 51 | print('Processing file:', fname) 52 | MTdriver(fname) 53 | else: 54 | print('Usage: SU2Puffin \n') 55 | sys.exit(1) 56 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciSimD.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciSimD: Module to find include directories and libraries for 2 | # SimD. This module was implemented as there is no stock CMake 3 | # module for SimD. This is currently being used by QuIDS project. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciSimD REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_SIMD = Whether have the SimD library 10 | # SimD_INCLUDE_DIRS = Location of SimD includes 11 | # SimD_LIBRARY_DIRS = Location of SimD libraries 12 | # SimD_LIBRARIES = Required libraries, libSimD 13 | 14 | ###################################################################### 15 | # 16 | # FindSciSimD: find includes and libraries for Simd. 17 | # 18 | # $Id: FindSciSimD.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | set(SUPRA_SEARCH_PATH ${SUPRA_SEARCH_PATH}) 26 | 27 | SciFindPackage(PACKAGE "SimD" 28 | INSTALL_DIR "simd" 29 | HEADERS "dds" 30 | LIBRARIES "SimD" 31 | ) 32 | 33 | if (SIMD_FOUND) 34 | message(STATUS "Found SimD") 35 | set(HAVE_SIMD 1 CACHE BOOL "Whether have the SIMD library") 36 | else () 37 | message(STATUS "Did not find SimD. Use -DSIMD_DIR to specify the installation directory.") 38 | if (SciSimD_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | 43 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciXercesc.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciXercesc: Module to find include directories and libraries 2 | # for Xercesc. 3 | # 4 | # This module can be included in CMake builds in find_package: 5 | # find_package(SciXercesc REQUIRED) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_XERCESC = Whether have the Xerces library 9 | # Xercesc_INCLUDE_DIRS = Location of Xerces includes 10 | # Xercesc_LIBRARY_DIRS = Location of Xerces libraries 11 | # Xercesc_LIBRARIES = Required libraries 12 | # Xercesc_STLIBS = Location of Xerces static library 13 | 14 | ###################################################################### 15 | # 16 | # SciFindXercesc.cmake: find includes and libraries for Xercesc 17 | # 18 | # $Id: FindSciXercesc.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2012-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | 26 | set(SUPRA_SEARCH_PATH ${SUPRA_SEARCH_PATH}) 27 | 28 | SciFindPackage(PACKAGE "Xercesc" 29 | INSTALL_DIR "xercesc" 30 | HEADERS "xercesc" 31 | LIBRARIES "xerces-c" 32 | ) 33 | if (XERCESC_FOUND) 34 | message(STATUS "Found Xercesc") 35 | set(HAVE_XERCESC 1 CACHE BOOL "Whether have the XERCESC library") 36 | else () 37 | message(STATUS "Did not find Xercesc. Use -DXERCESC_DIR to specify the installation directory.") 38 | if (SciXercesc_FIND_REQUIRED) 39 | message(FATAL_ERROR "Failed.") 40 | endif () 41 | endif () 42 | 43 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/rawpuffin/getIntData.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This returns an integrated data set from the Puffin integrated files. It can return the 7 | data averaged over the whole temporal domain with irtype = 1, the peak of the data 8 | with irtype = 2, and as a function of the temporal coordinate z2 (or ct-z) with irtype = 0. 9 | """ 10 | 11 | import sys, glob, os 12 | import numpy as np 13 | from numpy import arange 14 | import tables 15 | from puffdata import fdata 16 | from puffdata import puffData 17 | 18 | itemp = 0 19 | iav = 1 20 | ipeak = 2 21 | icycav = 3 22 | 23 | def getIntData(h5fname, dataName, irtype = 0): 24 | 25 | h5in=tables.open_file(h5fname,'r') 26 | npts=h5in.root._f_get_child(dataName).shape[0] 27 | meshName = h5in.root._f_get_child(dataName)._v_attrs.vsMesh 28 | 29 | meshName = meshName.decode('utf-8') 30 | 31 | mmin=h5in.root._f_get_child(meshName)._v_attrs.vsLowerBounds 32 | mmax=h5in.root._f_get_child(meshName)._v_attrs.vsUpperBounds 33 | 34 | lenz2 = mmax - mmin 35 | dz2 = lenz2 / (npts-1) 36 | z2axis = (np.arange(0, npts)) * dz2 37 | 38 | dataT = h5in.root._f_get_child(dataName).read() 39 | 40 | if (irtype == iav): 41 | if (npts > 1): 42 | dataR = np.trapz(dataT, x=z2axis) / lenz2 # average 43 | else: 44 | dataR = dataT 45 | elif (irtype == ipeak): 46 | dataR = np.max(dataT) # peak 47 | else: 48 | dataR = dataT # temporal 49 | 50 | h5in.close() 51 | 52 | return dataR 53 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNtccTransport.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNtccTransport: Module to find include directories and 2 | # libraries for Ntcc Transport 3 | # 4 | # Module usage: 5 | # find_package(SciNtccTransport ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_NTCCTRANSPORT, NTCCTRANSPORT_FOUND = Whether libraries and includes are found 9 | # NtccTransport_INCLUDE_DIRS = Location of Polyswift includes 10 | # NtccTransport_LIBRARY_DIRS = Location of Polyswift libraries 11 | # NtccTransport_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciNtccTransport: find includes and libraries for Ntcc Transport 16 | # 17 | # $Id: FindSciNtccTransport.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | if (ENABLE_PARALLEL) 26 | set(instdir "ntcc_transport-par") 27 | set(GLF23_INST_LIB glf23mpi) 28 | else () 29 | set(instdir "ntcc_transport") 30 | set(GLF23_INST_LIB glf23) 31 | endif () 32 | 33 | SciFindPackage(PACKAGE NtccTransport 34 | INSTALL_DIRS ${instdir} 35 | MODULES glf23_data_mod nclass_interface 36 | LIBRARIES ${GLF23_INST_LIB} mmm95 ifspppl nclass kapisn mmm71 37 | ) 38 | 39 | if (NTCCTRANSPORT_FOUND) 40 | set(HAVE_NTCCTRANSPORT 1 CACHE BOOL "Whether have the ntcc_transport library") 41 | set(HAVE_NtccTransport 1 CACHE BOOL "Whether have ntcc_transport the library") 42 | endif () 43 | 44 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | "Puffin", Copyright (c) 2012-2018 University of Strathclyde. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the University of Strathclyde nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciTranspbase.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciTranspbase: Module to find include directories and libraries 2 | # for Transpbase. This module was implemented as there is no stock 3 | # CMake module for Transpbase. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciTranspbase REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_TRANSPBASE = Whether have the Transpbase library 10 | # Transpbase_INCLUDE_DIRS = Location of Transpbase includes 11 | # Transpbase_LIBRARY_DIRS = Location of Transpbase libraries 12 | # Transpbase_LIBRARIES = Required libraries 13 | # Transpbase_STLIBS = Location of Transpbase static library 14 | 15 | ###################################################################### 16 | # 17 | # FindSciTranspbase: find includes and libraries for Transpbase 18 | # 19 | # $Id: FindSciTranspbase.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | if (ENABLE_PARALLEL) 28 | set(instdir transpbase-par) 29 | else () 30 | set(instdir transpbase) 31 | endif () 32 | SciFindPackage(PACKAGE "Transpbase" 33 | INSTALL_DIR "${instdir}" 34 | HEADERS "transperror.h" 35 | LIBRARIES "transpbase" 36 | LIBRARY_SUBDIRS "lib/${Fortran_COMP_LIB_SUBDIR};lib" 37 | ) 38 | 39 | if (TRANSPBASE_FOUND) 40 | # message(STATUS "Found TRANSPBASE") 41 | set(HAVE_TRANSPBASE 1 CACHE BOOL "Whether have the TRANSPBASE libraries") 42 | endif () 43 | 44 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/getPowFromInt.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This is returns the power from the field mesh files. It can return the 7 | 'instantaneous' temporal power (which is just the square of the fields) with 8 | irtype = 0, the cycle averaged power (which is the usual definition of power!) 9 | with irtype = 3, the power averaged over the whole temporal domain of the field 10 | mesh with irtype = 1, and the peak power with irtype = 2. 11 | 12 | You can also specify a band pass filter with cfr and dfr, where cfr is the 13 | center frequency and dfr is the half width of the filter. Units are scaled to 14 | the reference frequency - so the fundamental is usually at cfr = 1. 15 | """ 16 | 17 | import sys, glob, os 18 | import numpy as np 19 | from numpy import arange 20 | from .rawpuffin import getIntData 21 | from .process import filterField 22 | from . import getMagPhase 23 | from puffdata import fdata 24 | from puffdata import puffData 25 | 26 | itemp = 0 27 | iav = 1 28 | ipeak = 2 29 | icycav = 3 30 | 31 | def getPowFromInt(h5fname, cfr=None, dfr=None, irtype = 0, qScale = None): 32 | 33 | mdata = fdata(h5fname) 34 | 35 | if (qScale==None): 36 | qScale = mdata.vars.qscale 37 | 38 | lenz2 = (mdata.vars.nz2-1) * mdata.vars.dz2 39 | z2axis = (np.arange(0, mdata.vars.nz2)) * mdata.vars.dz2 40 | 41 | xaxis = (np.arange(0, mdata.vars.nx)) * mdata.vars.dxbar 42 | yaxis = (np.arange(0, mdata.vars.ny)) * mdata.vars.dybar 43 | 44 | power = getIntData(h5fname, 'powerSI', irtype = irtype) 45 | 46 | return power -------------------------------------------------------------------------------- /scripts/hartree/puffin.napier.gcc491.lsf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #BSUB -o puffin.%J.out 3 | #BSUB -e puffin.%J.err 4 | #BSUB -R "span[ptile=24]" 5 | #BSUB -n 48 6 | #BSUB -J testPuffin 7 | #BSUB -W 360 8 | export MYHOME=`pwd` 9 | 10 | # setup modules 11 | . /etc/profile.d/modules.sh 12 | #module load puffin-gcc 13 | #module load gcc/4.9.1 14 | #module load openmpi-gcc/1.8 15 | module load puffin-gcc 16 | #source $HOME/../shared/contrib-gcc491-sysopenmpi1.8/.sh 17 | #export PUFFIN_DIR=$HOME/../shared/install-sys-gcc491/puffin-1.5.1/bin 18 | # phase 2 / napier 19 | #export PUFFIN_DIR=$HOME/../shared/install-gcc491-sysopenmpi1.8/puffin-1.5.1-new-write/bin 20 | export PUFFIN_DIR=/gpfs/stfc/local/apps/gcc/puffin/1.5.3/bin 21 | export MYJOB=fig7 22 | export MYINPUT=${MYJOB}.in 23 | date | tee ${MYJOB}.log 24 | echo running puffin | tee -a ${MYJOB}.log 25 | mpirun -n 32 $PUFFIN_DIR/puffin ${MYINPUT} | tee -a ${MYJOB}.log 26 | echo puffin finished | tee -a ${MYJOB}.log 27 | date | tee -a ${MYJOB}.log 28 | #do something while this .log file is reasonably current 29 | #postprocessing - sort out fields 30 | (for i in $(ls ${MYJOB}_aperp_0_*.h5); do python $PUFFIN_DIR/post/ReorderColMajorFtoColMinorC.py $i; done) | tee -a ${MYJOB}.log 31 | #postprocessing - join up particles 32 | python $PUFFIN_DIR/post/mergeParticles.py ${MYJOB}_electrons | tee -a ${MYJOB}.log 33 | #postprocessing - merge power outputs 34 | python $PUFFIN_DIR/post/aggregateFiles.py ${MYJOB}_power_0 | tee -a ${MYJOB}.log 35 | python $PUFFIN_DIR/post/aggregateFiles.py ${MYJOB}_current_0 | tee -a ${MYJOB}.log 36 | #reduce particles for ease of visualisation 37 | (for i in $(ls ${MYJOB}_electrons_*.vsh5); do python reduce_particles.py $i 10000; done) | tee -a ${MYJOB}.log -------------------------------------------------------------------------------- /scimake/Modules/FindSciMetis.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMetis: Module to find include directories and libraries 2 | # for Metis. This module was implemented as there is no stock 3 | # CMake module for Metis. This is currently being used by QuIDS 4 | # project. 5 | # 6 | # This module can be included in CMake builds in find_package: 7 | # find_package(SciMetis REQUIRED) 8 | # 9 | # This module will define the following variables: 10 | # HAVE_METIS = Whether have the Metis library 11 | # Metis_INCLUDE_DIRS = Location of Metis includes 12 | # Metis_LIBRARY_DIRS = Location of Metis libraries 13 | # Metis_LIBRARIES = Required libraries 14 | # Metis_STLIBS = Location of Metis static library 15 | 16 | ###################################################################### 17 | # 18 | # SciFindMetis: find includes and libraries for Metis. 19 | # 20 | # $Id: FindSciMetis.cmake 792 2015-04-17 14:07:44Z jrobcary $ 21 | # 22 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 23 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 24 | # 25 | # 26 | ###################################################################### 27 | set(SUPRA_SEARCH_PATH ${SUPRA_SEARCH_PATH}) 28 | 29 | SciFindPackage(PACKAGE "Metis" 30 | INSTALL_DIR "metis" 31 | HEADERS "metis.h" 32 | LIBRARIES "metis" 33 | ) 34 | 35 | if (METIS_FOUND) 36 | message(STATUS "Found Metis") 37 | set(HAVE_METIS 1 CACHE BOOL "Whether have the METIS library") 38 | else () 39 | message(STATUS "Did not find Metis. Use -DMETIS_DIR to specify the installation directory.") 40 | if (SciMetis_FIND_REQUIRED) 41 | message(FATAL_ERROR "Failed.") 42 | endif () 43 | endif () 44 | 45 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciThrust.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciThrust: Module to find include directories and 2 | # libraries for Thrust. 3 | # 4 | # Module usage: 5 | # find_package(SciThrust ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_THRUST, THRUST_FOUND = Whether libraries and includes are found 9 | # Thrust_INCLUDE_DIRS = Location of Thrust includes 10 | # Thrust_LIBRARY_DIRS = Location of Thrust libraries 11 | # Thrust_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciThrust: find includes and libraries for thrust 16 | # 17 | # $Id: FindSciThrust.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | SciFindPackage(PACKAGE "Thrust" 26 | INSTALL_DIR "thrust" 27 | INSTALL_DIRS "." 28 | HEADERS "device_vector.h" 29 | PROGRAM_SUBDIRS "." 30 | INCLUDE_SUBDIRS "." 31 | LIBRARY_SUBDIRS "." 32 | ) 33 | 34 | if (THRUST_FOUND) 35 | message("Found Thrust.") 36 | set(HAVE_THRUST 1 CACHE BOOL "Whether have the Thrust library.") 37 | else () 38 | if (SciThrust_FIND_REQUIRED) 39 | message(FATAL_ERROR "Thrust not found. Install it or perhaps add -DTHRUST_DIR=") 40 | else () 41 | message("Did not find Thrust. Thrust is located in CUDA 4.0+, but needed for CUDA 3.2.") 42 | message("If using CUDA 3.2, consider adding -DTHRUST_DIR=") 43 | endif () 44 | endif () 45 | 46 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNemesis.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNemesis: Module to find include directories and libraries 2 | # for Nemesis. This module was implemented as there is no stock 3 | # CMake module for Nemesis. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciNemesis REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_NEMESIS = Whether have the Nemesis library 10 | # Nemesis_INCLUDE_DIRS = Location of Nemesis includes 11 | # Nemesis_LIBRARY_DIRS = Location of Nemesis libraries 12 | # Nemesis_LIBRARIES = Required libraries 13 | # Nemesis_STLIBS = Location of Nemesis static library 14 | 15 | ###################################################################### 16 | # 17 | # SciFindNemesis: find includes and libraries for Nemesis. 18 | # 19 | # $Id: FindSciNemesis.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | set(instdirs nemesis) 28 | 29 | set(desiredlibs nemesis) 30 | set(desiredIncs "ne_nemesisI.h") 31 | 32 | SciFindPackage(PACKAGE "Nemesis" 33 | INSTALL_DIR ${instdirs} 34 | HEADERS ${desiredIncs} 35 | LIBRARIES ${desiredlibs} 36 | ) 37 | 38 | if (NEMESIS_FOUND) 39 | message(STATUS "Found Nemesis") 40 | set(HAVE_NEMESIS 1 CACHE BOOL "Whether have the NEMESIS library") 41 | else () 42 | message(STATUS "Did not find Nemesis. Use -DNEMESIS_DIR to specify the installation directory.") 43 | if (SciNemesis_FIND_REQUIRED) 44 | message(FATAL_ERROR "Failed.") 45 | endif () 46 | endif () 47 | 48 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciCarve.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciCarve: Module to find include directories and 2 | # libraries for Carve. 3 | # 4 | # Module usage: 5 | # find_package(SciCarve ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_CARVE, CARVE_FOUND = Whether libraries and includes are found 9 | # Carve_INCLUDE_DIRS = Location of Carve includes 10 | # Carve_LIBRARY_DIRS = Location of Carve libraries 11 | # Carve_LIBRARIES = Required libraries 12 | 13 | ################################################################## 14 | # 15 | # Find module for CARVE 16 | # 17 | # $Id: FindSciCarve.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ################################################################## 24 | 25 | set(Carve_LIBRARY_LIST 26 | carve 27 | ) 28 | 29 | SciFindPackage( 30 | PACKAGE Carve 31 | HEADERS carve.hpp 32 | INCLUDE_SUBDIRS include/carve include 33 | LIBRARIES ${Carve_LIBRARY_LIST} 34 | PROGRAMS convert intersect slice triangulate view 35 | ) 36 | 37 | if (CARVE_FOUND) 38 | message(STATUS "[FindSciCarve.cmake] - Found CARVE") 39 | message(STATUS "[FindSciCarve.cmake] - Carve_INCLUDE_DIRS = ${Carve_INCLUDE_DIRS}") 40 | message(STATUS "[FindSciCarve.cmake] - Carve_LIBRARIES = ${Carve_LIBRARIES}") 41 | set(HAVE_CARVE 1 CACHE BOOL "Whether have Carve.") 42 | else () 43 | message(STATUS "[FindSciCarve.cmake] - Did not find CARVE, use -DCARVE_DIR to supply the CARVE installation directory.") 44 | if (SciCarve_FIND_REQUIRED) 45 | message(FATAL_ERROR "[FindSciCarve.cmake] - Failing.") 46 | endif () 47 | endif () 48 | 49 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNubeam.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNubeam: Module to find include directories and libraries 2 | # for Nubeam. This module was implemented as there is no stock 3 | # CMake module for Nubeam. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciNubeam REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_NUBEAM = Whether have the Nubeam library 10 | # Nubeam_INCLUDE_DIRS = Location of Nubeam includes 11 | # Nubeam_LIBRARY_DIRS = Location of Nubeam libraries 12 | # Nubeam_LIBRARIES = Required libraries 13 | # Nubeam_STLIBS = Location of Nubeam static library 14 | 15 | ###################################################################### 16 | # 17 | # FindSciNubeam: find includes and libraries for nubeam 18 | # 19 | # $Id: FindSciNubeam.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | 28 | if (ENABLE_PARALLEL) 29 | set(instdir nubeam-par) 30 | else () 31 | set(instdir nubeam) 32 | endif () 33 | 34 | # Currently we are not working about nubeam-serial because of build 35 | # problems 36 | if (ENABLE_PARALLEL) 37 | SciFindPackage(PACKAGE "Nubeam" 38 | INSTALL_DIR "${instdir}" 39 | HEADERS "nubeam_svnversion.h;nubeam.h" 40 | LIBRARIES "TranspPhage;TranspGraphic2" 41 | # LIBRARIES "TranspPhage" 42 | LIBRARY_SUBDIRS "lib" 43 | ) 44 | endif () 45 | 46 | set(NUBEAM_DIR ${Nubeam_DIR}) 47 | 48 | if (NUBEAM_FOUND) 49 | set(HAVE_NUBEAM 1 CACHE BOOL "Whether have the Nubeam library") 50 | endif () 51 | 52 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciCfitsio.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciCfitsion: Module to find include directories and libraries 2 | # for Cfitsio. This module was implemented as there is no stock 3 | # CMake module for Cfitsio. This is currently being used by QuIDS 4 | # project. 5 | # 6 | # This module can be included in CMake builds in find_package: 7 | # find_package(SciCfitsio REQUIRED) 8 | # 9 | # This module will define the following variables: 10 | # HAVE_CFITSIO = Whether have the Cfitsio library 11 | # Cfitsio_INCLUDE_DIRS = Location of Cfitsio includes 12 | # Cfitsio_LIBRARY_DIRS = Location of Cfitsio libraries 13 | # Cfitsio_LIBRARIES = Required libraries 14 | # Cfitsio_STLIBS = Location of Cfitsio static library 15 | 16 | ###################################################################### 17 | # 18 | # SciFindCfitsio: find includes and libraries for Cfitsio. 19 | # 20 | # $Id: FindSciCfitsio.cmake 792 2015-04-17 14:07:44Z jrobcary $ 21 | # 22 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 23 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 24 | # 25 | # 26 | ###################################################################### 27 | set(SUPRA_SEARCH_PATH ${SUPRA_SEARCH_PATH}) 28 | 29 | SciFindPackage(PACKAGE "Cfitsio" 30 | INSTALL_DIR "cfitsio" 31 | HEADERS "fitsio.h" 32 | LIBRARIES "cfitsio" 33 | ) 34 | 35 | if (CFITSIO_FOUND) 36 | message(STATUS "Found Cfitsio") 37 | set(HAVE_CFITSIO 1 CACHE BOOL "Whether have the CFITSIO library") 38 | else () 39 | message(STATUS "Did not find Cfitsio. Use -DCFITSIO_DIR to specify the installation directory.") 40 | if (SciCfitsio_FIND_REQUIRED) 41 | message(FATAL_ERROR "Failed.") 42 | endif () 43 | endif () 44 | 45 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciLibXml2.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciLibXml2n: Module to find include directories and libraries 2 | # for LibXml2. This module was implemented as there is no stock 3 | # CMake module for LibXml2. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciLibXml2 REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_LIBXML2 = Whether have the LibXml2 library 10 | # LibXml2_INCLUDE_DIRS = Location of LibXml2 includes 11 | # LibXml2_LIBRARY_DIRS = Location of LibXml2 libraries 12 | # LibXml2_LIBRARIES = Required libraries 13 | # LibXml2_STLIBS = Location of LibXml2 static library 14 | 15 | ###################################################################### 16 | # 17 | # SciFindLibXml2: find includes and libraries for LibXml2. 18 | # 19 | # $Id: FindSciLibXml2.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2012-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | set(SUPRA_SEARCH_PATH ${SUPRA_SEARCH_PATH}) 27 | 28 | SciFindPackage(PACKAGE "LibXml2" 29 | INSTALL_DIR libxml2 30 | INCLUDE_SUBDIRS include/libxml2 31 | HEADERS libxml/tree.h 32 | LIBRARIES "libxml2.a" 33 | ) 34 | 35 | if (LIBXML2_FOUND) 36 | message(STATUS "Found LibXml2") 37 | set(HAVE_LIBXML2 1 CACHE BOOL "Whether have the LIBXML2 library") 38 | else () 39 | message(STATUS "Did not find LibXml2. Use -DLIBXML2_DIR to specify the installation directory.") 40 | if (SciLibXml2_FIND_REQUIRED) 41 | message(FATAL_ERROR "Failed.") 42 | endif () 43 | endif () 44 | 45 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciTxPLAPACK.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciTxPLAPACK: Module to find include directories and 2 | # libraries for TxPLAPACK. 3 | # 4 | # Module usage: 5 | # find_package(SciTxPLAPACK ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_TXPLAPACK, TXPLAPACK_FOUND = Whether libraries and includes are found 9 | # TxPLAPACK_INCLUDE_DIRS = Location of Gpulib includes 10 | # TxPLAPACK_LIBRARY_DIRS = Location of Gpulib libraries 11 | # TxPLAPACK_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciTxPLAPACK.cmake: Find the TxPLAPACK libraries 16 | # 17 | # $Id: FindSciTxPLAPACK.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | if (BUILD_WITH_SHARED_RUNTIME) 26 | set(instdirs txplapack-parsh) 27 | else () 28 | set(instdirs txplapack-par) 29 | endif () 30 | 31 | SciFindPackage( 32 | PACKAGE "TxPLAPACK" 33 | INSTALL_DIR ${instdirs} 34 | HEADERS "txplapack_version.h" 35 | INCLUDE_SUBDIRS include 36 | LIBRARIES "txplapack" 37 | LIBRARY_SUBDIRS "lib/${CXX_COMP_LIB_SUBDIR};lib" 38 | ) 39 | 40 | if (TXPLAPACK_FOUND) 41 | message(STATUS "Found txplapack") 42 | set(HAVE_TXPLAPACK 1 CACHE BOOL "Whether have txplapack") 43 | else () 44 | message(STATUS "Did not find txplapack. Use -DTXPLAPACK_DIR to specify the installation directory.") 45 | if (TxPLAPACK_FIND_REQUIRED) 46 | message(FATAL_ERROR "Failed") 47 | endif () 48 | endif () 49 | -------------------------------------------------------------------------------- /utilities/pyPlotting/retrieve/getEnFromInt.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | This is returns the power from the field mesh files. It can return the 7 | 'instantaneous' temporal power (which is just the square of the fields) with 8 | irtype = 0, the cycle averaged power (which is the usual definition of power!) 9 | with irtype = 3, the power averaged over the whole temporal domain of the field 10 | mesh with irtype = 1, and the peak power with irtype = 2. 11 | 12 | You can also specify a band pass filter with cfr and dfr, where cfr is the 13 | center frequency and dfr is the half width of the filter. Units are scaled to 14 | the reference frequency - so the fundamental is usually at cfr = 1. 15 | """ 16 | 17 | import sys, glob, os 18 | import numpy as np 19 | from numpy import arange 20 | from .rawpuffin import getIntData 21 | from .process import filterField 22 | from . import getMagPhase 23 | from puffdata import fdata 24 | from puffdata import puffData 25 | 26 | itemp = 0 27 | iav = 1 28 | ipeak = 2 29 | icycav = 3 30 | 31 | def getEnFromInt(h5fname, qScale = None): 32 | 33 | mdata = fdata(h5fname) 34 | 35 | if (qScale==None): 36 | qScale = mdata.vars.qscale 37 | 38 | lenz2 = (mdata.vars.nz2-1) * mdata.vars.dz2 39 | z2axis = (np.arange(0, mdata.vars.nz2)) * mdata.vars.dz2 40 | saxis = z2axis * mdata.vars.lc 41 | taxis = saxis / mdata.vars.c0 42 | 43 | xaxis = (np.arange(0, mdata.vars.nx)) * mdata.vars.dxbar 44 | yaxis = (np.arange(0, mdata.vars.ny)) * mdata.vars.dybar 45 | 46 | power = getIntData(h5fname, 'powerSI', irtype = itemp) 47 | 48 | energy = np.trapz(power, x = taxis) 49 | 50 | return energy 51 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciExodusii.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciExodusii: Module to find include directories and libraries 2 | # for ExodusII. This module was implemented as there is no stock 3 | # CMake module for ExodusII. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciExodusii REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_EXODUSII = Whether have the ExodusII library 10 | # Exodusii_INCLUDE_DIRS = Location of ExodusII includes 11 | # Exodusii_LIBRARY_DIRS = Location of ExodusII libraries 12 | # Exodusii_LIBRARIES = Required libraries 13 | # Exodusii_STLIBS = Location of ExodusII static library 14 | 15 | ###################################################################### 16 | # 17 | # SciFindExodusii: find includes and libraries for ExodusII. 18 | # 19 | # $Id: FindSciExodusii.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | set(instdirs exodusii) 28 | 29 | set(desiredlibs exodusII) 30 | set(desiredIncs "exodusII.h" "exodusII_int.h") 31 | 32 | SciFindPackage(PACKAGE "Exodusii" 33 | INSTALL_DIR ${instdirs} 34 | HEADERS ${desiredIncs} 35 | LIBRARIES ${desiredlibs} 36 | ) 37 | 38 | if (EXODUSII_FOUND) 39 | message(STATUS "Found Exodusii") 40 | set(HAVE_EXODUSII 1 CACHE BOOL "Whether have the EXODUSII library") 41 | else () 42 | message(STATUS "Did not find Exodusii. Use -DEXODUSII_DIR to specify the installation directory.") 43 | if (SciExodusii_FIND_REQUIRED) 44 | message(FATAL_ERROR "Failed.") 45 | endif () 46 | endif () 47 | 48 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciFmcfm.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciFmcfm: Module to find include directories and 2 | # libraries for Fmcfm. 3 | # 4 | # Module usage: 5 | # find_package(SciFmcfm ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_FMCFM, FMCFM_FOUND = Whether libraries and includes are found 9 | # Fmcfm_INCLUDE_DIRS = Location of Fmcfm includes 10 | # Fmcfm_LIBRARY_DIRS = Location of Fmcfm libraries 11 | # Fmcfm_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciFmcfm: find includes and libraries for Fmcfm 16 | # 17 | # $Id: FindSciFmcfm.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | if (ENABLE_PARALLEL) 26 | set(instdir fmcfm-par) 27 | else () 28 | set(instdir fmcfm) 29 | endif () 30 | SciFindPackage(PACKAGE "Fmcfm" 31 | INSTALL_DIR "${instdir}" 32 | HEADERS "FmGlf23TransportModel.h;FmNclassTransportModel.h;FmGyroTransportModel.h;FmTglfTransportModel.h" 33 | LIBRARIES "fmcfmcppwrap;fmcfmcxx;fmcfmwrap;fmcfm" 34 | LIBRARY_SUBDIRS "lib/${Fortran_COMP_LIB_SUBDIR};lib" 35 | ) 36 | 37 | if (FMCFM_FOUND) 38 | # message(STATUS "Found FMCFM") 39 | set(HAVE_FMCFM 1 CACHE BOOL "Whether have the FMCFM library") 40 | # Find gacodes 41 | include(${SCIMAKE_DIR}/SciGetDepsFromInstall.cmake) 42 | # Get gacodes libraries 43 | SciGetDepsFromInstall(GaCode ${Fmcfm_DIR} GACODE) 44 | # Get ntcctransport libraries 45 | SciGetDepsFromInstall(NtccTransport ${Fmcfm_DIR} NTCCTRANSPORT) 46 | endif () 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /source/Hrhs_vars.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | module rhs_vars 6 | 7 | use paratype 8 | 9 | !!!!!!!!!!! 10 | 11 | 12 | 13 | 14 | integer(kind=ip) :: iOutside ! Not *currently* used 15 | 16 | ! Loop counters 17 | 18 | integer(kind=ipl) :: maxEl 19 | 20 | ! For index referencing 21 | 22 | integer(kind=ip) :: retim, ntrans 23 | integer(kind=ip), allocatable :: p_nodes(:) 24 | 25 | 26 | ! For interpolation 27 | 28 | real(kind=wp) :: halfx, halfy 29 | 30 | 31 | 32 | ! Shortcuts 33 | 34 | real(kind=wp) :: nc, nb, ZOver2rho, & 35 | salphaSq, sInv2rho, econst, un 36 | real(kind=wp), allocatable :: lis_GR(:,:) 37 | real(kind=wp) :: dV3, dx, dy, dz2 38 | 39 | 40 | real(kind=wp), allocatable :: sp2(:), sField4ElecReal(:), & 41 | sField4ElecImag(:) 42 | 43 | 44 | real(kind=wp), allocatable :: bxu(:), byu(:), bzu(:) 45 | 46 | ! Error flags 47 | 48 | logical :: qoutside 49 | 50 | !!!!!!!!!!!!! 51 | 52 | 53 | 54 | 55 | ! INTEGER(KIND=IP) :: icheck 56 | ! REAL(KIND=WP) :: dx,dy,dz2 57 | ! 58 | ! INTEGER(KIND=IP) :: xx,yy,xred,yred,zz2 59 | ! REAL(KIND=WP) :: s_Lex,s_Ley,s_Lez2 60 | ! INTEGER(KIND=IP),DIMENSION(:),ALLOCATABLE ::& 61 | ! i_n4e,iNodeList_Re,iNodeList_Im,& 62 | ! i_n4ered 63 | ! REAL(KIND=WP),DIMENSION(:),ALLOCATABLE :: N 64 | ! 65 | ! 66 | ! 67 | ! 68 | ! 69 | ! 70 | ! INTEGER(KIND=IP) :: iNodesX,iNodesZ2,iNodesY, j, ntrans 71 | ! 72 | ! 73 | ! INTEGER :: stat,req,error,lrank,rrank 74 | ! REAL(KIND=WP),DIMENSION(10) :: couple 75 | ! 76 | ! 77 | ! REAL(KIND=WP) :: time1, start_time 78 | 79 | 80 | 81 | 82 | 83 | end module -------------------------------------------------------------------------------- /scimake/Modules/FindSciMesa.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMesa: Module to find include directories and 2 | # libraries for Mesa. 3 | # 4 | # Module usage: 5 | # find_package(SciMesa ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_MESA, MESA_FOUND = Whether libraries and includes are found 9 | # Mesa_INCLUDE_DIRS = Location of Mesa includes 10 | # Mesa_LIBRARY_DIRS = Location of Mesa libraries 11 | # Mesa_LIBRARIES = Required libraries 12 | 13 | ################################################# 14 | # 15 | # Find module for Mesa 16 | # 17 | # $Id: FindSciMesa.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ################################################# 24 | 25 | if (NOT DEFINED Mesa_LIBRARY_LIST) 26 | set(Mesa_LIBRARY_LIST MesaGL OSMesa) 27 | endif () 28 | 29 | # JRC: I believe it is conventional to look for includes with the GL dir 30 | # prepended. 31 | SciFindPackage( 32 | PACKAGE Mesa 33 | HEADERS GL/gl.h 34 | LIBRARIES MesaGL OSMesa 35 | INCLUDE_SUBDIRS include include/mesa/include # First for Visit 36 | ) 37 | 38 | if (MESA_FOUND) 39 | # message(STATUS "[FindMesa.cmake] - Found Mesa") 40 | # message(STATUS "[FindMesa.cmake] - Mesa_INCLUDE_DIRS = ${Mesa_INCLUDE_DIRS}") 41 | # message(STATUS "[FindMesa.cmake] - Mesa_LIBRARIES = ${Mesa_LIBRARIES}") 42 | set(HAVE_Mesa 1 CACHE BOOL "Whether have Vtk.") 43 | else () 44 | message(STATUS "[FindMesa.cmake] - Did not find Mesa, use -DMesa_ROOT_DIR to supply the Mesa installation directory.") 45 | if (SciMesa_FIND_REQUIRED) 46 | message(FATAL_ERROR "[FindMesa.cmake] - Failed to find Mesa.") 47 | endif () 48 | endif () 49 | 50 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNetcdf_cmake.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNetcdf_cmake: Module to find include directories and libraries 2 | # for Netcdf. This module was implemented as there is no stock 3 | # CMake module for Netcdf. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciNetcdf_cmake REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_NETCDF_CMAKE = Whether have the Netcdf library 10 | # Netcdf_cmake_INCLUDE_DIRS = Location of Netcdf_cmake includes 11 | # Netcdf_cmake_LIBRARY_DIRS = Location of Netcdf_cmake libraries 12 | # Netcdf_cmake_LIBRARIES = Required libraries 13 | # Netcdf_cmake_STLIBS = Location of Netcdf_cmake static library 14 | 15 | ###################################################################### 16 | # 17 | # SciFindNetcdf_cmake: find includes and libraries for Netcdf_cmake. 18 | # 19 | # $Id: FindSciNetcdf_cmake.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | set(instdirs netcdf_cmake) 28 | 29 | set(desiredlibs netcdf) 30 | 31 | SciFindPackage(PACKAGE "Netcdf_cmake" 32 | INSTALL_DIR ${instdirs} 33 | HEADERS "netcdf.h" 34 | LIBRARIES ${desiredlibs} 35 | ) 36 | 37 | if (NETCDF_CMAKE_FOUND) 38 | message(STATUS "Found Netcdf_cmake") 39 | set(HAVE_NETCDF_CMAKE 1 CACHE BOOL "Whether have the NETCDF_CMAKE library") 40 | else () 41 | message(STATUS "Did not find Netcdf_cmake. Use -DNETCDF_CMAKE_DIR to specify the installation directory.") 42 | if (SciNetcdf_cmake_FIND_REQUIRED) 43 | message(FATAL_ERROR "Failed.") 44 | endif () 45 | endif () 46 | 47 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciDoxygen.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciDoxygen: Module to find doxygen and setup apidocs target for 2 | # Doxygen. 3 | # 4 | # Module usage: 5 | # find_package(SciDoxygen ...) 6 | # 7 | # This module will define the following variables: 8 | # DOXYGEN_FOUND = Whether Doxygen was found 9 | # DOXYGEN_PROGRAM = Path to doxygen executable 10 | 11 | ###################################################################### 12 | # 13 | # SciDoxygen: Find Doxygen and set up apidocs target 14 | # 15 | # $Id: FindSciDoxygen.cmake 792 2015-04-17 14:07:44Z jrobcary $ 16 | # 17 | # Copyright 2011-2015, Tech-X Corporation, Boulder, CO. 18 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 19 | # 20 | # 21 | ###################################################################### 22 | 23 | message("") 24 | message("--------- FindSciDoxygen looking for doxygen ---------") 25 | find_package(Doxygen) 26 | 27 | if (NOT DOXYGEN_FOUND) 28 | message(STATUS "Doxygen not found by default CMake module, falling back to SciFindPackage module.") 29 | SciFindPackage(PACKAGE Doxygen 30 | PROGRAMS "doxygen" 31 | ) 32 | if (DOXYGEN_FOUND) 33 | set(DOXYGEN_PROGRAM "${Doxygen_doxygen}") 34 | endif () 35 | endif () 36 | 37 | # Maintain backward compatibility 38 | if (NOT DOXYGEN_PROGRAM) 39 | set(DOXYGEN_PROGRAM ${DOXYGEN_EXECUTABLE}) 40 | elseif (NOT DOXYGEN_EXECUTABLE) 41 | set(DOXYGEN_EXECUTABLE ${DOXYGEN_PROGRAM}) 42 | endif () 43 | 44 | if (DOXYGEN_FOUND) 45 | message(STATUS "DOXYGEN_PROGRAM found.") 46 | message(STATUS "DOXYGEN_PROGRAM = ${DOXYGEN_PROGRAM}") 47 | message(STATUS "DOXYGEN_EXECUTABLE = ${DOXYGEN_EXECUTABLE}") 48 | else () 49 | message(STATUS "DOXYGEN_PROGRAM not found. API documentation cannot be built.") 50 | set(ENABLE_DEVELDOCS FALSE) 51 | endif () 52 | 53 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciOpenCL.cmake: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # - FindSciOpenCL: Find include directories and libraries for OpenCL. 3 | # 4 | # Module usage: 5 | # find_package(OpenCL ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_OPENCL, OPENCL_FOUND = Whether libraries and includes are found 9 | # OpenCL_INCLUDE_DIRS = Location of OpenCL includes 10 | # OpenCL_LIBRARY_DIRS = Location of OpenCL libraries 11 | # OpenCL_LIBRARIES = Required libraries 12 | # 13 | # Copyright 2013-2015, Tech-X Corporation, Boulder, CO. 14 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 15 | # 16 | # 17 | ###################################################################### 18 | 19 | 20 | find_package(CUDA) 21 | if (CUDA_FOUND) 22 | if (OpenCL_ROOT_DIR) 23 | else () 24 | set(OpenCL_ROOT_DIR "${CUDA_TOOLKIT_ROOT_DIR}") 25 | endif () 26 | endif () 27 | 28 | if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") 29 | set(OpenCL_HEADERS "OpenCL/opencl.h") 30 | else () 31 | set(OpenCL_HEADERS "CL/cl.h") 32 | endif () 33 | 34 | SciFindPackage(PACKAGE "OpenCL" 35 | INSTALL_DIRS "${OpenCL_ROOT_DIR}" 36 | HEADERS "${OpenCL_HEADERS}" 37 | LIBRARIES "OpenCL" 38 | INCLUDE_SUBDIRS "include" 39 | LIBRARY_SUBDIRS "lib64;lib;lib/x64" 40 | ) 41 | 42 | if (OpenCL_INCLUDE_DIRS AND OpenCL_LIBRARIES) 43 | set(OpenCL_FOUND TRUE) 44 | endif () 45 | 46 | if (OpenCL_FOUND) 47 | message(STATUS "Found OpenCL") 48 | set(HAVE_OpenCL 1 CACHE BOOL "Whether have OpenCL") 49 | else () 50 | message(STATUS "Did not find OpenCL. Use -DOpenCL_ROOT_DIR to specify the installation directory.") 51 | if (SciOpenCL_FIND_REQUIRED) 52 | message(FATAL_ERROR "Failed.") 53 | endif () 54 | endif () 55 | 56 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciMuparser.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciMuparser: Module to find include directories and 2 | # libraries for Muparser. 3 | # 4 | # Module usage: 5 | # find_package(SciMuparser ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_MUPARSER, MUPARSER_FOUND = Whether libraries and includes are found 9 | # Muparser_INCLUDE_DIRS = Location of Muparser includes 10 | # Muparser_LIBRARY_DIRS = Location of Muparser libraries 11 | # Muparser_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindMuparser: find includes and libraries for muparser 16 | # 17 | # $Id: FindSciMuparser.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | set(ALLOW_SERIAL_WITH_PARALLEL_SAV ${ALLOW_SERIAL_WITH_PARALLEL}) 26 | set(ALLOW_SERIAL_WITH_PARALLEL TRUE) 27 | SciGetInstSubdirs(muparser instdirs) 28 | # message(STATUS "instdirs = ${instdirs}.") 29 | SciFindPackage(PACKAGE "Muparser" 30 | INSTALL_DIRS ${instdirs} 31 | HEADERS "muParser.h" 32 | LIBRARIES "muparser" 33 | INCLUDE_SUBDIRS "include" 34 | LIBRARY_SUBDIRS "lib" 35 | ) 36 | set(ALLOW_SERIAL_WITH_PARALLEL ${ALLOW_SERIAL_WITH_PARALLEL_SAV}) 37 | 38 | if (MUPARSER_FOUND) 39 | message(STATUS "Found Muparser") 40 | set(HAVE_MUPARSER 1 CACHE BOOL "Whether have the MUPARSER library") 41 | else () 42 | message(STATUS "Did not find Muparser. Use -DMUPARSER_DIR to specify the installation directory.") 43 | if (SciMuparser_FIND_REQUIRED) 44 | message(FATAL_ERROR "Failing.") 45 | endif () 46 | endif () 47 | 48 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciFftw.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciFftw: Module to find include directories and 2 | # libraries for Fftw. 3 | # 4 | # Module usage: 5 | # find_package(SciFftw ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_FFTW, FFTW_FOUND = Whether libraries and includes are found 9 | # Fftw_INCLUDE_DIRS = Location of Fftw includes 10 | # Fftw_LIBRARY_DIRS = Location of Fftw libraries 11 | # Fftw_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # SciFindFftw: find includes and libraries for txbase 16 | # 17 | # $Id: FindSciFftw.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | if (ENABLE_PARALLEL) 26 | message(STATUS "Looking for parallel FFTW") 27 | SciFindPackage(PACKAGE "Fftw" 28 | INSTALL_DIR "fftw-par" 29 | HEADERS "fftw.h;rfftw.h;fftw_mpi.h;rfftw_mpi.h" 30 | LIBRARIES "fftw;rfftw;fftw_mpi;rfftw_mpi" 31 | ) 32 | else () 33 | message(STATUS "Looking for serial FFTW") 34 | SciFindPackage(PACKAGE "Fftw" 35 | INSTALL_DIR "fftw" 36 | HEADERS "fftw.h;rfftw.h" 37 | LIBRARIES "fftw;rfftw" 38 | ) 39 | endif () 40 | 41 | if (FFTW_FOUND) 42 | message(STATUS "Found Fftw") 43 | set(HAVE_FFTW 1 CACHE BOOL "Whether have the FFTW library") 44 | else () 45 | message(STATUS "Did not find Fftw. Use -DFFTW_DIR to specify the installation directory.") 46 | if (SciFftw_FIND_REQUIRED) 47 | message(FATAL_ERROR "Failed.") 48 | endif () 49 | endif () 50 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciCLapackCMake.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciCLapackscimake: Module to find include directories and 2 | # libraries for CLapackscimake. 3 | # 4 | # Module usage: 5 | # find_package(SciCLapackscimake ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_CLAPACKCMAKE, CLAPACKCMAKE_FOUND = Whether libraries and includes are found 9 | # CLapackscimake_INCLUDE_DIRS = Location of CLapackscimake includes 10 | # CLapackscimake_LIBRARY_DIRS = Location of CLapackscimake libraries 11 | # CLapackscimake_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindCLapackscimake: find includes and libraries for txbase 16 | # 17 | # $Id: FindSciCLapackCMake.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | set(clapack_libs "lapack;blas;") 26 | if (BUILD_WITH_SHARED_RUNTIME) 27 | set(clapack_libs "${clapack_libs}libf2c") 28 | else () 29 | set(clapack_libs "${clapack_libs}f2c") 30 | endif () 31 | 32 | SciFindPackage(PACKAGE "CLapackscimake" 33 | INSTALL_DIR "clapack_cmake" 34 | HEADERS "clapack.h;f2c.h;blaswrap.h" 35 | LIBRARIES ${clapack_libs} 36 | ) 37 | 38 | if (CLAPACKSCIMAKE_FOUND) 39 | message(STATUS "CLapackscimake found.") 40 | set(HAVE_CLAPACKCMAKE 1 CACHE BOOL "Whether have CLapackscimake") 41 | else () 42 | message(STATUS "Did not find CLapackscimake. Use -DCLapackscimake_ROOT_DIR to specify the installation directory.") 43 | if (SciCLapackscimake_FIND_REQUIRED) 44 | message(FATAL_ERROR "Failed") 45 | endif () 46 | endif () 47 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/diffr.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | numUniquePtsZ2 =real( ceil((nZ2+1)/2)); 4 | numUniquePtsX = real( ceil((nX+1)/2)); 5 | numUniquePtsY = real(ceil((nY+1)/2)); 6 | 7 | 8 | 9 | %kx = 2.*pi .* (0:numUniquePtsX) ./ (sLengthOfElmX .* nX); 10 | %ky = 2.*pi .* (0:numUniquePtsY) ./ (sLengthOfElmY .* nY); 11 | %kz2 = 2.*pi .* (0:numUniquePtsZ2) ./ (sLengthOfElmZ2 .* nZ2); 12 | 13 | nZ2 = double(nZ2); 14 | nX = double(nX); 15 | nY = double(nY); 16 | 17 | if rem(nZ2,2) 18 | kz2 = [double(0:numUniquePtsZ2) double(-numUniquePtsZ2:-1)] .* 2.0 .* pi ./ (sLengthOfElmZ2 .* nZ2); 19 | else 20 | kz2 = [double(0:numUniquePtsZ2) double(-numUniquePtsZ2+1:-1)] .* 2.0 .* pi ./ (sLengthOfElmZ2 .* nZ2); 21 | end 22 | 23 | 24 | 25 | 26 | if rem(nX,2) 27 | kx = double([(0:numUniquePtsX) (-numUniquePtsX:-1)]) .* 2 .* pi ./ (sLengthOfElmX .* nX); 28 | else 29 | kx = double([(0:numUniquePtsX) (-numUniquePtsX+1:-1)]) .* 2 .* pi ./ (sLengthOfElmX .* nX); 30 | end 31 | 32 | 33 | 34 | if rem(nY,2) 35 | ky = double([(0:numUniquePtsY) (-numUniquePtsY:-1)]) .* 2 .* pi ./ (sLengthOfElmY .* nY); 36 | else 37 | ky = double([(0:numUniquePtsY) (-numUniquePtsY+1:-1)]) .* 2 .* pi ./ (sLengthOfElmY .* nY); 38 | end 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | dzbar = 6.0; 47 | 48 | 49 | ax2FT = fftn(aperp); 50 | 51 | 52 | for ix = 1:nX 53 | 54 | for iy = 1:nY 55 | 56 | for iz2 = 1:nZ2 57 | 58 | if (kz2(iz2) ~= 0) 59 | 60 | 61 | ax2FT(ix,iy,iz2) = ax2FT(ix,iy,iz2) .* exp(1j .* dzbar .* ... 62 | ( kx(ix).^2 + ky(iy).^2 ) ... 63 | ./ (2.*kz2(iz2)) ); 64 | end 65 | 66 | end 67 | end 68 | end 69 | 70 | 71 | 72 | apf = ifftn(ax2FT); 73 | %clear ax2FT; 74 | 75 | 76 | -------------------------------------------------------------------------------- /inputs/simple/1D/CLARA/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | &NBLIST 30 | nbeams = 1 31 | dtype = 'simple' 32 | / 33 | 34 | &BLIST 35 | sSigmaE = 0.084, 0.084, 1E8, 1.0, 1.0, 0.001 36 | sLenE = 1E-6, 1E-6, 50.0, 1E-6, 1E-6, 0.006 37 | emitx = 1.0 38 | emity = 1.0 39 | Ipk = 400 40 | bcenter = 0.0 41 | gammaf = 1.0 42 | iMPsZ2PerWave = 4 43 | TrLdMeth = 2 44 | nseqparts = 19 45 | qRndEj_G = .true. 46 | sSigEj_G = 0.1 47 | qFixCharge = .false. 48 | qMatched_A = .true. 49 | / 50 | -------------------------------------------------------------------------------- /utilities/setup/genInputs/matchTwiss.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2018, University of Strathclyde 2 | # Authors: Lawrence T. Campbell 3 | # License: BSD-3-Clause 4 | 5 | """ 6 | Module to transform a beam distribution to a set of Twiss parameters. 7 | See the matchTwiss routine at the bottom of the file to do this. 8 | """ 9 | 10 | import numpy as np 11 | 12 | 13 | def getMat(b1, a1, b2, a2): 14 | """ 15 | Calculate matrix necessary to transform a beam of given Twiss parameters 16 | to the new Twiss parameters 17 | """ 18 | 19 | f1 = np.sqrt(b1*b2) 20 | 21 | M11 = b2 / f1 22 | M12 = 0. 23 | M21 = (a1-a2) / f1 24 | M22 = b1 / f1 25 | 26 | mat = np.array([[M11,M12],[M21,M22]]) 27 | 28 | return mat 29 | 30 | 31 | def MM(x, px, M): 32 | """ 33 | Transform beam distribution x-px with matrix MM. 34 | """ 35 | 36 | ap = np.array([x, px]) 37 | apn = np.matmul(M, ap) 38 | xn = apn[0,:] 39 | pxn = apn[1,:] 40 | 41 | return xn, pxn 42 | 43 | 44 | 45 | 46 | 47 | def matchT1(x, px, b1, a1, b2, a2): 48 | """ 49 | Transform beam distribution from the given Twiss parameters (b1, a1) 50 | to the new Twiss parameters (b2, a2). 51 | """ 52 | 53 | M = getMat(b1, a1, b2, a2) 54 | x2, px2 = MM(x, px, M) 55 | 56 | return x2, px2 57 | 58 | 59 | 60 | 61 | def matchTwiss(x, px, y, py, TX1, TX2, TY1, TY2): 62 | """ 63 | Transform x and y phase spaces from Twiss parameters in T0 to T1. 64 | """ 65 | 66 | bx1 = TX1[0] 67 | ax1 = TX1[1] 68 | 69 | bx2 = TX2[0] 70 | ax2 = TX2[1] 71 | 72 | by1 = TY1[0] 73 | ay1 = TY1[1] 74 | 75 | by2 = TY2[0] 76 | ay2 = TY2[1] 77 | 78 | x2, px2 = matchT1(x, px, bx1, ax1, bx2, ax2) 79 | y2, py2 = matchT1(y, py, by1, ay1, by2, ay2) 80 | 81 | return x2, px2, y2, py2 82 | -------------------------------------------------------------------------------- /scimake/Modules/FindEpicsExtensions.cmake: -------------------------------------------------------------------------------- 1 | # - FindEpicsExtensions: Module to find include directories and libraries 2 | # for Epics Extensions. This module was implemented as there is no stock 3 | # CMake module for Epics. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(EpicsExtensions REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_EPICSEXTENSIONS = Whether have the Epics Extensions library 10 | # EpicsExtensions_INCLUDE_DIRS = Location of Epics Extensions includes 11 | # EpicsExtensions_LIBRARY_DIRS = Location of Epics Extensions libraries 12 | # EpicsExtensions_LIBRARIES = Required libraries 13 | # EpicsExtensions_STLIBS = Location of Epics Extensions static library 14 | 15 | ###################################################################### 16 | # 17 | # FindEpicsExtensions: find includes and libraries for Epics Extensions 18 | # 19 | # $Id: FindEpicsExtensions.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | if (ENABLE_PARALLEL) 28 | set(epicsdir epics-par) 29 | set(sddslib SDDSmpi) 30 | set(pgapacklib ";pgapack") 31 | else () 32 | set(epicsdir epics) 33 | set(sddslib SDDS1) 34 | set(pgapacklib "") 35 | endif () 36 | 37 | SciFindPackage( 38 | PACKAGE EpicsExtensions 39 | INSTALL_DIR "${epicsdir}/extensions" 40 | HEADERS "awe.h;gsl/gsl_poly.h" 41 | LIBRARIES 42 | "mdbcommon;matlib;fftpack;${sddslib};rpnlib;mdbmth;namelist;mdblib;meschach;gsl${pgapacklib}" 43 | INCLUDE_SUBDIRS "src/SDDS/include;src/SDDS/gsl" 44 | LIBRARY_SUBDIRS "lib/linux-x86_64;lib/linux-x86" 45 | ) 46 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciEigen3.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciEigen3: Module to find include directories for Eigen3. 2 | # 3 | # Module usage: 4 | # find_package(SciEigen3 ...) 5 | # 6 | # Variables used by this module, which can be set before calling find_package 7 | # to influence default behavior 8 | # Eigen3_ROOT_DIR Specifies the root dir of the eigen3 installation 9 | # 10 | # This module will define the following variables: 11 | # HAVE_EIGEN3,EIGEN3_FOUND = Whether libraries and includes are found 12 | # Eigen3_INCLUDE_DIRS = Location of Gsl includes 13 | 14 | ###################################################################### 15 | # 16 | # FindEigen3: find includes for Eigen3 17 | # 18 | # $Id: FindSciEigen3.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | 26 | # Try to find an installation of eigen3 in the system include directory. 27 | find_path(Eigen3_SYS_DIR 28 | signature_of_eigen3_matrix_library 29 | PATHS "/usr/local/include/eigen3") 30 | if (NOT(${Eigen3_SYS_DIR} MATCHES Eigen3_SYS_DIR-NOTFOUND)) 31 | set(Eigen3_ROOT_DIR ${Eigen3_ROOT_DIR} ${Eigen3_SYS_DIR}) 32 | endif () 33 | 34 | SciFindPackage(PACKAGE "Eigen3" 35 | INSTALL_DIR "eigen3" 36 | INCLUDE_SUBDIRS include/eigen3 37 | HEADERS "Eigen/Core" 38 | ) 39 | 40 | if (EIGEN3_FOUND) 41 | message(STATUS "Found Eigen3") 42 | set(HAVE_EIGEN3 1 CACHE BOOL "Whether have Eigen3") 43 | else () 44 | message(STATUS "Did not find Eigen3. Use -DEIGEN3_DIR to specify the installation directory.") 45 | if (SciEigen3_FIND_REQUIRED) 46 | message(FATAL_ERROR "Failed.") 47 | endif () 48 | endif () 49 | 50 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNetcdf.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNetcdf: Module to find include directories and libraries 2 | # for Netcdf. This module was implemented as there is no stock 3 | # CMake module for Netcdf. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciNetcdf REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_NETCDF = Whether have the Netcdf library 10 | # Netcdf_INCLUDE_DIRS = Location of Netcdf includes 11 | # Netcdf_LIBRARY_DIRS = Location of Netcdf libraries 12 | # Netcdf_LIBRARIES = Required libraries 13 | # Netcdf_STLIBS = Location of Netcdf static library 14 | 15 | ###################################################################### 16 | # 17 | # SciFindNetcdf: find includes and libraries for Netcdf. 18 | # 19 | # $Id: FindSciNetcdf.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | set(desiredlibs netcdf) 28 | #if (CMAKE_Fortran_COMPILER_WORKS) 29 | # set(desiredlibs netcdff ${desiredlibs}) 30 | #endif () 31 | #if (CMAKE_CXX_COMPILER_WORKS) 32 | # set(desiredlibs netcdf_c++ ${desiredlibs}) 33 | #endif () 34 | 35 | SciFindPackage(PACKAGE "Netcdf" 36 | INSTALL_DIR ${NETCDF_BUILDS} 37 | HEADERS "netcdf.h" 38 | LIBRARIES ${desiredlibs} 39 | #MODULES "netcdf" 40 | ) 41 | 42 | if (NETCDF_FOUND) 43 | message(STATUS "Found Netcdf") 44 | set(HAVE_NETCDF 1 CACHE BOOL "Whether have the NETCDF library") 45 | else () 46 | message(STATUS "Did not find Netcdf. Use -DNETCDF_DIR to specify the installation directory.") 47 | if (SciNetcdf_FIND_REQUIRED) 48 | message(FATAL_ERROR "Failed.") 49 | endif () 50 | endif () 51 | 52 | -------------------------------------------------------------------------------- /source/HwigglerVar.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | module wigglerVar 6 | 7 | use globals 8 | use paratype 9 | use ParallelInfoType 10 | use lattice 11 | 12 | contains 13 | 14 | 15 | 16 | subroutine getAlpha(sZ) 17 | 18 | ! Calculates linear taper based on 19 | ! global variable undGrad 20 | 21 | real(kind=wp), intent(in) :: sZ 22 | 23 | ! Variables n2col, c2col0, undgrad and sz0 are 24 | ! global variables, and are defined elsewhere. 25 | 26 | ! if (sZ <= sZFS) then ! Work out wiggler ends and bounds??? 27 | ! e.g. ... (sZ <= sZFS) (sZ >= sZFE) 28 | 29 | 30 | ! n2col = n2col0 * (sin( (sZ - sZ0) / (16_wp * sRho_G) ))**2_wp 31 | 32 | ! else if (sZ >= sZFE) then 33 | 34 | ! n2col = n2col0 * cos( (sZ - sZFE) / (16_wp * sRho_G) )**2_wp 35 | 36 | ! else 37 | 38 | 39 | if ((sZ >= sZFS) .and. (sZ <= sZFE)) then 40 | 41 | n2col = n2col0 + undgrad*(sz - sZFS) ! linear taper 42 | 43 | else if (sZ > sZFE) then 44 | 45 | n2col0 = n2col 46 | 47 | end if 48 | 49 | ! end if 50 | 51 | 52 | 53 | end subroutine getAlpha 54 | 55 | 56 | 57 | ! subroutine getAlpha_end(sZ) 58 | 59 | ! ! Calculates linear taper based on 60 | ! ! global variable undGrad 61 | 62 | ! real(kind=wp), intent(in) :: sZ 63 | 64 | ! ! Variables n2col, c2col0, undgrad and sz0 are 65 | ! ! global variables, and are defined elsewhere. 66 | 67 | ! real(kind=wp) :: Nwt 68 | 69 | ! Nwt = 2.0_wp 70 | 71 | ! if (endType == iFront) then 72 | ! n2col = n2col0 * sin((sz-sz0) / 8.0_wp / sRho_G / Nwt)**2.0_wp 73 | ! else if (endType == iBack) 74 | ! n2col = n2col0 * sin((sz-sz0) / 8.0_wp / sRho_G / Nwt)**2.0_wp 75 | ! end if 76 | 77 | 78 | ! end subroutine getAlpha_end 79 | 80 | 81 | 82 | 83 | end module wigglerVar 84 | -------------------------------------------------------------------------------- /inputs/simple/1D/PREv64pp046503/fig4/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | &NBLIST 30 | nbeams = 1 31 | dtype = 'simple' 32 | / 33 | 34 | &BLIST 35 | sSigmaE =0.1, 0.1, 1E8, 1.0, 1.0, 1.0 36 | sLenE = 1E-6, 1E-6, 40.0, 1E-6, 1E-6, 1E-6 37 | iNumMPs = 1, 1, 16000, 1, 1, 1 38 | emitx = 1.0 39 | emity = 1.0 40 | sQe = 2.0E-9 41 | bcenter = 0.0 42 | gammaf = 1.0 43 | chirp = 0.0 44 | mag = 0.0 45 | fr = 1.0 46 | qRndEj_G = .false. 47 | sSigEj_G = 0.02 48 | qMatched_A = .false. 49 | qFixCharge = .true. 50 | / 51 | -------------------------------------------------------------------------------- /utilities/matlab/hdf5/ploth5SurfPow.m: -------------------------------------------------------------------------------- 1 | function hp = ploth5En(fname) 2 | 3 | fname = 'f1_main_aperp_30000.h5'; 4 | %pwsInfo = h5info(fname, '/power'); 5 | 6 | %numPZ2 = pwsInfo.Dataspace.Size; 7 | 8 | 9 | zbar = hdf5read(fname,'/aperp','zbarTotal'); 10 | rho = hdf5read(fname,'/runInfo','rho'); 11 | nZ2 = hdf5read(fname,'/runInfo','nZ2'); 12 | sLengthOfElmZ2 = hdf5read(fname,'/runInfo','sLengthOfElmZ2'); 13 | 14 | 15 | nZ2 = double(nZ2); 16 | lenZ2 = sLengthOfElmZ2 * (nZ2-1); 17 | Z2axis = linspace(0,lenZ2,nZ2); 18 | 19 | 20 | h = 6.626e-34; % Planck constant 21 | q_e = 1.60217646e-19; % Charge on electron 22 | c_0 = 2.99792458e8; % Speed of light in vacuum 23 | 24 | NumUniquePts = ceil((nZ2+1)/2); 25 | fs = (nZ2)/lenZ2; %sampling frequency 26 | 27 | 28 | 29 | dstep = 1500; 30 | nsteps = 60000; 31 | 32 | steps = 0:dstep:nsteps; 33 | 34 | % Get size of dataset 35 | 36 | 37 | 38 | %powers = zeros(size(steps)); 39 | 40 | ind = 0; 41 | for step = steps 42 | 43 | %hf = plotPow2(step,1); 44 | ind = ind+1; 45 | apcz2 = h5read(strcat('f1_main_aperp_', int2str(step), '.h5'), ... 46 | '/aperp'); 47 | 48 | 49 | xf = apcz2(:,1); 50 | yf = -apcz2(:,2); 51 | 52 | power(ind,:) = abs(xf).^2 + abs(yf).^2; 53 | 54 | 55 | % [magx phasex]=getStokesf(xf,nZ2,rho,lenZ2); 56 | 57 | % power(ind,:) = magx; 58 | power(ind,:) = power(ind,:) ./ max(power(ind,:)); 59 | 60 | %En(ind) = sum(power); 61 | %zbar(ind) = hdf5read(strcat('f1_main_integrated_', int2str(step), '.h5'), ... 62 | % '/power','zbarTotal'); 63 | 64 | end 65 | 66 | figure; hf = surf(power); 67 | %xlabel('zbar'); 68 | %ylabel('Energy (arb units)'); 69 | 70 | set(hf,'edgecolor','none'); 71 | 72 | shading interp; 73 | 74 | hf = get(get(hf,'parent'),'parent'); 75 | set(hf,'renderermode','man'); 76 | set(hf,'renderer','zbuffer'); 77 | view([0 90]); 78 | -------------------------------------------------------------------------------- /inputs/simple/1D/PREv64pp046503/fig4ROUNDH/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | &NBLIST 30 | nbeams = 1 31 | dtype = 'simple' 32 | / 33 | 34 | &BLIST 35 | sSigmaE =0.1, 0.1, 1E8, 1.0, 1.0, 1E-4 36 | sLenE = 1E-6, 1E-6, 40.0, 1E-6, 1E-6, 6E-4 37 | iNumMPs = 1, 1, 32000, 1, 1, 19 38 | emitx = 1.0 39 | emity = 1.0 40 | sQe = 2.0E-9 41 | bcenter = 0.0 42 | gammaf = 1.0 43 | chirp = 0.0 44 | mag = 0.0 45 | fr = 1.0 46 | qRndEj_G = .true. 47 | sSigEj_G = 1.0 48 | qMatched_A = .false. 49 | qFixCharge = .true. 50 | / 51 | -------------------------------------------------------------------------------- /inputs/simple/1D/PRSTABVv6pp070701/fig4/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | &NBLIST 30 | nbeams = 1 31 | dtype = 'simple' 32 | / 33 | 34 | &BLIST 35 | sSigmaE =0.1, 0.1, 1E8, 1.0, 1.0, 0.004 36 | sLenE = 1E-6, 1E-6, 6.0, 1E-6, 1E-6, 0.024 37 | iNumMPs = 1, 1, 2400, 1, 1, 9 38 | emitx = 1.0 39 | emity = 1.0 40 | sQe = 1.0E-9 41 | bcenter = 0.0 42 | gammaf = 1.0 43 | chirp = 0.0 44 | mag = 0.0 45 | fr = 1.0 46 | qRndEj_G = .false. 47 | sSigEj_G = 0.02 48 | qMatched_A = .false. 49 | qFixCharge = .true. 50 | / 51 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciCubit.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciCubit: Module to find include directories and 2 | # libraries for Cubit. 3 | # 4 | # Module usage: 5 | # find_package(SciCubit ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_CUBIT, CUBIT_FOUND = Whether libraries and includes are found 9 | # Cubit_INCLUDE_DIRS = Location of Cubit includes 10 | # Cubit_LIBRARY_DIRS = Location of Cubit libraries 11 | # Cubit_LIBRARIES = Required libraries 12 | 13 | ################################################################## 14 | # 15 | # Find module for CUBIT 16 | # 17 | # $Id: FindSciCubit.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ################################################################## 24 | 25 | set(Cubit_LIBRARY_LIST 26 | CMLTet 27 | SpacACIS 28 | cbtverdict 29 | cubit_geom 30 | cubit_util 31 | cubitgui 32 | cubiti19 33 | gtcAttrib 34 | libifcoremd 35 | libifportmd 36 | libmmd 37 | lpsolve55 38 | mesquite 39 | ) 40 | 41 | SciFindPackage( 42 | PACKAGE Cubit 43 | INSTALL_DIR cubit 44 | HEADERS CubitGUIInterface.hpp 45 | LIBRARIES "${Cubit_LIBRARY_LIST}" 46 | ) 47 | 48 | if (CUBIT_FOUND) 49 | message(STATUS "[FindSciCubit.cmake] - Found Cubit") 50 | message(STATUS "[FindSciCubit.cmake] - Cubit_INCLUDE_DIRS = ${Cubit_INCLUDE_DIRS}") 51 | message(STATUS "[FindSciCubit.cmake] - Cubit_LIBRARIES = ${Cubit_LIBRARIES}") 52 | set(HAVE_CUBIT 1 CACHE BOOL "Whether have Cubit.") 53 | else () 54 | message(STATUS "[FindSciCubit.cmake] - Did not find Cubit, use -DCUBIT_DIR to supply the CUBIT installation directory.") 55 | if (SciCubit_FIND_REQUIRED) 56 | message(FATAL_ERROR "[FindSciCubit.cmake] - Failing.") 57 | endif () 58 | endif () 59 | 60 | -------------------------------------------------------------------------------- /inputs/simple/1D/PREv64pp046503/fig4ROUNDP/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | &NBLIST 30 | nbeams = 1 31 | dtype = 'simple' 32 | / 33 | 34 | &BLIST 35 | sSigmaE =1.0, 1.0, 1E8, 1.0, 1.0, 1.0 36 | sLenE = 1E-6, 1E-6, 40.0, 1E-6, 1E-6, 1E-6 37 | iNumMPs = 1, 1, 32000, 1, 1, 1 38 | emitx = 1.0 39 | emity = 1.0 40 | sQe = 2.0E-9 41 | bcenter = 0.0 42 | gammaf = 1.0 43 | chirp = 0.0 44 | mag = 0.0 45 | fr = 1.0 46 | qRndEj_G = .true. 47 | sSigEj_G = 1.0 48 | qMatched_A = .false. 49 | qFixCharge = .true. 50 | / 51 | 52 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciNetcdff.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciNetcdff: Module to find include directories and libraries 2 | # for Netcdf-fortran. This module was implemented as there is no stock 3 | # CMake module for Netcdf fortran. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciNetcdf REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_NETCDF = Whether have the Netcdf library 10 | # Netcdff_INCLUDE_DIRS = Location of Netcdf includes 11 | # Netcdff_LIBRARY_DIRS = Location of Netcdf libraries 12 | # Netcdff_LIBRARIES = Required libraries 13 | # Netcdff_STLIBS = Location of Netcdf static library 14 | 15 | ###################################################################### 16 | # 17 | # SciFindNetcdf: find includes and libraries for Netcdf. 18 | # 19 | # $Id: FindSciNetcdff.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | if (NETCDF_BUILDS) 28 | set(instdirs ${NETCDF_BUILDS}) 29 | else () 30 | if (ENABLE_PARALLEL) 31 | set(instdirs netcdf-par) 32 | else () 33 | set(instdirs netcdf) 34 | endif () 35 | endif () 36 | 37 | set(desiredlibs netcdff netcdf) 38 | 39 | SciFindPackage(PACKAGE "Netcdf" 40 | INSTALL_DIR ${instdirs} 41 | HEADERS "netcdf.h" 42 | LIBRARIES ${desiredlibs} 43 | MODULES "netcdf" 44 | ) 45 | 46 | if (NETCDF_FOUND) 47 | message(STATUS "Found Netcdff") 48 | set(HAVE_NETCDF 1 CACHE BOOL "Whether have the NETCDFF library") 49 | else () 50 | message(STATUS "Did not find Netcdff. Use -DNETCDF_DIR to specify the installation directory.") 51 | if (SciNetcdf_FIND_REQUIRED) 52 | message(FATAL_ERROR "Failed.") 53 | endif () 54 | endif () 55 | 56 | -------------------------------------------------------------------------------- /inputs/simple/1D/2colour/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | 30 | &NBLIST 31 | nbeams = 1 32 | dtype = 'simple' 33 | / 34 | 35 | &BLIST 36 | sSigmaE =0.1, 0.1, 1E8, 1.0, 1.0, 1E8 37 | sLenE = 1E-6, 1E-6, 50.0, 1E-6, 1E-6, 1e-4 38 | iNumMPs = 1, 1, 73000, 1, 1, 1 39 | emitx = 6.75599500154485e-01 40 | emity = 6.75599500154485e-01 41 | sQe = 100E-12 42 | bcenter = 0.0 43 | gammaf = 1.0 44 | chirp = 0.0 45 | mag = 0.0 46 | fr = 1.0 47 | qRndEj_G = .true. 48 | sSigEj_G = 0.1 49 | qMatched_A = .false. 50 | qFixCharge=.true. 51 | / 52 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciPspline.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciPspline: Module to find include directories and libraries 2 | # for Pspline. This module was implemented as there is no stock 3 | # CMake module for Pspline. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciPspline REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_PSPLINE = Whether have the Pspline library 10 | # Pspline_INCLUDE_DIRS = Location of Pspline includes 11 | # Pspline_LIBRARY_DIRS = Location of Pspline libraries 12 | # Pspline_LIBRARIES = Required libraries 13 | # Pspline_STLIBS = Location of Pspline static library 14 | 15 | ###################################################################### 16 | # 17 | # FindSciPspline: find includes and libraries for pspline 18 | # 19 | # $Id: FindSciPspline.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | # 28 | # Note that there is a psplineImport that is a dynamic library used for 29 | # python. That should be in a separate search entirely because one 30 | # should generally not use it for linking (it grabs other libraries and 31 | # appends it in). 32 | # 33 | 34 | if (ENABLE_PARALLEL) 35 | set(instdir pspline-par) 36 | else () 37 | set(instdir pspline) 38 | endif () 39 | set(searchlibs "pspline") 40 | 41 | SciFindPackage(PACKAGE "Pspline" 42 | INSTALL_DIR "${instdir}" 43 | HEADERS "czspline_capi.h;transp_util.h;pspline_config.h" 44 | LIBRARIES ${searchlibs} 45 | LIBRARY_SUBDIRS "lib" 46 | ) 47 | 48 | set(PSPLINE_DIR ${Pspline_DIR}) 49 | if (PSPLINE_FOUND) 50 | # message(STATUS "Found Pspline") 51 | set(HAVE_PSPLINE 1 CACHE BOOL "Whether have the Pspline library") 52 | endif () 53 | -------------------------------------------------------------------------------- /inputs/simple/1D/2colour/wchicanes/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | 30 | &NBLIST 31 | nbeams = 1 32 | dtype = 'simple' 33 | / 34 | 35 | &BLIST 36 | sSigmaE =1.0, 1.0, 1E8, 1.0, 1.0, 1E8 37 | sLenE = 1E-6, 1E-6, 50.0, 1E-6, 1E-6, 1e-4 38 | iNumMPs = 1, 1, 73000, 1, 1, 1 39 | emitx = 6.75599500154485e-01 40 | emity = 6.75599500154485e-01 41 | sQe = 100E-12 42 | bcenter = 0.0 43 | gammaf = 1.0 44 | chirp = 0.0 45 | mag = 0.0 46 | fr = 1.0 47 | qRndEj_G = .true. 48 | sSigEj_G = 0.1 49 | qMatched_A = .false. 50 | qFixCharge=.true. 51 | / 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /inputs/simple/1D/2colour/wdrifts/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! freq - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | !======================================================================== 28 | 29 | 30 | &NBLIST 31 | nbeams = 1 32 | dtype = 'simple' 33 | / 34 | 35 | &BLIST 36 | sSigmaE =1.0, 1.0, 1E8, 1.0, 1.0, 1E8 37 | sLenE = 1E-6, 1E-6, 50.0, 1E-6, 1E-6, 1e-4 38 | iNumMPs = 1, 1, 73000, 1, 1, 1 39 | emitx = 6.75599500154485e-01 40 | emity = 6.75599500154485e-01 41 | sQe = 100E-12 42 | bcenter = 0.0 43 | gammaf = 1.0 44 | chirp = 0.0 45 | mag = 0.0 46 | fr = 1.0 47 | qRndEj_G = .true. 48 | sSigEj_G = 0.1 49 | qMatched_A = .false. 50 | qFixCharge=.true. 51 | / 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciTxPhysics.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciTxPhysics: Module to find include directories and 2 | # libraries for Physics. 3 | # 4 | # Module usage: 5 | # find_package(SciTxPhysics ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_TXPHYSICS, TXPHYSICS_FOUND = Whether libraries and includes are found 9 | # TxPhysics_INCLUDE_DIRS = Location of Physics includes 10 | # TxPhysics_LIBRARY_DIRS = Location of Physics libraries 11 | # TxPhysics_LIBRARIES = Required libraries 12 | 13 | ###################################################################### 14 | # 15 | # FindSciTxPhysics: find includes and libraries for txbase 16 | # 17 | # $Id: FindSciTxPhysics.cmake 792 2015-04-17 14:07:44Z jrobcary $ 18 | # 19 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 20 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 21 | # 22 | # 23 | ###################################################################### 24 | 25 | option(ENABLE_TXPHYSICS "Whether to enable TxPhysics" ON) 26 | if (WIN32) 27 | set(txphysics_statlib txphysics.lib) 28 | else () 29 | set(txphysics_statlib libtxphysics.a) 30 | endif () 31 | 32 | if (ENABLE_TXPHYSICS) 33 | if (HAVE_MPI) 34 | SciFindPackage(PACKAGE "TxPhysics" 35 | INSTALL_DIRS "txphysics-ben;txphysics" 36 | HEADERS "txphysics_version.h" 37 | LIBRARIES "${txphysics_statlib}" 38 | ) 39 | else () 40 | SciFindPackage(PACKAGE "TxPhysics" 41 | HEADERS "txphysics_version.h" 42 | LIBRARIES "${txphysics_statlib}" 43 | ) 44 | endif () 45 | endif () 46 | 47 | if (TXPHYSICS_FOUND) 48 | # message(STATUS "Found TxPhysics.") 49 | set(HAVE_TXPHYSICS 1 CACHE BOOL "Whether have the TxPhysics library") 50 | else () 51 | message(WARNING "Did not find TxPhysics. Use -DTXPHYSICS_DIR to specify the installation directory.") 52 | if (TxPhysics_FIND_REQUIRED) 53 | message(FATAL_ERROR "Failing.") 54 | endif () 55 | endif () 56 | 57 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciGeant4.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciGeant4: Module to find include directories and 2 | # libraries for Geant4. 3 | # 4 | # Module usage: 5 | # find_package(SciGeant4 ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_GEANT4, GEANT4_FOUND = Whether libraries and includes are found 9 | # Geant4_INCLUDE_DIRS = Location of Geant4 includes 10 | # Geant4_LIBRARY_DIRS = Location of Geant4 libraries 11 | # Geant4_LIBRARIES = Required libraries 12 | # Geant4_DLLS = 13 | 14 | ###################################################################### 15 | # 16 | # FindGeant4: find includes and libraries for hdf5 17 | # 18 | # $Id: FindSciGeant4.cmake 792 2015-04-17 14:07:44Z jrobcary $ 19 | # 20 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 21 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 22 | # 23 | # 24 | ###################################################################### 25 | 26 | set(Geant4_LIBRARY_LIST 27 | G4FR 28 | G4GMocren 29 | G4RayTracer 30 | G4Tree 31 | G4VRML 32 | G4analysis 33 | G4clhep 34 | G4digits_hits 35 | G4error_propagation 36 | G4event 37 | G4geometry 38 | G4global 39 | G4graphics_reps 40 | G4intercoms 41 | G4interfaces 42 | G4materials 43 | G4modeling 44 | G4parmodels 45 | G4particles 46 | G4persistency 47 | G4physicslists 48 | G4processes 49 | G4readout 50 | G4run 51 | G4track 52 | G4tracking 53 | G4visHepRep 54 | G4visXXX 55 | G4vis_management 56 | G4zlib 57 | ) 58 | 59 | # The below should be optional 60 | # G4OpenGL 61 | # G4gl2ps 62 | 63 | SciFindPackage( 64 | PACKAGE "Geant4" 65 | HEADERS "globals.hh" 66 | INCLUDE_SUBDIRS include/Geant4 67 | LIBRARIES ${Geant4_LIBRARY_LIST} 68 | ) 69 | 70 | if (GEANT4_FOUND) 71 | message(STATUS "Found Geant4") 72 | else () 73 | message(STATUS "Did not find Geant4. Use -DGeant4_ROOT_DIR to specify the installation directory.") 74 | endif () 75 | 76 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciTxBase.cmake: -------------------------------------------------------------------------------- 1 | # - FindTxBase: Module to find include directories and 2 | # libraries for TxBase. 3 | # 4 | # Module usage: 5 | # find_package(SciTxBase ...) 6 | # 7 | # This module will define the following variables: 8 | # HAVE_TXBASE, TXBASE_FOUND = Whether libraries and includes are found 9 | # TxBase_INCLUDE_DIRS = Location of TxBase includes 10 | # TxBase_LIBRARY_DIRS = Location of TxBase libraries 11 | # TxBase_LIBRARIES = Required libraries 12 | # 13 | # ========= ========= ========= ========= ========= ========= ========== 14 | # 15 | # Variables used by this module, which can be set before calling find_package 16 | # to influence default behavior 17 | # 18 | # TxBase_ROOT_DIR Specifies the root dir of the TxBase installation 19 | # 20 | 21 | ###################################################################### 22 | # 23 | # FindTxBase: find includes and libraries for txbase 24 | # 25 | # $Id: FindSciTxBase.cmake 792 2015-04-17 14:07:44Z jrobcary $ 26 | # 27 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 28 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 29 | # 30 | # 31 | ###################################################################### 32 | 33 | if (NOT_HAVE_STD_ABS_DOUBLE) 34 | set(txbasefindlibs txbase txstd) 35 | else () 36 | set(txbasefindlibs txbase) 37 | endif () 38 | 39 | SciGetInstSubdirs(txbase instdirs) 40 | 41 | SciFindPackage(PACKAGE "TxBase" 42 | INSTALL_DIRS ${instdirs} 43 | HEADERS "txbase_version.h" 44 | LIBRARIES "${txbasefindlibs}" 45 | LIBRARY_SUBDIRS lib/${CXX_COMP_LIB_SUBDIR} lib 46 | ) 47 | 48 | if (TXBASE_FOUND) 49 | # message(STATUS "Found TxBase.") 50 | set(HAVE_TXBASE 1 CACHE BOOL "Whether have TxBase library") 51 | else () 52 | message(STATUS "Did not find TxBase. Use -DTXBASE_ROOT_DIR to specify the installation directory.") 53 | if (SciTxBase_FIND_REQUIRED) 54 | message(FATAL_ERROR "Failed.") 55 | endif () 56 | endif () 57 | 58 | -------------------------------------------------------------------------------- /scimake/Modules/FindSciPlasmaState.cmake: -------------------------------------------------------------------------------- 1 | # - FindSciPlasmaState: Module to find include directories and libraries 2 | # for PlasmaState. This module was implemented as there is no stock 3 | # CMake module for PlasmaState. 4 | # 5 | # This module can be included in CMake builds in find_package: 6 | # find_package(SciPlasmaState REQUIRED) 7 | # 8 | # This module will define the following variables: 9 | # HAVE_PLASMASTATE = Whether have the PlasmaState library 10 | # PlasmaState_INCLUDE_DIRS = Location of PlasmaState includes 11 | # PlasmaState_LIBRARY_DIRS = Location of PlasmaState libraries 12 | # PlasmaState_LIBRARIES = Required libraries 13 | # PlasmaState_STLIBS = Location of PlasmaState static library 14 | 15 | ###################################################################### 16 | # 17 | # FindSciPlasmaState: find includes and libraries for PlasmaState 18 | # 19 | # $Id: FindSciPlasmaState.cmake 792 2015-04-17 14:07:44Z jrobcary $ 20 | # 21 | # Copyright 2010-2015, Tech-X Corporation, Boulder, CO. 22 | # See LICENSE file (EclipseLicense.txt) for conditions of use. 23 | # 24 | # 25 | ###################################################################### 26 | 27 | if (ENABLE_PARALLEL) 28 | set(instdir plasma_state-ben plasma_state) 29 | else () 30 | set(instdir plasma_state) 31 | endif () 32 | SciFindPackage(PACKAGE "PlasmaState" 33 | INSTALL_DIRS ${instdir} 34 | HEADERS state.h 35 | LIBRARIES PlasmaState 36 | ) 37 | 38 | set(PLASMASTATE_DIR ${PlasmaState_DIR}) 39 | if (PLASMASTATE_FOUND) 40 | message(STATUS "Found PlasmaState") 41 | message(STATUS "${PLASMASTATE_DIR} = ${PLASMASTATE_DIR}.") 42 | set(HAVE_PLASMASTATE 1 CACHE BOOL "Whether have the PlasmaState library") 43 | set(HAVE_PlasmaState 1 CACHE BOOL "Whether have the PlasmaState library") 44 | # Find gacodes 45 | include(${SCIMAKE_DIR}/SciGetDepsFromInstall.cmake) 46 | # Get dependencies 47 | #SciGetDepsFromInstall(NetlibLite ${PLASMASTATE_DIR} NETLIB_LITE) 48 | endif () 49 | 50 | -------------------------------------------------------------------------------- /source/noise.f90: -------------------------------------------------------------------------------- 1 | ! Copyright 2012-2018, University of Strathclyde 2 | ! Authors: Lawrence T. Campbell 3 | ! License: BSD-3-Clause 4 | 5 | !> @author 6 | !> Lawrence Campbell, 7 | !> University of Strathclyde, 8 | !> Glasgow, UK 9 | !> @brief 10 | !> Module to apply noise to macroparticle positions in one dimension. 11 | 12 | MODULE addNoise 13 | 14 | use paratype 15 | use randomGauss 16 | use parallelInfoType 17 | use macrosGen 18 | 19 | implicit none 20 | 21 | contains 22 | 23 | 24 | subroutine applyNoise(x,dx,Nks) 25 | 26 | ! This routine adds noise to the macroparticle 27 | ! weight and phase space coordinate in each 28 | ! dimension. 29 | 30 | implicit none 31 | 32 | ! ARGUMENTS 33 | 34 | real(kind=wp), intent(inout) :: x(:), Nks(:) 35 | real(kind=wp), intent(in) :: dx 36 | 37 | ! LOCAL ARGS 38 | 39 | real(kind=wp) :: u 40 | real(kind=wp) :: sv 41 | integer(kind=ipl) :: k, Nm 42 | 43 | 44 | Nm = size(x) 45 | 46 | call init_random_seed() 47 | 48 | do k = 1,Nm 49 | 50 | sv = Nks(k) 51 | Nks(k) = random_Poisson(Nks(k), .TRUE.) 52 | if (Nks(k) <= 0.0_wp) then 53 | Nks(k) = sv 54 | else 55 | x(k) = addxDev(x(k), dx, Nks(k), u) 56 | end if 57 | 58 | end do 59 | 60 | end subroutine applyNoise 61 | 62 | 63 | 64 | function addxDev(x,dx,Nk,u) 65 | 66 | ! This function adds on a random deviation to 67 | ! the coordinate x, based on Poisson stats and 68 | ! it's weight Nk (which is the number of 69 | ! macroparticles it represents). 70 | 71 | implicit none 72 | 73 | ! ARGUMENTS 74 | 75 | real(kind=wp), intent(in) :: x, dx, Nk 76 | real(kind=wp), intent(out) :: u 77 | real(kind=wp) :: addxDev 78 | 79 | ! LOCAL ARGS 80 | 81 | real(kind=wp) :: randomNum 82 | 83 | randomNum = RandomNoGenerator(u) 84 | addxDev = x + (randomNum - 0.5_WP) * dx / SQRT(Nk) 85 | 86 | end function addxDev 87 | 88 | 89 | 90 | !!!!!!!!!!!!!!!!!!!!!! 91 | 92 | END MODULE addNoise -------------------------------------------------------------------------------- /inputs/simple/3D/LCLS/lcls.beam: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumElectrons - Number of macroparticles in each dimension used to model the beam 18 | ! sEmit_n - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! fr - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | ! TrLdMeth - Beam loading method in 5D transverse and energy planes: 28 | ! TrLdMeth = 1 for random sequences (default) 29 | ! TrLdMeth = 2 for Halton sequences 30 | !======================================================================== 31 | 32 | &NBLIST 33 | nbeams = 1 34 | dtype = 'simple' 35 | / 36 | 37 | &BLIST 38 | sSigmaE = 18.38e-6, 13.91e-6, 1E8, 0.02, 0.02, 0.0001 39 | iMPsZ2PerWave = 4 40 | nseqparts = 2000 41 | Ipk = 3e3 ! 3 kA 42 | emitx = 1.4981e-11 ! geometric emittances... 43 | emity = 1.4981e-11 44 | qRndEj_G = .false. 45 | alphax = 0.0 ! Twiss params... 46 | alphay = 0.0 47 | TrLdMeth = 2 48 | / 49 | 50 | -------------------------------------------------------------------------------- /inputs/simple/3D/diffraction/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! fr - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | ! TrLdMeth - Beam loading method in 5D transverse and energy planes: 28 | ! TrLdMeth = 1 for random sequences (default) 29 | ! TrLdMeth = 2 for Halton sequences 30 | !======================================================================== 31 | 32 | &NBLIST 33 | nbeams = 1 34 | dtype = 'simple' 35 | / 36 | 37 | &BLIST 38 | sSigmaE =1.0, 1.0, 1E8, 1.0, 1.0, 0.001 39 | sLenE = 1E-6, 1E-6, 10.0, 1E-6, 1E-6, 0.006 40 | iNumMPs = 7, 7, 2050, 7, 7, 7 41 | emitx = 1.0 42 | emity = 1.0 43 | sQe = 1.774e-10 44 | bcenter = 0.0 45 | gammaf = 1.0 46 | qRndEj_G = .true. 47 | sSigEj_G = 0.2 48 | qMatched_A = .true. 49 | TrLdMeth = 2 50 | / 51 | -------------------------------------------------------------------------------- /inputs/simple/3D/shortCSE/beam_file.in: -------------------------------------------------------------------------------- 1 | ! PUFFIN BEAM FILE 2 | ! 3 | !Describes electron beams for input into puffin. Multiple beams with 4 | !different parameters can be used. Please refer to POP-REF for an 5 | !explanation of the scaled variables used, such as z2 and p2. 6 | ! 7 | ! BEAM PARAMETERS - namelist NBLIST 8 | ! 9 | ! nbeams - number of electron beams 10 | ! dtype - Input type - simple, distribution, or macroparticle 11 | ! 12 | ! BEAM PARAMETERS - namelist BLIST 13 | !======================================================================== 14 | ! sSigmaE - gaussian std dev in each dimension - x, y, z2, px, py, gamma, then for additional beams 15 | ! sLenE - Total length of beam modelled in each dimension - x, y, z2, px, py, gamma... 16 | ! bcenter - Center of beam in z2 17 | ! iNumMPs - Number of macroparticles in each dimension used to model the beam 18 | ! emitx, emity - Scaled transverse beam emittance 19 | ! sQe - Beam charge 20 | ! gammaf - Ratio of average beam energy to reference beam energy gamma / gamma_r 21 | ! chirp - Energy chirp in z2 i.e. dgamma/dz2 22 | ! mag - magnitude of energy oscillation on beam 23 | ! fr - frequency in z2 of beam energy oscillation 24 | ! qRndEj_G - Round edge of flat top? 25 | ! sSigEj_G - Gaussian sigma of tail-off if used 26 | ! qMatched_A - Automatically match beam to focusing channel?? 27 | ! TrLdMeth - Beam loading method in 5D transverse and energy planes: 28 | ! TrLdMeth = 1 for random sequences (default) 29 | ! TrLdMeth = 2 for Halton sequences 30 | !======================================================================== 31 | 32 | &NBLIST 33 | nbeams = 1 34 | dtype = 'simple' 35 | / 36 | 37 | &BLIST 38 | sSigmaE =1.0, 1.0, 0.222, 1.0, 1.0, 0.001 39 | sLenE = 1E-6, 1E-6, 2.0, 1E-6, 1E-6, 0.006 40 | iNumMPs = 7, 7, 400, 7, 7, 7 41 | emitx = 1.0 42 | emity = 1.0 43 | sQe = 3.5908E-11 44 | bcenter = 0.0 45 | gammaf = 1.0 46 | qRndEj_G = .false. 47 | sSigEj_G = 0.06 48 | qMatched_A = .true. 49 | TrLdMeth = 2 50 | / 51 | --------------------------------------------------------------------------------