WARPXM v1.10.0
Loading...
Searching...
No Matches
wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS Class Reference

Class to set RHS for N-module RLC circuit with discharging capacitor, resistance, and inductance, out of each module. More...

#include <submodule_rlc_with_load_rhs.h>

Inheritance diagram for wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS:
WmApplication wxm::app_base

Detailed Description

Class to set RHS for N-module RLC circuit with discharging capacitor, resistance, and inductance, out of each module.

This also includes a line inductance and resistance in the load branch along with a load. This circuit looks like the following: ____ ...______________________________

I0 (right)

RN R2 R1 R_line

LN L2 L1 L_line

CN C2 C1 V_load | | | |

| |I2 (up) |I1 (up) |

| Ground

Each module can be switched on based on at different times. When the first line is on, we have the simple series RLC circuit with Vload (see series_rlc_with_load_rhs.h). When the successive modules are turned on, we have a a set of equations: 1) KCL -> I0 = sum_j=1^N Ij, where 2) Qdot_j = -Ij, Qdouble_dot = -Idot_j 3) KVL -> V_Cj - V_Rj - V_Lj - V_line - V_load = 0 4) V_Cj = Qj / Cj, V_Rj = Ij Rj = -Qjdot Rj, V_Lj = Ijdot Lj = -Qjdouble_dot Lj 5) V_line = L_Line * I0dot + R_line * I0 = L_line * sum_j=1^N Ijdot + R_line * sum_j=1^N Ij = -L_line * sum_j=1^N Qjdouble_dot - R_line * sum_j=1^N Qjdot We assume a vector [Q = [Q1, Q2, ..., QN], Qdot = [Q1dot, Q2dot ..., QNdot]] Equations 2 and 3 can be written as matrix equation: 6) [id 0] [Qdot] = [0 id] [Q ] + [0_N] (V_line + V_load) [0 L] [Qdouble_dot] [-C^-1 -R] [Qdot] [1_N] where L = diag(L1, L2, ..., LN), R = diag(R1, R2, ..., RN), C = diag(C1, C2, ..., CN) therefore C^-1 = diag(1/C1, 1/C2, ..., 1/CN) and 0_N is a vector of length N of zeros and 1_N is a vector of length N of ones. Also id is an identity matrix of size N x N. If we apply Eq. 5, we can rewrite Eq. 6 as 7) [id 0 ] [Qdot] = [0 id] [Q ] + [0_N] V_load [0 L_tot] [Qdouble_dot] [-C^-1 -R_tot] [Qdot] [1_N] where Ltot = L + L_line E, Rtot = R + R_line E, where E = an N x N matrix of all ones Inverting the left hand side matrix, Eq. 7 can be written 8) [Qdot] = [0 id] [Q ] + [0_N ] V_load [Qdouble_dot] [-Ltot^-1*C^-1 -Ltot^-1*R_tot] [Qdot] [Ltot^-1*1_N] where Ltot^-1 can be written using the Sherman-Morrison formula as: Ltot^-1_ij = L^-1_ij - LT / (Li * Lj) where L^-1 = diag(1/L1, 1/L2, ..., 1/LN) and where LT = L_line / (1 + L_line * sum_k=1^N (1/Lk)) note that another way to write LT is: 1 / LT = 1 / L_line + sum_k=1^N (1/Lk) which is what adding up parallel inductances looks like, but would be problematic for L_line = 0 So in the end, this app is used to solve dqdt = [Qdot, Qdouble_dot] = RHS as written in Eq. 8 using the time integrator

Public Member Functions

 SubmoduleRLCWithLoadRHS ()
 Constructor.
 
 ~SubmoduleRLCWithLoadRHS () override
 Destructor.
 
void setup (const WxCryptSet &wxc) override
 Setup.
 
const std::vector< int > & getInputVariableIndexes (int flag) const override
 Grab input variable indices.
 
const std::vector< int > & getAuxiliaryVariableIndexes (int flag) const override
 Grab auxiliary variable indices.
 
const std::vector< int > & getOutputVariableIndexes (int flag) const override
 Grab output variable indices.
 
void evaluate_function (const real *q, const real *aux, const solverVariables_t *pSV, real *result) const override
 Redefinition of the function evaluator.
 
- Public Member Functions inherited from WmApplication
 WmApplication ()
 
virtual ~WmApplication ()=default
 
virtual void setup (const WxCryptSet &wxc)
 
virtual const std::vector< int > & getAuxiliaryVariableIndexes (int flag=WMAPPLICATIONFLAG_NONE) const
 
virtual const std::vector< int > & getCrossVariableIndexes (int flag=WMAPPLICATIONFLAG_NONE) const
 
const std::vector< std::string > & getBoundaryNames () const
 
bool isOnBoundary (const std::string &boundaryName) const
 
bool has (int flag) const
 
virtual real numerical_flux (const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
 
virtual real internal_flux (const real *q, const real *aux, const solverVariables_t *pSV, std::vector< std::vector< real > > &internalFlux) const
 
virtual real source (const real *q, const real *aux, const elementGeometry_t *pEG, real *source) const
 
virtual void bc_q (const real *q_in, const real *aux_in, const real *aux_out, const solverVariables_t *pFV, real *q_out) const
 Boundary Condition Application which sets the boundary condition on ghost nodes.
 
virtual real bcNumericalFlux (const real *q_l, const real *q_r, const real *aux_l, const real *aux_r, const solverVariables_t *pFV, real *numericalFlux) const
 
virtual void conserved_to_primitive (const real *q, const real *aux, real *w) const
 
virtual void primitive_to_conserved (const real *w, const real *aux, real *q) const
 
virtual void evaluate_function (const real *q, const real *aux, const solverVariables_t *pSV, real *result) const
 
virtual void bc_q_kinetic (const real *q_in, const real *aux_in, const solverVariables_t *pFV, real *q_out) const
 
std::shared_ptr< std::string > app_name ()
 
virtual const std::vector< int > & getInputVariableIndexes (int flag=0) const
 
virtual const std::vector< int > & getOutputVariableIndexes (int flag=0) const
 

Protected Attributes

std::vector< int > _QI_idcs
 
std::vector< int > _vload_idcs
 
std::vector< real_R
 
std::vector< real_L
 
std::vector< real_C
 
real _L_line
 
real _R_line
 
int _N
 
std::vector< real_firetimes
 
real _R_high
 
real _R_max_multiplier
 
real _transition_width
 
std::vector< std::vector< real > > _L_inv
 
std::vector< std::vector< real > > _R_tot
 
std::vector< std::vector< real > > _C_inv
 
std::vector< std::vector< real > > _LC
 
std::vector< std::vector< real > > _LR
 
std::vector< real_R_time
 
- Protected Attributes inherited from WmApplication
std::string _app_name
 
WxLogStream _debStrm
 
std::vector< int > _allowedFlags
 
std::vector< std::string > _onBoundaries
 

Additional Inherited Members

- Public Types inherited from WmApplication
typedef Application_Variable WmApplication_Variable
 
typedef std::map< std::string, std::string > replaceMap_t
 
- Static Public Attributes inherited from wxm::app_base
static std::vector< int > empty
 
- Protected Member Functions inherited from wxm::app_base
virtual ~app_base ()=default
 

Constructor & Destructor Documentation

◆ SubmoduleRLCWithLoadRHS()

wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::SubmoduleRLCWithLoadRHS ( )

Constructor.

◆ ~SubmoduleRLCWithLoadRHS()

wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::~SubmoduleRLCWithLoadRHS ( )
override

Destructor.

Member Function Documentation

◆ evaluate_function()

void wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::evaluate_function ( const real q,
const real aux,
const solverVariables_t pSV,
real result 
) const
overridevirtual

Redefinition of the function evaluator.

Parameters
constq - input variable
constaux - auxiliary variable
constpSV - solver variable structure
result- output variable

Reimplemented from WmApplication.

◆ getAuxiliaryVariableIndexes()

const std::vector< int > & wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::getAuxiliaryVariableIndexes ( int  flag) const
inlineoverridevirtual

Grab auxiliary variable indices.

Parameters
intflag - usually flag is given like flux type but usually not checked
Returns
vector of auxiliary variable indices

Reimplemented from WmApplication.

◆ getInputVariableIndexes()

const std::vector< int > & wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::getInputVariableIndexes ( int  flag) const
inlineoverridevirtual

Grab input variable indices.

Parameters
intflag - usually flag is given like flux type but usually not checked
Returns
vector of input variable indices

Reimplemented from wxm::app_base.

◆ getOutputVariableIndexes()

const std::vector< int > & wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::getOutputVariableIndexes ( int  flag) const
inlineoverridevirtual

Grab output variable indices.

Parameters
intflag - usually flag is given like flux type but usually not checked
Returns
vector of output variable indices

Reimplemented from wxm::app_base.

◆ setup()

void wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::setup ( const WxCryptSet wxc)
overridevirtual

Setup.

Parameters
WxCryptSetobject

Reimplemented from WmApplication.

Member Data Documentation

◆ _C

std::vector<real> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_C
protected

◆ _C_inv

std::vector<std::vector<real> > wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_C_inv
protected

◆ _firetimes

std::vector<real> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_firetimes
protected

◆ _L

std::vector<real> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_L
protected

◆ _L_inv

std::vector<std::vector<real> > wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_L_inv
mutableprotected

◆ _L_line

real wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_L_line
protected

◆ _LC

std::vector<std::vector<real> > wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_LC
mutableprotected

◆ _LR

std::vector<std::vector<real> > wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_LR
protected

◆ _N

int wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_N
protected

◆ _QI_idcs

std::vector<int> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_QI_idcs
protected

◆ _R

std::vector<real> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_R
protected

◆ _R_high

real wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_R_high
protected

◆ _R_line

real wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_R_line
protected

◆ _R_max_multiplier

real wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_R_max_multiplier
protected

◆ _R_time

std::vector<real> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_R_time
mutableprotected

◆ _R_tot

std::vector<std::vector<real> > wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_R_tot
protected

◆ _transition_width

real wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_transition_width
protected

◆ _vload_idcs

std::vector<int> wxm::apps::functions::unique_variable::SubmoduleRLCWithLoadRHS::_vload_idcs
protected

The documentation for this class was generated from the following file: