Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pslocum committed Aug 24, 2023
2 parents f169dd9 + ae30032 commit 6e08836
Show file tree
Hide file tree
Showing 30 changed files with 641 additions and 293 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required( VERSION 3.1 )

# Define the project
cmake_policy( SET CMP0048 NEW ) # version in project()
project( locust_mc VERSION 2.3.3)
project( locust_mc VERSION 2.5.0)


list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake )
Expand Down
5 changes: 3 additions & 2 deletions Config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ set (EXAMPLE_CONFIGFILES
${CMAKE_CURRENT_BINARY_DIR}/JustKassFieldMap.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_Waveguide_Template.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_FreeSpace_Template.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_Cavity_CCA.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_Cavity_1GHz.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_Cavity_CCA.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustKass_Cavity_1GHz.xml
FreeSpaceGeometry.xml
CavityGeometry_VTinyCoil.xml
CavityGeometry_V00_00_00.xml
WaveguideGeometry_VTinyCoil.xml
${CMAKE_CURRENT_BINARY_DIR}/LocustWaveguideTemplate.json
${CMAKE_CURRENT_BINARY_DIR}/LocustCavityCCA.json
Expand Down
140 changes: 140 additions & 0 deletions Config/CavityGeometry_V00_00_00.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<define name="magnetic_field_scale" value="3200"/>


<define name="start_coil_windings" value="4"/>
<!-- <define name="start_coil_z_position" value="0.0"/> -->
<define name="start_coil_z_position" value="-2.45"/>
<define name="start_coil_radius" value="0.6"/>
<define name="start_coil_length" value="0.1"/>
<define name="start_coil_current" value="{0.7 * [magnetic_field_scale] * [start_coil_windings]}"/>

<define name="background_coil_windings" value="190"/>
<!-- <define name="background_coil_z_position" value="0.1"/> -->
<define name="background_coil_z_position" value="-2.35"/>
<define name="background_coil_radius" value="0.4"/>
<define name="background_coil_length" value="{4.8}"/>
<define name="background_coil_current" value="{0.25 * [magnetic_field_scale]* [background_coil_windings]}"/>

<define name="end_coil_windings" value="4"/>
<!-- <define name="end_coil_z_position" value="4.9"/> -->
<define name="end_coil_z_position" value="2.45"/>
<define name="end_coil_radius" value="0.6"/>
<define name="end_coil_length" value="0.1"/>
<define name="end_coil_current" value="{0.7 * [magnetic_field_scale] * [end_coil_windings]}"/>

<define name="pinch1_coil_windings" value="1"/>
<!-- <define name="pinch1_coil_z_position" value="1.0"/> -->
<define name="pinch1_coil_z_position" value="-1.45"/>
<define name="pinch1_coil_radius" value="0.4"/>
<define name="pinch1_coil_length" value="0.025"/>
<define name="pinch1_coil_current" value="{0.15 * [magnetic_field_scale]* [pinch1_coil_windings]}"/>


<define name="pinch2_coil_windings" value="1"/>
<!-- <define name="pinch2_coil_z_position" value="4.0"/> -->
<define name="pinch2_coil_z_position" value="1.55"/>
<define name="pinch2_coil_radius" value="0.4"/>
<define name="pinch2_coil_length" value="0.025"/>
<define name="pinch2_coil_current" value="{0.15 * [magnetic_field_scale]* [pinch2_coil_windings]}"/>

<print name="pinch2_coil_current" value="[pinch2_coil_current]"/>
<print name="pinch1_coil_current" value="[pinch1_coil_current]"/>

<external_define name="max_step_length" value="0.1"/><!-- max. length of each step during tracking -->

<geometry>



<!-- solenoids -->

<tag name="magnet_tag" name="solenoid_tag" name="background_solenoid_tag">
<cylinder_tube_space name="background_solenoid_space" z1="[background_coil_z_position]" z2="{[background_coil_length] + [background_coil_z_position]}" r1="{[background_coil_radius]}" r2="{[background_coil_radius] + 0.005}" radial_mesh_count="300"/>
</tag>


<tag name="magnet_tag" name="solenoid_tag" name="pinch1_solenoid_tag">
<cylinder_tube_space name="pinch1_solenoid_space" z1="{[pinch1_coil_z_position] - [pinch1_coil_length]/2}" z2="{[pinch1_coil_z_position] + [pinch1_coil_length]/2}" r1="{[pinch1_coil_radius]}" r2="{[pinch1_coil_radius] + 0.005}" radial_mesh_count="300"/>
</tag>

<tag name="magnet_tag" name="solenoid_tag" name="pinch2_solenoid_tag">
<cylinder_tube_space name="pinch2_solenoid_space" z1="{[pinch2_coil_z_position] - [pinch2_coil_length]/2}" z2="{[pinch2_coil_z_position] + [pinch2_coil_length]/2}" r1="{[pinch2_coil_radius]}" r2="{[pinch2_coil_radius] + 0.005}" radial_mesh_count="300"/>
</tag>


<tag name="magnet_tag" name="solenoid_tag" name="start_solenoid_tag">
<cylinder_tube_space name="start_solenoid_space" z1="{[start_coil_z_position]}" z2="{[start_coil_z_position] + [start_coil_length]}" r1="{[start_coil_radius]}" r2="{[start_coil_radius] + 0.005}" radial_mesh_count="300"/>
</tag>
<tag name="magnet_tag" name="solenoid_tag" name="end_solenoid_tag">
<cylinder_tube_space name="end_solenoid_space" z1="{[end_coil_z_position]}" z2="{[end_coil_z_position] + [end_coil_length]}" r1="{[end_coil_radius]}" r2="{[end_coil_radius] + 0.005}" radial_mesh_count="300"/>
</tag>


<space name="project8_assembly">
<space name="background_solenoid" node="background_solenoid_space"/>
<space name="pinch1_solenoid" node="pinch1_solenoid_space"/>
<space name="pinch2_solenoid" node="pinch2_solenoid_space"/>
<space name="start_solenoid" node="start_solenoid_space"/>
<space name="end_solenoid" node="end_solenoid_space"/>
</space>

<!-- world -->
<!--
<cylinder_space name="world_space" z1="-200.0e-3" z2="200.0e-3" r="200.0e-3"/>
-->
<cylinder_space name="world_space" z1="-100.0" z2="100.0" r="20.0"/>
<space name="world" node="world_space">
<space name="project8" tree="project8_assembly">
<transformation rotation_axis_angle="0. 90. 90."/>
</space>
</space>

<electromagnet name="electromagnet_background_solenoid" spaces="world/project8/@background_solenoid_tag" current="[background_coil_current]"/>

<electromagnet name="electromagnet_pinch1_solenoid" spaces="world/project8/@pinch1_solenoid_tag" current="[pinch1_coil_current]"/>
<electromagnet name="electromagnet_pinch2_solenoid" spaces="world/project8/@pinch2_solenoid_tag" current="[pinch2_coil_current]"/>
<electromagnet name="electromagnet_pinch2_solenoid" spaces="world/project8/@start_solenoid_tag" current="[start_coil_current]"/>
<electromagnet name="electromagnet_pinch2_solenoid" spaces="world/project8/@end_solenoid_tag" current="[end_coil_current]"/>


</geometry>

<kemfield>

<!-- magnetic fields -->

<electromagnet_field
name="field_electromagnet"
directory="[KEMFIELD_CACHE]"
file="CavityMagnets.kbd"
system="world/project8"
spaces="world/project8/@solenoid_tag"
>
<zonal_harmonic_field_solver
number_of_bifurcations="-1"
convergence_ratio=".99"
convergence_parameter="1.e-15"
proximity_to_sourcepoint="1.e-12"
number_of_central_coefficients="500"
use_fractional_central_sourcepoint_spacing="true"
central_sourcepoint_fractional_distance="1e-2"
central_sourcepoint_spacing="2.e-5"
number_of_remote_coefficients="200"
remote_sourcepoint_start="-1.e-1"
remote_sourcepoint_end="1.e-1"
/>
</electromagnet_field>


<magnetic_superposition_field
name="total_magnetic_field"
use_caching="false"
>
<!-- <add_field name="background_field" enhancement="1.0" /> -->
<add_field name="field_electromagnet" enhancement="1.0" />
</magnetic_superposition_field>



</kemfield>

6 changes: 5 additions & 1 deletion Config/LocustWaveguideTemplate.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@

"cavity-signal":
{
"rectangular-waveguide": true,
"rectangular-waveguide": true,
"direct-kass-power": false,
"tf-receiver-filename": "${CMAKE_INSTALL_PREFIX}/data/WEGA_Impedance_Center.txt",
"tf-receiver-bin-width": 0.01e9,
"transmitter": "kass-current",
"waveguide-x": 0.010668,
"waveguide-y": 0.004318,
"waveguide-y": 10.0,
"center-to-short": 0.05,
"center-to-antenna": 0.05,
"waveguide-central-frequency": 1.63e11,
Expand Down
45 changes: 15 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# locust_mc

locust_mc is a monte carlo simulation package of the receiver chain for Project 8.
locust_mc is a monte carlo simulation package for simulating RF signals.

### Instructions For Use:

Once locust is installed and added to your path (see Installing in Section #4), it runs and is typically configured on the command line as:
After installation, Locust runs on the command line as
```
$ LocustSim config=/path/to/config/LocustConfigFile.json
```
Expand Down Expand Up @@ -61,7 +61,7 @@ Installation

### Installing

The following steps will build locust from scratch. In the terminal:
The following steps will build locust from source. In the terminal:

1. Clone the repository and make a build directory as recommended above. You will also have to initialize the submodules.
```
Expand All @@ -75,21 +75,14 @@ The following steps will build locust from scratch. In the terminal:

```
$ cd build
$ ccmake ..
$ ccmake ../
```

You will be prompted to press [c] to configure, and the window will fill up with several options.
You will be prompted to press [c] to configure, and the window will fill up with a list of options.

You should set the CMake variable `CMAKE_BUILD_TYPE` to either `RELEASE`, `STANDARD`, or `DEBUG` (default), in order
of how much text output you would like (from least to most) and how much compiler optimization
should be performed (from most to least).
To build with Locust with Kassiopeia, set ```locust_mc_BUILD_WITH_KASSIOPEIA``` to ```ON```. To generate unit test executables, set ```locust_mc_ENABLE_TESTING``` to ON. System-dependent compiler flags can be adjusted in the field ```USE_CPPxx```.

The install prefix is specified by the CMake variable `CMAKE_INSTALL_PREFIX`.
The library, binaries, and header files will be installed in the
lib, bin, and include subdirectories. The default install prefix is the
build directory.

After you've finished, if you've changed anything press [c] again to configure. Then [g] to generate and exit.
After you've finished, if you've changed anything press [c] again to configure. Then [g] to generate and exit.

3. Build and install.

Expand All @@ -113,50 +106,42 @@ The following steps will build locust from scratch. In the terminal:
### Exit codes
When running Locust with Kassiopeia in a shared cluster environment, 2 CPUs may be required unless hyperthreading is enabled on the cluster. If the level of activity on the cluster is high, thread signals between the separate CPUs can occasionally be missed and an exception will be thrown. Locust terminates with an integer exception in these three cases:
Locust terminates with an integer exception in the following case:
* ```exit(1)``` if the digitizer range was saturated.
* ```exit(2)``` if the Kassiopeia thread did not start.
* ```exit(3)``` if a digitizer sample was skipped.
Immediately after Locust has finished, the exit status can be checked from a bash prompt with ```echo #?```. If the returned value is zero, then no exception was thrown. Returned values of ```1```, ```2```, or ```3``` correspond to the exceptions above. Output egg files are not written if an exception is thrown. Exit codes ```2``` or ```3``` can typically be immediately requeued. An exit code of ```1``` should be either reconfigured to unsaturate the digitizer, or if the digitizer does not appear saturated, reported as an issue.
Immediately after Locust has finished, the exit status can be checked from a bash prompt with ```echo #?```. If the returned value is zero, then no exception was thrown. A returned value of ```1``` corresponds to the exception above. Output egg files are not written if an exception is thrown.
### Docker container
* A Docker container with Locust is available at https://hub.docker.com/r/project8/locust_mc
* A Docker container with Locust is available at ```ghcr.io/project8/locust_mc:v2.4.0``` .
* This Docker container can be used with Docker (with superuser privileges).
* Pull the container to your system with
```
> sudo docker pull project8/locust_mc
> sudo docker pull ghcr.io/project8/locust_mc:v2.4.0
```
Open a shell inside the container with
```
> sudo docker run --rm -it project8/locust_mc /bin/bash
> sudo docker run --rm -it ghcr.io/project8/locust_mc:v2.4.0 /bin/bash
```
* The Docker container can also be used with Singularity (as a regular user without sudo).
Pull the container to your system with
```
> singularity pull docker://project8/locust_mc
> singularity pull docker://ghcr.io/project8/locust_mc:v2.4.0
```
Open a shell inside the container with
```
> singularity shell /path/to/local/sif/locust-latest.sif
```
or to avoid mounting the $HOME directory
> singularity shell /path/to/local/sif/[nameOfContainer].sif
```
> singularity shell --no-home /path/to/local/sif/locust-latest.sif
```
and to mount a local directory for e.g. I/O to the container
```
> singularity shell --no-home --bind /path/to/local/directory:/usr/local/p8/locust/v2.1.5/output ./locust_mc_latest.sif
> singularity shell --no-home --bind /path/to/local/directory:/usr/local/p8/locust/v2.1.5/output ./[nameOfContainer].sif
```
Expand Down
Loading

0 comments on commit 6e08836

Please sign in to comment.