Commit 27fb292e authored by Andreas Michael Bremen's avatar Andreas Michael Bremen
Browse files

- cleanup of SolidLiquidPhase with some variable name changes for...

- cleanup of SolidLiquidPhase with some variable name changes for initialization (stoichiometry matrices, nullspace etc.)
parent d8109f25
within ElectrolyteMedia.Media.Common.Reaction; within ElectrolyteMedia.Media.Common.Reaction;
function calc_lambda_id function calc_lambda_id
"calculates lambda with nX*nX identity matrix" "calculates lambda with nX*nX identity matrix"
input Real[:,:] lambda; input Real[:,:] nu_id;
output Real[size(nu_id,2),size(nu_id,2)-size(nu_id,1)] lambda_id;
output Real[size(lambda,1),size(lambda,2)] lambda_id;
output Integer[size(lambda,1),size(lambda,1)] P_id;
protected
Integer nF = size(lambda,1);
Integer nX = size(lambda,2);
Real[nF,nX] LU;
Integer[nX] pivots_LAPACK;
Real[nF,nX] L;
Integer[nF,nF] P;
Real[nX,nX] Lsquare;
Real[nX,nX] LsquareT;
Real[nX,nX] LU_;
Integer[nX] pivots_LAPACK_;
Real[nX,nX] U_;
algorithm algorithm
(LU,pivots_LAPACK) :=Modelica.Math.Matrices.LU(lambda); lambda_id :=transpose(cat(2,-transpose(nu_id[:, size(nu_id,1) + 1:size(nu_id,2)]),identity(size(nu_id,2)-size(nu_id,1))));
L :=Media.Common.Reaction.calc_L(LU);
P :=Media.Common.Reaction.calc_P(pivots_LAPACK,nF);
Lsquare :=L[1:nX, :];
LsquareT :=transpose(Lsquare);
(LU_,pivots_LAPACK_) :=Modelica.Math.Matrices.LU(LsquareT);
U_ :=Media.Common.Reaction.calc_U(LU_);
lambda_id :=L*Modelica.Math.Matrices.inv(transpose(U_));
P_id :=P;
end calc_lambda_id; end calc_lambda_id;
...@@ -5,4 +5,3 @@ calc_L ...@@ -5,4 +5,3 @@ calc_L
calc_U calc_U
calc_P_nu_id calc_P_nu_id
calc_lambda_id calc_lambda_id
calc_P_lambda_id
within ElectrolyteMedia.Media.LiquidPhase.Common; within ElectrolyteMedia.Media.LiquidPhase.Common;
record LiquidInteractionDataRecord "Coefficient data record for interaction properties between aqueous solute species" record LiquidInteractionDataRecord "Coefficient data record for interaction properties between aqueous solute species"
parameter Integer nLi; parameter Integer nLi = 1;
//Bromley parameter //Bromley parameter
Real[nLi,nLi] Bromley_ij = zeros(nLi,nLi) "Bromley parameter"; Real[nLi,nLi] Bromley_ij = zeros(nLi,nLi) "Bromley parameter";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment