OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

solidMixture.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "solidMixture.H"
00028 
00029 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00030 
00031 // Construct from components
00032 Foam::solidMixture::solidMixture
00033 (
00034     const dictionary& thermophysicalProperties
00035 )
00036 :
00037     components_(thermophysicalProperties.lookup("solidComponents")),
00038     properties_(components_.size())
00039 {
00040 
00041     forAll(components_, i)
00042     {
00043         properties_.set
00044         (
00045             i,
00046             solid::New(thermophysicalProperties.lookup(components_[i]))
00047         );
00048     }
00049 }
00050 
00051 
00052 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
00053 
00054 Foam::autoPtr<Foam::solidMixture> Foam::solidMixture::New
00055 (
00056     const dictionary& thermophysicalProperties
00057 )
00058 {
00059     return autoPtr<solidMixture>(new solidMixture(thermophysicalProperties));
00060 }
00061 
00062 
00063 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00064 
00065 Foam::scalarField Foam::solidMixture::X
00066 (
00067     const scalarField& Y
00068 ) const
00069 {
00070     scalarField X(Y.size());
00071     scalar rhoInv = 0.0;
00072     forAll(X, i)
00073     {
00074         rhoInv += Y[i]/properties_[i].rho();
00075         X[i] = Y[i]/properties_[i].rho();
00076     }
00077 
00078     return X/rhoInv;
00079 }
00080 
00081 
00082 Foam::scalar Foam::solidMixture::rho
00083 (
00084     const scalarField& X
00085 ) const
00086 {
00087     scalar tmp = 0.0;
00088     forAll(properties_, i)
00089     {
00090         tmp += properties_[i].rho()*X[i];
00091     }
00092     return tmp;
00093 }
00094 
00095 
00096 Foam::scalar Foam::solidMixture::cp
00097 (
00098     const scalarField& Y
00099 ) const
00100 {
00101     scalar tmp = 0.0;
00102     forAll(properties_, i)
00103     {
00104         tmp += properties_[i].cp()*Y[i];
00105     }
00106     return tmp;
00107 }
00108 
00109 
00110 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd