Skip to content

Commit

Permalink
Update adding CPR to JJ model. Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyDelp committed Aug 4, 2022
1 parent b5f0f3f commit 1894f6e
Show file tree
Hide file tree
Showing 77 changed files with 5,476 additions and 5,682 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.6.3)
project(JoSIM VERSION 2.6.4)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# JoSIM - Superconducting Circuit Simulator

Developers Manual for v2.5.1
Developers Manual for v2.6.4

## Project Status

### 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)
### Testing: v2.6.4 - 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.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)
### Stable: v2.6.4 - 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
6 changes: 3 additions & 3 deletions docs/jp/index_jp.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# JoSIM - 超伝導回路シミュレータ

Developers Manual for v2.5.1
Developers Manual for v2.6.4

## プロジェクトの状況

### 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)
### Testing: v2.6.4 - 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.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)
### Stable: v2.6.4 - 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
5 changes: 5 additions & 0 deletions docs/jp/syntax_jp.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ JoSIMで現在サポートしている接合モデルはRCSJモデルだけで
| D | 0.0, 1 | 0.0 | 電流位相関係に影響する接点の透過率 |
| ICFCT or ICFACT | 0, 1 | $\frac{\pi}{4}$ | 臨界電流の準粒子ステップ高さに対する比 |
| PHI | 0, $2\pi$ | 0 | $\pi$-junctionのようなphi-junctionを実現可能にする |
| CPR | 0,$\infty$ | 1 | 電流の位相関係定数を設定します。 |

*.model* の行はサブサーキット固有であるため同じ名前の異なるモデルを分離されたサブサーキット下にそれぞれ置くことができます。サブサーキット下にモデルが見つからなかった場合グローバルなものを探すことになり、それでも見つからない場合はデフォルトの値(デフォルトのモデル)が使用されます。

**AREA****IC**パラメータはモデルパラメータの修飾子としてはたらきます。**IC**が指定されると**AREA**の値は$AREA=\frac{IC_{jj}}{IC_{model}}$によって置き換えられる、臨界電流でかけられた値となります。

モデルの**PHI**パラメータを設定することで、JJ電流の$\sin(\phi)$部分の中にある位相($\phi$)から常に引いたものが位相の値になります。これによって$\pi$-junctionのような素子をモデル化可能です。

***CPR***を設定すると、超電流位相関係の係数が変更されます。デフォルトは$I_S=I_C\sin(\phi)$に関連する1です。これを2に設定すると、この関係が$I_S = I_C\sin(2\phi)$に変更され、超電流の2次高調波のみを有効にして、最初の高調波を抑制することにより、$\pi$-junctionを使用できるようになります。[^1][^2]


### Transmission Line {#transmission-line}

Expand Down Expand Up @@ -461,3 +464,5 @@ JoSIMはビルトインの定数セットを持っており、展開された時
| EPS0 | $\epsilon_{0}$ | 8.854187817E-12 |
| SIGMA | $\sigma$ (short for $\frac{\Phi_{0}}{2\pi}$) | 3.291059757E-16 |

[^1]:I. Salameh, E. G. Friedman and S. Kvatinsky, "Superconductive Logic Using 2ϕ—Josephson Junctions With Half Flux Quantum Pulses," in *IEEE Transactions on Circuits and Systems II: Express Briefs*, vol. 69, no. 5, pp. 2533-2537, May 2022, doi: 10.1109/TCSII.2022.3162723.
[^2]:S. V. Bakurskiy et al., "Current-phase relations in SIsFS junctions in the vicinity of 0-$\pi$ Transition", *Phys. Rev. B Condens. Matter*, vol. 95, pp. 94522-94528, Mar. 2017.
27 changes: 26 additions & 1 deletion docs/refer.bib
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,29 @@ @article{haberkorn
pages={K161--K164},
year={1978},
publisher={Wiley Online Library}
}
}

