|
[Sponsors] |
April 21, 2017, 11:11 |
Units Doesn't match
|
#1 |
Member
Mehdi Aminyavari
Join Date: Feb 2016
Location: Milan
Posts: 35
Rep Power: 10 |
Hello All, I realized something really weird in OpenFoam which I can't find any explanation...
consider the solver interFoam, in creatField.H phi is made as incompressible flow: #include "createPhi.H" which in the definition can be found that: Code:
surfaceScalarField phi ( IOobject ( "phi", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), linearInterpolate(U) & mesh.Sf() ); Code:
Info << "phi.dim = "<< phi.dimensions() << endl; result: phi.dim = [0 3 -1 0 0 0 0] now lets consider the UEqn.H: Code:
fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) + turbulence->divDevRhoReff(U) ); which I rewrite it as following so that we can see it better: volTensorField SS=fvc::grad(U); fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) - fvm::laplacian(mu, U) - fvc::div( mu*dev2(SS.T()) ) ); [1/s]*[kg/m^3]*[m/s]= [kg/m^2/s^2] ([1/s] is due to derivative with respect to time) 2)Dimension analysis of term "fvm::laplacian(mu, U)": [1/m]*[1/m]*[kg/m/s]*[m/s]=[kg/m^2/s^2] ([1/m] is due to derivative with respect to space , "gradient" ) so the divergence term should also have the same unit, lets see: 3)Dimension analysis of term "fvm::div(rhoPhi, U)": [1/m]*[kg/m^3]*[m^3/s]*[m/s]=[kg/s^2] ([1/m] is due to derivative with respect to space , "gradient" ) WHYYYYYYYYY???? now if u check the last term, you'll realize that the only way to make this term to have the same unit as other term, phi should be [m/s]. ANY COMMENT?? |
|
April 21, 2017, 13:10 |
|
#2 |
Member
Mehdi Aminyavari
Join Date: Feb 2016
Location: Milan
Posts: 35
Rep Power: 10 |
by the way, this is the case for any other solvers as well!! Not just interFoam...
|
|
April 21, 2017, 14:16 |
|
#3 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
Don't forget that fvMatrix equations are not formulated in a derivative form but rather in an integral form.It means that every term in your matrix equation represents an integral not derivative. Yes, initially an equation is formulated in a derivative form and then it is integrated over the control volume. Applying Gauss theorem some terms (div, laplacian) are converted from volume integral to surface integral. To learn more about the discretization of equations in FVM see books like these:
Source code (as always) is your friend. I marked the relevant lines in code with red color. 1) fvm::ddt(rho, U): [kg/m^3]*[m/s]*[m^3]/[s] = [kg*m/s^2] Code:
template<class Type> tmp<fvMatrix<Type> > EulerDdtScheme<Type>::fvmDdt ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf ) { tmp<fvMatrix<Type> > tfvm ( new fvMatrix<Type> ( vf, rho.dimensions()*vf.dimensions()*dimVol/dimTime ) ); fvMatrix<Type>& fvm = tfvm(); scalar rDeltaT = 1.0/mesh().time().deltaTValue(); fvm.diag() = rDeltaT*rho.internalField()*mesh().Vsc(); if (mesh().moving()) { fvm.source() = rDeltaT *rho.oldTime().internalField() *vf.oldTime().internalField()*mesh().Vsc0(); } else { fvm.source() = rDeltaT *rho.oldTime().internalField() *vf.oldTime().internalField()*mesh().Vsc(); } return tfvm; } [kg/m^3]*[m^3/s]*[m/s]=[kg*m/s^2] Code:
template<class Type> tmp<fvMatrix<Type> > gaussConvectionScheme<Type>::fvmDiv ( const surfaceScalarField& faceFlux, const GeometricField<Type, fvPatchField, volMesh>& vf ) const { tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf); const surfaceScalarField& weights = tweights(); tmp<fvMatrix<Type> > tfvm ( new fvMatrix<Type> ( vf, faceFlux.dimensions()*vf.dimensions() ) ); fvMatrix<Type>& fvm = tfvm(); fvm.lower() = -weights.internalField()*faceFlux.internalField(); fvm.upper() = fvm.lower() + faceFlux.internalField(); fvm.negSumDiag(); forAll(vf.boundaryField(), patchI) { const fvPatchField<Type>& psf = vf.boundaryField()[patchI]; const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI]; const fvsPatchScalarField& pw = weights.boundaryField()[patchI]; fvm.internalCoeffs()[patchI] = patchFlux*psf.valueInternalCoeffs(pw); fvm.boundaryCoeffs()[patchI] = -patchFlux*psf.valueBoundaryCoeffs(pw); } if (tinterpScheme_().corrected()) { fvm += fvc::surfaceIntegrate(faceFlux*tinterpScheme_().correction(vf)); } return tfvm; } |
|
April 22, 2017, 10:52 |
|
#4 |
Member
Mehdi Aminyavari
Join Date: Feb 2016
Location: Milan
Posts: 35
Rep Power: 10 |
Bravooo, I see now, Thank you so much for your clear guide
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thermophysical Property Units | johanz | OpenFOAM Pre-Processing | 2 | December 16, 2018 11:08 |
createPatch Segmentation Fault (CORE DUMPED) | sam.ho | OpenFOAM Pre-Processing | 2 | April 21, 2014 03:01 |
Match Control and Symmetry Boundary Condtions in a quasi 2D calculation | peterputer | ANSYS Meshing & Geometry | 0 | May 15, 2012 09:53 |
gmsh2ToFoam | sarajags_89 | OpenFOAM | 0 | November 24, 2009 23:50 |
Units with use of the Ideal gas law? | Chilli83 | CFX | 2 | April 8, 2009 09:05 |