void uhfsolve::setupCoupledMatrix_unused(){ //still following Dragly, further references to indexation differences between Thijssen and Helgaker coupledMatrix.set_size(nStates,nStates); for(int p = 0; p<nStates;p++){ for(int r = 0; r<nStates;r++){ coupledMatrix(p,r)=zeros(nStates,nStates); for(int q = p; q<nStates;q++){ for(int s = r; s<nStates;s++){ coupledMatrix(p,r)(q,s) = Bs.v(p,q)(r,s); } } } } double val; for(int p = 0; p<nStates;p++){ for(int r = 0; r<nStates;r++){ for(int q = p; q<nStates;q++){ for(int s = r; s<nStates;s++){ val = coupledMatrix(p,r)(q,s); coupledMatrix(q,s)(p,r) = val; coupledMatrix(q,r)(p,s) = val; coupledMatrix(p,s)(q,r) = val; coupledMatrix(r,p)(s,q) = val; coupledMatrix(s,p)(r,q) = val; coupledMatrix(r,q)(s,p) = val; coupledMatrix(s,q)(r,p) = val; } } } } coupledMatrix.print(); }
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solveCoupled ( const dictionary& solverControls ) { if (debug) { Info.masterStream(this->mesh().comm()) << "fvMatrix<Type>::solveCoupled" "(const dictionary& solverControls) : " "solving fvMatrix<Type>" << endl; } GeometricField<Type, fvPatchField, volMesh>& psi = const_cast<GeometricField<Type, fvPatchField, volMesh>&>(psi_); LduMatrix<Type, scalar, scalar> coupledMatrix(psi.mesh()); coupledMatrix.diag() = diag(); coupledMatrix.upper() = upper(); coupledMatrix.lower() = lower(); coupledMatrix.source() = source(); addBoundaryDiag(coupledMatrix.diag(), 0); addBoundarySource(coupledMatrix.source(), false); coupledMatrix.interfaces() = psi.boundaryField().interfaces(); coupledMatrix.interfacesUpper() = boundaryCoeffs().component(0); coupledMatrix.interfacesLower() = internalCoeffs().component(0); autoPtr<typename LduMatrix<Type, scalar, scalar>::solver> coupledMatrixSolver ( LduMatrix<Type, scalar, scalar>::solver::New ( psi.name(), coupledMatrix, solverControls ) ); SolverPerformance<Type> solverPerf ( coupledMatrixSolver->solve(psi) ); if (SolverPerformance<Type>::debug) { solverPerf.print(Info.masterStream(this->mesh().comm())); } psi.correctBoundaryConditions(); psi.mesh().setSolverPerformance(psi.name(), solverPerf); return solverPerf; }
void uhfsolve::setupCoupledMatrix(){ //import particle-particle interaction integrals int n = Bs.Nstates; coupledMatrix.set_size(n, n); for (int p = 0; p<n; p++){ for (int q = 0; q<n; q++){ coupledMatrix(p, q) = zeros(n, n); } } for (int p = 0; p<n; p++){ for (int q = 0; q<n; q++){ for (int r = 0; r<n; r++){ for (int s = 0; s<n; s++){ coupledMatrix(p, r)(q, s) = Bs.v(p, q)(r, s); //alt (1) "Strange" (CHANGED TODAY) } } } } }