|
[Sponsors] |
How the boundary conditions are disposed into the matrix coefficient? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 20, 2013, 12:39 |
How the boundary conditions are disposed into the matrix coefficient?
|
#1 |
Member
X Meng
Join Date: Jun 2012
Location: Scotland
Posts: 89
Rep Power: 14 |
Hi guys, does any one know?
How the boundary conditions are disposed into the matrix A of Ax=B? In other word, which section of source code I need to find about it? Cheers |
|
March 1, 2013, 17:03 |
|
#2 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Hi the BC contributions (internalCoffs and boundaryCoeffs) to the matrix and RHS are calculated where the discrete version of the differential operators is assembled. These contributions are stored to be inserted into the matrix prior to the solution. In the case of a case of scalar transport and the div operator the lines are 98 in gaussConvectionScheme.C
Code:
00066 template<class Type> 00067 tmp<fvMatrix<Type> > 00068 gaussConvectionScheme<Type>::fvmDiv 00069 ( 00070 const surfaceScalarField& faceFlux, 00071 const GeometricField<Type, fvPatchField, volMesh>& vf 00072 ) const 00073 { 00074 tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf); 00075 const surfaceScalarField& weights = tweights(); 00076 00077 tmp<fvMatrix<Type> > tfvm 00078 ( 00079 new fvMatrix<Type> 00080 ( 00081 vf, 00082 faceFlux.dimensions()*vf.dimensions() 00083 ) 00084 ); 00085 fvMatrix<Type>& fvm = tfvm(); 00086 00087 fvm.lower() = -weights.internalField()*faceFlux.internalField(); 00088 fvm.upper() = fvm.lower() + faceFlux.internalField(); 00089 fvm.negSumDiag(); 00090 00091 forAll(vf.boundaryField(), patchI) 00092 { 00093 const fvPatchField<Type>& psf = vf.boundaryField()[patchI]; 00094 const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI]; 00095 const fvsPatchScalarField& pw = weights.boundaryField()[patchI]; 00096 00097 fvm.internalCoeffs()[patchI] = patchFlux*psf.valueInternalCoeffs(pw); 00098 fvm.boundaryCoeffs()[patchI] = -patchFlux*psf.valueBoundaryCoeffs(pw); 00099 } 00100 00101 if (tinterpScheme_().corrected()) 00102 { 00103 fvm += fvc::surfaceIntegrate(faceFlux*tinterpScheme_().correction(vf)); 00104 } 00105 00106 return tfvm; 00107 } Code:
00095 template<> 00096 Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve 00097 ( 00098 const dictionary& solverControls 00099 ) 00100 { 00101 GeometricField<scalar, fvPatchField, volMesh>& psi = 00102 const_cast<GeometricField<scalar, fvPatchField, volMesh>&> 00103 (fvMat_.psi()); 00104 00105 scalarField saveDiag(fvMat_.diag()); 00106 fvMat_.addBoundaryDiag(fvMat_.diag(), 0); 00107 00108 scalarField totalSource(fvMat_.source()); 00109 fvMat_.addBoundarySource(totalSource, false); 00110 00111 // assign new solver controls 00112 solver_->read(solverControls); 00113 00114 lduMatrix::solverPerformance solverPerf = solver_->solve 00115 ( 00116 psi.internalField(), 00117 totalSource 00118 ); 00119 00120 solverPerf.print(); 00121 00122 fvMat_.diag() = saveDiag; 00123 00124 psi.correctBoundaryConditions(); 00125 00126 psi.mesh().setSolverPerformance(psi.name(), solverPerf); 00127 00128 return solverPerf; 00129 }
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simulation of a single bubble with a VOF-method | Suzzn | CFX | 21 | January 29, 2018 01:58 |
Constant velocity of the material | Sas | CFX | 15 | July 13, 2010 09:56 |
RPM in Wind Turbine | Pankaj | CFX | 9 | November 23, 2009 05:05 |
CFX doesn't continue calculation... | mactech001 | CFX | 6 | November 15, 2009 22:25 |
A problem about setting boundary conditions | lyang | Main CFD Forum | 0 | September 19, 1999 19:29 |