Skip to content

Commit

Permalink
Merge pull request #60 from JoeyDelp/testing
Browse files Browse the repository at this point in the history
v2.6 Update
  • Loading branch information
JoeyDelp authored Dec 15, 2021
2 parents 4f45e04 + 4e13cb7 commit 340219e
Show file tree
Hide file tree
Showing 40 changed files with 799 additions and 532 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(JoSIM VERSION 2.5.8)
project(JoSIM VERSION 2.6)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# JoSIM
### Superconductor Circuit Simulator

##### Testing: v2.5.8 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoSIM-CI-Devel?branchName=testing)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=1&branchName=testing)
##### Testing: v2.6 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoSIM-CI-Devel?branchName=testing)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=1&branchName=testing)

##### Stable: v2.5.8 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoeyDelp.JoSIM?branchName=master)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=3&branchName=master)
##### Stable: v2.6 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoeyDelp.JoSIM?branchName=master)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=3&branchName=master)

---

Expand Down Expand Up @@ -35,6 +35,11 @@ Referencing:
---

## Changelog
### v2.6
- Full Johnson-Nyquist temperature noise for Resistors and Resistive branch of RCSJ model
- Phi-junction model with verified Pi junction results
- Various bug fixes and code clean up

### v2.5.8
- Updated KLU to a 64-bit version capable of handling non-zero count larger than the maximum value of a 32-bit integer.
- Included SuperLU 64-bit that can be activated using the *-x 1* switch (default 0 for KLU).
Expand Down
Binary file modified docs/img/josim_help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/josim_jtl_ex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Developers Manual for v2.5.1

## Project Status

### Testing: v2.5.1 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoSIM-CI-Devel?branchName=testing)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=1&branchName=testing)
### Testing: v2.6 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoSIM-CI-Devel?branchName=testing)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=1&branchName=testing)

### Stable: v2.5.1 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoeyDelp.JoSIM?branchName=master)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=3&branchName=master)
### Stable: v2.6 - Status: [![Build Status](https://joeydelp.visualstudio.com/JoSIM/_apis/build/status/JoeyDelp.JoSIM?branchName=master)](https://joeydelp.visualstudio.com/JoSIM/_build/latest?definitionId=3&branchName=master)

## Introduction

Expand Down
14 changes: 11 additions & 3 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,16 @@ The value of a capacitor is in Farad.

### Josephson Junction (JJ)

**B**Label&emsp;$N^{+}$&emsp;$N^{-}$&emsp;*<PhaseNode\>*&emsp;**MODEL**&emsp;[area=<**AREA**\>]&emsp;[ic=<**IC**>]
**B**Label&emsp;$N^{+}$&emsp;$N^{-}$&emsp;*<PhaseNode\>*&emsp;**MODEL**&emsp;[area=<**AREA**\>]&emsp;[ic=<**IC**>]&emsp;[temp=<**TEMP**>]&emsp;[neb=<**FREQ**>]

A Josephson junction is a two terminal device but could also be defined with a third non-connected node to allow compatibility with WRspice. This node is not used in any way in JoSIM.

The Josephson junction requires specification of a model name which can be defined anywhere in the program using the control **.MODEL**.

When **AREA** or **IC** is not specified then an area=1 is used as default.

The temp and neb commands have the same descriptions as for the resistor.

#### Model

This model control has the following syntax
Expand All @@ -96,12 +98,14 @@ The only junction model currently supported by JoSIM is the RCSJ model and thus
| DELV | 0, $\infty$ | 0.1E-3 | Transitional voltage from subgap to normal |
| D | 0.0, 1 | 0.0 | Point of contact transparency affecting current phase relationship |
| ICFCT or ICFACT | 0, 1 | $\frac{\pi}{4}$ | Ratio of critical current to quasiparticle step height |
| PHI | 0, $\pi$ | 0 | Starting phase of junction |
| PHI | 0, $2\pi$ | 0 | Allows phi-junction capability such as the $\pi$-junction. |

The *.model* line is unique to the subcircuit it falls under and can thus allow different models with the same name under separate subcircuits. If the model is not found under the subcircuit it will be searched for globally and if not found default values (default model) will be used instead.

The **AREA** and **IC** parameters act as modifiers to the model parameters. **AREA** is a critical current multiplier, where if **IC** is specified it replaces the **AREA** value by $AREA=\frac{IC_{jj}}{IC_{model}}$.

By setting the **PHI** parameter of the model, the phase value is persistantly subtracted from the phase ($\phi$) in the $\sin(\phi)$ part of the JJ current. This allows elements such as the $\pi$-junction to be modeled.

### Transmission Line

**T**Label&emsp;$N^{+}_{1}$&emsp;$N^{-}_{1}$&emsp;$N^{+}_{2}$&emsp;$N^{-}_{2}$&emsp;**TD=VALUE**&emsp;**Z0=VALUE**
Expand Down Expand Up @@ -247,12 +251,14 @@ The most important of these control commands is the transient simulation command

