solidificationMeltingSourceTemplates.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2014-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "fvMatrices.H"
29 #include "fvcDdt.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 template<class RhoFieldType>
34 void Foam::fv::solidificationMeltingSource::apply
35 (
36  const RhoFieldType& rho,
37  fvMatrix<scalar>& eqn
38 )
39 {
40  if (debug)
41  {
42  Info<< type() << ": applying source to " << eqn.psi().name() << endl;
43  }
44 
45  const volScalarField Cp(this->Cp());
46 
47  update(Cp);
48 
50 
51  // contributions added to rhs of solver equation
52  if (eqn.psi().dimensions() == dimTemperature)
53  {
54  // isothermal phase change - only include time derivative
55  // eqn -= L/Cp*(fvc::ddt(rho, alpha1_) + fvc::div(phi, alpha1_));
56  eqn -= L/Cp*(fvc::ddt(rho, alpha1_));
57  }
58  else
59  {
60  // isothermal phase change - only include time derivative
61  // eqn -= L*(fvc::ddt(rho, alpha1_) + fvc::div(phi, alpha1_));
62  eqn -= L*(fvc::ddt(rho, alpha1_));
63  }
64 }
65 
66 
67 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
L
const vector L(dict.get< vector >("L"))
Foam::dimEnergy
const dimensionSet dimEnergy
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
rho
rho
Definition: readInitialConditions.H:88
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
fvcDdt.H
Calculate the first temporal derivative.
Foam::fvc::ddt
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:47