createFields.H
Go to the documentation of this file.
1  Info<< "Reading field psi\n" << endl;
3  (
4  IOobject
5  (
6  "psi",
7  runTime.timeName(),
8  mesh,
9  IOobject::MUST_READ,
10  IOobject::AUTO_WRITE
11  ),
12  mesh
13  );
14 
15  Info<< "Reading transportProperties\n" << endl;
16 
17  IOdictionary transportProperties
18  (
19  IOobject
20  (
21  "transportProperties",
22  runTime.constant(),
23  mesh,
24  IOobject::MUST_READ_IF_MODIFIED,
25  IOobject::NO_WRITE
26  )
27  );
28 
29  List<magnet> magnets(transportProperties.lookup("magnets"));
30 
32  (
33  IOobject
34  (
35  "murf",
36  runTime.timeName(),
37  mesh
38  ),
39  mesh,
40  dimensionedScalar("one", dimless, 1.0)
41  );
42 
44  (
45  IOobject
46  (
47  "Mrf",
48  runTime.timeName(),
49  mesh
50  ),
51  mesh,
52  dimensionedScalar(dimensionSet(0, 1, 0, 0, 0, 1, 0), Zero)
53  );
54  Mrf.setOriented(true);
55 
57  {
58  label magnetZonei = mesh.faceZones().findZoneID(magnets[i].name());
59 
60  if (magnetZonei == -1)
61  {
63  << "Cannot find faceZone for magnet " << magnets[i].name()
64  << exit(FatalIOError);
65  }
66 
67  const labelList& faces = mesh.faceZones()[magnetZonei];
68 
69  const scalar muri = magnets[i].mur();
70  const scalar Mri = magnets[i].Mr().value();
71  const vector& orientationi = magnets[i].orientation();
72 
73  const surfaceVectorField& Sf = mesh.Sf();
74 
75  for (const label facei : faces)
76  {
77  murf[facei] = muri;
78  Mrf[facei] = Mri*(orientationi & Sf[facei]);
79  }
80  }
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
runTime
engineTime & runTime
Definition: createEngineTime.H:13
forAll
forAll(U.boundaryField(), patchi)
Definition: createFields.H:52
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
transportProperties
IOdictionary transportProperties(IOobject("transportProperties", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
magnets
Info<< "Reading field psi\n"<< endl;volScalarField psi(IOobject("psi", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Reading transportProperties\n"<< endl;IOdictionary transportProperties(IOobject("transportProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));List< magnet > magnets(transportProperties.lookup("magnets"))
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
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
murf
surfaceScalarField murf(IOobject("murf", runTime.timeName(), mesh), mesh, dimensionedScalar("one", dimless, 1.0))
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Mrf
surfaceScalarField Mrf(IOobject("Mrf", runTime.timeName(), mesh), mesh, dimensionedScalar(dimensionSet(0, 1, 0, 0, 0, 1, 0), Zero))
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:54
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Foam::surfaceVectorField
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
Definition: surfaceFieldsFwd.H:59
psi
const volScalarField & psi
Definition: createFields.H:11
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189