### Transient Analysis

**.tran**&emsp;$T_{STEP}$&emsp;$T_{STOP}$&emsp;[$P_{START}$&emsp;[$P_{STEP}$]]
**.tran**&emsp;$T_{STEP}$&emsp;$T_{STOP}$&emsp;[$P_{START}$&emsp;[$P_{STEP}$]]&emsp;DST

This generates a simulation that runs from 0 until $T_{STOP}$. The amount simulation steps that will be performed is $n=\frac{T_{STOP}}{T_{STEP}}$.

$P_{START}$ indicates at what point output will start printing. $P_{STEP}$ sets the size of the print steps. This has to be larger or equal to $T_{STEP}$.

DST disables the start-up time. The start-up time is a period calculated internally by the simulator in which components settle. This is equivalent to the few picoseconds from when a circuit initially receives power (power switch flipped).

### Subcircuits

Subcircuits allow subdivision and reuse of smaller circuits within a larger design. When wrapped in a subcircuit control devices are allowed to have the same label names as specified elsewhere in the netlist as the subcircuit completely isolates them.
Expand All @@ -273,6 +279,8 @@ A subcircuit can be used in the main netlist or another subcircuit (nesting) usi

**X**Label&emsp;*IO Nodes*&emsp;*SubcktName*&emsp;(WRspice (normal SPICE) mode)

Additionally, keywords in the form of **LABEL=VALUE** can be appended to the end of the subcircuit declaration line which when instantiated will replace the value of the **LABEL** component within the subcircuit with the associated **VALUE**. This allows for unique subcircuit instantiations which would prove useful in testing various parameters without altering the original subcircuit or having multiple instances of the same subcircuit definition. This could open the door for potential future margin and optimization software.

### Noise

As mentioned in the technical discussion, noise can be automatically inserted as current sources in parallel to each resistor. This thermal noise temperature and bandwidth can be specified globally using the following commands:
Expand Down
4 changes: 4 additions & 0 deletions docs/tech_disc.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ This enables different levels of verbosity by the simulator. Level `1` verbosity

Only displays the version string for **josim-cli** and then exits. This string is always displayed by default for any command. This command, however, only displays the version string.

### Solver (-x):

This option allows switching between LU solvers. Default is KLU solver. Setting this to `1` enables SuperLU solver.

## Parse Input {#parse-input}

The input data received through any of the two means above is parsed in the following steps:
Expand Down
2 changes: 1 addition & 1 deletion include/JoSIM/BasicComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace JoSIM {
class IndexInfo {
public:
int_o posIndex_, negIndex_, currentIndex_;
NodeConfig nodeConfig_;
NodeConfig nodeConfig_ = NodeConfig::GND;
};

class MatrixInfo {
Expand Down
7 changes: 4 additions & 3 deletions include/JoSIM/Errors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace JoSIM {
MISSING_MAIN,
UNKNOWN_SUBCKT,
EMPTY_FILE,
IO_MISMATCH,
UNKNOWN_CONTROL
};

Expand Down Expand Up @@ -188,10 +189,10 @@ namespace JoSIM {
static void control_errors(
ControlErrors errorCode, string_o message = std::nullopt);

[[noreturn]] static void model_errors(
static void model_errors(
ModelErrors errorCode, string_o message = std::nullopt);

static void matrix_errors(
[[noreturn]] static void matrix_errors(
MatrixErrors errorCode, string_o message = std::nullopt);

[[noreturn]] static void misc_errors(
Expand All @@ -209,7 +210,7 @@ namespace JoSIM {
static void output_errors(
OutputErrors errorCode, string_o message = std::nullopt);

static void netlist_errors(
[[noreturn]] static void netlist_errors(
NetlistErrors errorCode, string_o message = std::nullopt);

static void verbosity_errors(
Expand Down
7 changes: 7 additions & 0 deletions include/JoSIM/Function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace JoSIM {
FunctionType fType_ = FunctionType::PWL;
std::vector<double> timeValues_;
std::vector<double> ampValues_;
std::vector<double> miscValues_;
void parse_pwl(const tokens_t& t, const Input& iObj, const string_o& s);
void parse_pulse(const tokens_t& t, const Input& iObj, const string_o& s);
void parse_sin(const tokens_t& t, const Input& iObj, const string_o& s);
Expand All @@ -46,6 +47,12 @@ namespace JoSIM {
const string_o& subckt);
double value(double x);
void ampValues(std::vector<double> values);
std::vector<double> ampValues() {
return ampValues_;
}
void clearMisc() {
miscValues_.clear();
}

}; // class Function

Expand Down
7 changes: 4 additions & 3 deletions include/JoSIM/Input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ namespace JoSIM {
public:
Netlist netlist;
Transient transSim;
std::optional<double> globalTemp, neB;
std::optional<double> globalTemp;
double neB = 1E12;
std::vector<tokens_t> fileLines, controls;
std::vector<std::string> relevantX;
std::unordered_map<ParameterName, Parameter> parameters;
std::optional<OutputFile> cli_output_file;
std::vector<OutputFile> output_files;
std::optional<std::string> fileParentPath;

Input() {};
Input(CliOptions& cli_options) {
Input() : netlist(*this) {};
Input(CliOptions& cli_options) : netlist(*this) {
argAnal = cli_options.analysis_type;
argVerb = cli_options.verbose;
argMin = cli_options.minimal;
Expand Down
12 changes: 6 additions & 6 deletions include/JoSIM/JJ.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "JoSIM/AnalysisType.hpp"
#include "JoSIM/Input.hpp"
#include "JoSIM/Spread.hpp"
#include "JoSIM/Function.hpp"

#include <vector>
#include <unordered_map>
Expand Down Expand Up @@ -54,16 +55,17 @@ namespace JoSIM {
public:
int variableIndex_ = 0;
double area_ = 1.0;
std::optional<double> Ic_;
std::optional<Model> model_;
std::optional<double> Ic_, temp_, neb_, spAmp_;
Model model_;
double phaseConst_ = 0.0;
double lowerB_ = 0.0, upperB_ = 0.0, gLarge_ = 0.0;
double del0_ = 0.0, del_ = 0.0, rncalc_ = 0.0;
double del0_ = 0.0, del_ = 0.0;
double pn1_ = 0.0, pn2_ = pn1_, pn3_ = pn2_, pn4_ = pn3_, phi0_ = 0.0;
double vn1_ = 0.0, vn2_ = vn1_, vn3_ = vn2_, vn4_ = vn3_, vn5_ = vn4_,
vn6_ = vn5_;
double transitionCurrent_ = 0.0;
double it_ = 0.0;
JoSIM::AnalysisType at_;
std::optional<Function> thermalNoise;

JJ(
const std::pair<tokens_t, string_o>& s, const NodeConfig& ncon,
Expand All @@ -82,8 +84,6 @@ namespace JoSIM {

bool update_value(const double& v);

void update_timestep(const double& factor) override;

void step_back() override {
pn2_ = pn4_;
vn3_ = vn6_;
Expand Down
5 changes: 2 additions & 3 deletions include/JoSIM/LUSolve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace JoSIM {
class LUSolve {
private:
char equed[1] = { 'N' };
yes_no_t equil;
trans_t trans;
SuperMatrix A, L, U, B, X;
GlobalLU_t Glu;
Expand All @@ -21,11 +20,11 @@ namespace JoSIM {
long long* etree;
void* work = nullptr;
long long info, lwork, nrhs, ldx;
long long i, m, n, nnz;
long long m, n, nnz;
double* rhsb,* rhsx,* xact;
double* R,* C;
double* ferr,* berr;
double u, rpg, rcond;
double rpg, rcond;
mem_usage_t mem_usage;
superlu_options_t options;
SuperLUStat_t stat;
Expand Down
12 changes: 9 additions & 3 deletions include/JoSIM/Matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
namespace JoSIM {

class Matrix {
private:
std::vector<NodeConfig> nodeConfig, nodeConfig2;
bool needsTR_ = true;
public:
AnalysisType analysisType = AnalysisType::Phase;
std::vector<Function> sourcegen;
Expand All @@ -25,19 +28,22 @@ namespace JoSIM {
std::unordered_map<std::string, int> nm;
nodeconnections nc;
std::unordered_set<std::string> lm;
int branchIndex;
std::vector<double> nz, nz_orig;
int branchIndex = 0;
std::vector<double> nz;
std::vector<long long> ci, rp;
std::vector<RelevantTrace> relevantTraces;
std::vector<int> relevantIndices;

Matrix() {};
void create_matrix(Input& iObj);
void setup(Input& iObj);
void create_components(Input& iObj);
void handle_mutual_inductance(Input& iObj);
void reduce_step(Input& iObj);
void create_csr();
void create_nz();
void create_ci();
void create_rp();
void mod_timestep(const int factor);
};
} // namespace JoSIM
#endif
4 changes: 3 additions & 1 deletion include/JoSIM/Misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ namespace JoSIM {
template <typename T>
std::string precise_to_string(const T a_value) {
std::ostringstream out;
out << std::uppercase << std::fixed << std::scientific << a_value;
out << std::uppercase <<
std::setprecision(std::numeric_limits<long double>::digits10 + 1) <<
a_value;
return out.str();
}

Expand Down
Loading

0 comments on commit 340219e

Please sign in to comment.