@ARTICLE{ebyCPR,
author={Salameh, Issa and Friedman, Eby G. and Kvatinsky, Shahar},
journal={IEEE Transactions on Circuits and Systems II: Express Briefs},
title={Superconductive Logic Using 2ϕ—Josephson Junctions With Half Flux Quantum Pulses},
year={2022},
volume={69},
number={5},
pages={2533-2537},
doi={10.1109/TCSII.2022.3162723}}
@article{bakyrskiyCPR,
title = {Current-phase relations in SIsFS junctions in the vicinity of 0-$\ensuremath{\pi}$ transition},
author = {Bakurskiy, S. V. and Filippov, V. I. and Ruzhickiy, V. I. and Klenov, N. V. and Soloviev, I. I. and Kupriyanov, M. Yu. and Golubov, A. A.},
journal = {Phys. Rev. B},
volume = {95},
issue = {9},
pages = {094522},
numpages = {11},
year = {2017},
month = {Mar},
publisher = {American Physical Society},
doi = {10.1103/PhysRevB.95.094522},
url = {https://link.aps.org/doi/10.1103/PhysRevB.95.094522}
}
5 changes: 5 additions & 0 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,16 @@ The only junction model currently supported by JoSIM is the RCSJ model and thus
| 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, $2\pi$ | 0 | Allows phi-junction capability such as the $\pi$-junction. |
| CPR | 0, $\infty$ | 1 | Sets the Current Phase Relationship constant. |

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.

Setting **CPR** changes the coefficient of the supercurrent phase relationship. Default is 1 relating to $I_S=I_C\sin(\phi)$. Setting this to 2 would change this relationship to $I_S=I_C\sin(2\phi)$ which allows the use of $\pi$-junctions by enabling only the second harmonic of the supercurrent and suppressing the first.[^1][^2]

### Transmission Line

**T**Label $N^{+}_{1}$ $N^{-}_{1}$ $N^{+}_{2}$ $N^{-}_{2}$ **TD=VALUE** **Z0=VALUE**
Expand Down Expand Up @@ -434,3 +437,5 @@ JoSIM has a set of built in constants that when used expand to the corresponding
| EPS0 | $\epsilon_{0}$ | 8.854187817E-12 |
| SIGMA | $\sigma$ (short for $\frac{\Phi_{0}}{2\pi}$) | 3.291059757E-16 |

[^1]: I. Salameh, E. G. Friedman and S. Kvatinsky, "Superconductive Logic Using 2ϕ—Josephson Junctions With Half Flux Quantum Pulses," in *IEEE Transactions on Circuits and Systems II: Express Briefs*, vol. 69, no. 5, pp. 2533-2537, May 2022, doi: 10.1109/TCSII.2022.3162723.
[^2]:S. V. Bakurskiy et al., "Current-phase relations in SIsFS junctions in the vicinity of 0-$\pi$ Transition", *Phys. Rev. B Condens. Matter*, vol. 95, pp. 94522-94528, Mar. 2017.
14 changes: 6 additions & 8 deletions include/JoSIM/AnalysisType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@

namespace JoSIM {

enum class AnalysisType : int64_t {
Voltage = 0, Phase = 1
};
enum class AnalysisType : int64_t { Voltage = 0, Phase = 1 };

constexpr AnalysisType analysis_type_from_int(AnalysisType type) {
switch (type) {
constexpr AnalysisType analysis_type_from_int(AnalysisType type) {
switch (type) {
case AnalysisType::Voltage:
return AnalysisType::Voltage;
case AnalysisType::Phase:
return AnalysisType::Phase;
default:
throw std::runtime_error("Invalid analysis type");
}
}
}

} // namespace JoSIM
} // namespace JoSIM

#endif // JOSIM_ANALYSISTYPE_HPP
#endif // JOSIM_ANALYSISTYPE_HPP
130 changes: 63 additions & 67 deletions include/JoSIM/BasicComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,72 @@
#ifndef JOSIM_BASICCOMPONENT_H
#define JOSIM_BASICCOMPONENT_H

#include "JoSIM/TypeDefines.hpp"
#include "JoSIM/Errors.hpp"

#include <vector>
#include <unordered_map>
#include <cmath>
#include <unordered_map>
#include <vector>

#include "JoSIM/Errors.hpp"
#include "JoSIM/TypeDefines.hpp"

namespace JoSIM {
enum class NodeConfig {
GND = 0, POSGND = 1, GNDNEG = 2, POSNEG = 3
};

using nodemap = std::unordered_map<std::string, int64_t>;
using nodeconnections = std::vector<std::vector<std::pair<double, int64_t>>>;

class NetlistInfo {
public:
std::string label_;
double value_ = 0.0;
};

class IndexInfo {
public:
int_o posIndex_, negIndex_, currentIndex_;
NodeConfig nodeConfig_ = NodeConfig::GND;
};

class MatrixInfo {
public:
std::vector<double> nonZeros_;
std::vector<int64_t> columnIndex_;
std::vector<int64_t> rowPointer_;
};

class BasicComponent {
public:
NetlistInfo netlistInfo;
IndexInfo indexInfo;
MatrixInfo matrixInfo;


void set_node_indices(
const tokens_t& t, const nodemap& nm, nodeconnections& nc) {
switch (indexInfo.nodeConfig_) {
enum class NodeConfig { GND = 0, POSGND = 1, GNDNEG = 2, POSNEG = 3 };

using nodemap = std::unordered_map<std::string, int64_t>;
using nodeconnections = std::vector<std::vector<std::pair<double, int64_t>>>;

class NetlistInfo {
public:
std::string label_;
double value_ = 0.0;
};

class IndexInfo {
public:
int_o posIndex_, negIndex_, currentIndex_;
NodeConfig nodeConfig_ = NodeConfig::GND;
};

class MatrixInfo {
public:
std::vector<double> nonZeros_;
std::vector<int64_t> columnIndex_;
std::vector<int64_t> rowPointer_;
};

class BasicComponent {
public:
NetlistInfo netlistInfo;
IndexInfo indexInfo;
MatrixInfo matrixInfo;

void set_node_indices(const tokens_t& t, const nodemap& nm,
nodeconnections& nc) {
switch (indexInfo.nodeConfig_) {
case NodeConfig::POSGND:
indexInfo.posIndex_ = nm.at(t.at(0));
nc.at(nm.at(t.at(0))).emplace_back(
std::make_pair(1, indexInfo.currentIndex_.value()));
nc.at(nm.at(t.at(0)))
.emplace_back(std::make_pair(1, indexInfo.currentIndex_.value()));
break;
case NodeConfig::GNDNEG:
indexInfo.negIndex_ = nm.at(t.at(1));
nc.at(nm.at(t.at(1))).emplace_back(
std::make_pair(-1, indexInfo.currentIndex_.value()));
nc.at(nm.at(t.at(1)))
.emplace_back(std::make_pair(-1, indexInfo.currentIndex_.value()));
break;
case NodeConfig::POSNEG:
indexInfo.posIndex_ = nm.at(t.at(0));
indexInfo.negIndex_ = nm.at(t.at(1));
nc.at(nm.at(t.at(0))).emplace_back(
std::make_pair(1, indexInfo.currentIndex_.value()));
nc.at(nm.at(t.at(1))).emplace_back(
std::make_pair(-1, indexInfo.currentIndex_.value()));
nc.at(nm.at(t.at(0)))
.emplace_back(std::make_pair(1, indexInfo.currentIndex_.value()));
nc.at(nm.at(t.at(1)))
.emplace_back(std::make_pair(-1, indexInfo.currentIndex_.value()));
break;
case NodeConfig::GND:
break;
}
}
}

void set_matrix_info() {
switch (indexInfo.nodeConfig_) {
void set_matrix_info() {
switch (indexInfo.nodeConfig_) {
case NodeConfig::POSGND:
matrixInfo.nonZeros_.emplace_back(1);
matrixInfo.columnIndex_.emplace_back(indexInfo.posIndex_.value());
Expand All @@ -92,27 +89,26 @@ namespace JoSIM {
case NodeConfig::GND:
matrixInfo.rowPointer_.emplace_back(1);
break;
}
matrixInfo.columnIndex_.emplace_back(indexInfo.currentIndex_.value());
sanity_check();
}

void sanity_check() {
for (auto& i : matrixInfo.nonZeros_) {
if (i == 0 || std::isinf(i) || std::isnan(i)) {
Errors::matrix_errors(
MatrixErrors::SANITY_ERROR, netlistInfo.label_);
}
matrixInfo.columnIndex_.emplace_back(indexInfo.currentIndex_.value());
sanity_check();
}

void sanity_check() {
for (auto& i : matrixInfo.nonZeros_) {
if (i == 0 || std::isinf(i) || std::isnan(i)) {
Errors::matrix_errors(MatrixErrors::SANITY_ERROR, netlistInfo.label_);
}
}
}

virtual void update_timestep(const double& factor) {};
virtual void update_timestep(const double& factor){};

virtual void step_back() {};
virtual void step_back(){};

virtual ~BasicComponent() {}
virtual ~BasicComponent() {}

}; // class BasicComponent
}; // class BasicComponent

} // namespace JoSIM
} // namespace JoSIM
#endif
57 changes: 28 additions & 29 deletions include/JoSIM/CCCS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,44 @@
#ifndef JOSIM_CCCS_HPP
#define JOSIM_CCCS_HPP

#include <optional>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include "JoSIM/AnalysisType.hpp"
#include "JoSIM/BasicComponent.hpp"
#include "JoSIM/ParameterName.hpp"
#include "JoSIM/Parameters.hpp"
#include "JoSIM/AnalysisType.hpp"

#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <optional>

namespace JoSIM {

/*
Flabel Vo⁺ Vo⁻ Vc⁺ Vc⁻ G
/*
Flabel Vo⁺ Vo⁻ Vc⁺ Vc⁻ G
Io = GIc
Io = GIc
⎡ 0 0 0 0 1⎤ ⎡Vo⁺⎤ ⎡ 0⎤
⎜ 0 0 0 0 -1⎟ ⎜Vo⁻⎟ ⎜ 0⎟
⎜ 0 0 0 0 1/G⎟ ⎜Vc⁺⎟ = ⎜ 0⎟
⎜ 0 0 0 0 -1/G⎟ ⎜Vc⁻⎟ ⎜ 0⎟
⎣ 0 0 1 -1 0⎦ ⎣Io ⎦ ⎣ 0⎦
*/
⎡ 0 0 0 0 1⎤ ⎡Vo⁺⎤ ⎡ 0⎤
⎜ 0 0 0 0 -1⎟ ⎜Vo⁻⎟ ⎜ 0⎟
⎜ 0 0 0 0 1/G⎟ ⎜Vc⁺⎟ = ⎜ 0⎟
⎜ 0 0 0 0 -1/G⎟ ⎜Vc⁻⎟ ⎜ 0⎟
⎣ 0 0 1 -1 0⎦ ⎣Io ⎦ ⎣ 0⎦
*/

class CCCS : public BasicComponent {
public:
NodeConfig nodeConfig2_;
int_o posIndex2_, negIndex2_;
class CCCS : public BasicComponent {
public:
NodeConfig nodeConfig2_;
int_o posIndex2_, negIndex2_;

CCCS(
const std::pair<tokens_t, string_o>& s, const NodeConfig& ncon,
const std::optional<NodeConfig>& ncon2, const nodemap& nm,
std::unordered_set<std::string>& lm, nodeconnections& nc,
const param_map& pm, int64_t& bi);
CCCS(const std::pair<tokens_t, string_o>& s, const NodeConfig& ncon,
const std::optional<NodeConfig>& ncon2, const nodemap& nm,
std::unordered_set<std::string>& lm, nodeconnections& nc,
const param_map& pm, int64_t& bi);

void set_node_indices(
const tokens_t& t, const nodemap& nm, nodeconnections& nc);
void set_matrix_info();
}; // class CCCS
void set_node_indices(const tokens_t& t, const nodemap& nm,
nodeconnections& nc);
void set_matrix_info();
}; // class CCCS

} // namespace JoSIM
} // namespace JoSIM
#endif
Loading

0 comments on commit 1894f6e

Please sign in to comment.