ParamagneticForce.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "ParamagneticForce.H"
30 #include "demandDrivenData.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class CloudType>
37 (
38  CloudType& owner,
39  const fvMesh& mesh,
40  const dictionary& dict
41 )
42 :
43  ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
44  HdotGradHName_
45  (
46  this->coeffs().template getOrDefault<word>("HdotGradH", "HdotGradH")
47  ),
48  HdotGradHInterpPtr_(nullptr),
49  magneticSusceptibility_
50  (
51  this->coeffs().getScalar("magneticSusceptibility")
52  )
53 {}
54 
55 
56 template<class CloudType>
58 (
59  const ParamagneticForce& pf
60 )
61 :
63  HdotGradHName_(pf.HdotGradHName_),
64  HdotGradHInterpPtr_(pf.HdotGradHInterpPtr_),
65  magneticSusceptibility_(pf.magneticSusceptibility_)
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
70 
71 template<class CloudType>
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
78 template<class CloudType>
80 {
81  if (store)
82  {
83  const volVectorField& HdotGradH =
84  this->mesh().template lookupObject<volVectorField>(HdotGradHName_);
85 
86  HdotGradHInterpPtr_ = interpolation<vector>::New
87  (
88  this->owner().solution().interpolationSchemes(),
89  HdotGradH
90  ).ptr();
91  }
92  else
93  {
94  deleteDemandDrivenData(HdotGradHInterpPtr_);
95  }
96 }
97 
98 
99 template<class CloudType>
101 (
102  const typename CloudType::parcelType& p,
103  const typename CloudType::parcelType::trackingData& td,
104  const scalar dt,
105  const scalar mass,
106  const scalar Re,
107  const scalar muc
108 ) const
109 {
110  forceSuSp value(Zero);
111 
112  const interpolation<vector>& HdotGradHInterp = *HdotGradHInterpPtr_;
113 
114  value.Su()=
115  mass*3.0*constant::electromagnetic::mu0.value()/p.rho()
116  *magneticSusceptibility_/(magneticSusceptibility_ + 3)
117  *HdotGradHInterp.interpolate(p.coordinates(), p.currentTetIndices());
118 
119  return value;
120 }
121 
122 
123 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::ParamagneticForce::calcNonCoupled
virtual forceSuSp calcNonCoupled(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the non-coupled force.
Definition: ParamagneticForce.C:101
Foam::solution
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:55
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::ParamagneticForce::~ParamagneticForce
virtual ~ParamagneticForce()
Destructor.
Definition: ParamagneticForce.C:72
Foam::dimensioned::value
const Type & value() const
Return const reference to value.
Definition: dimensionedType.C:434
Foam::forceSuSp::Su
const vector & Su() const
Return const access to the explicit contribution [kg.m/s2].
Definition: forceSuSpI.H:61
ParamagneticForce.H
Foam::ParamagneticForce::ParamagneticForce
ParamagneticForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
Definition: ParamagneticForce.C:37
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:42
Foam::forceSuSp
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:64
Foam::ParticleForce
Abstract base class for particle forces.
Definition: ParticleForce.H:59
Foam::ParamagneticForce
Calculates particle paramagnetic (magnetic field) force.
Definition: ParamagneticForce.H:58
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::interpolation
Abstract base class for interpolation.
Definition: mappedPatchFieldBase.H:96
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::ParamagneticForce::cacheFields
virtual void cacheFields(const bool store)
Cache fields.
Definition: ParamagneticForce.C:79
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
electromagneticConstants.H
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
Foam::constant::electromagnetic::mu0
const dimensionedScalar mu0
Magnetic constant/permeability of free space: default SI units: [H/m].
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::interpolation::interpolate
virtual Type interpolate(const vector &position, const label celli, const label facei=-1) const =0
Interpolate field to the given point in the given cell.