electric fields and Poisson's equation

This commit is contained in:
ignis 2018-08-12 23:13:02 -04:00
parent 0053fcb48b
commit 2746e92165
4 changed files with 103 additions and 0 deletions

17
PhiEqn.H Normal file
View file

@ -0,0 +1,17 @@
{
solve
(
fvm::laplacian(Phi) + rho * thermo.composition().Qc() /epsilon0
);
E = -fvc::grad(Phi);
snE = -fvc::snGrad(Phi);
// tmp<volScalarField> tMagE (mag(E));
// const volScalarField &magE = tMagE();
// magE.writeMinMax(Info);
// En = magE / (ng);
}

82
createElectricField.H Normal file
View file

@ -0,0 +1,82 @@
Info<< "Reading physicalProperties\n" << endl;
IOdictionary physicalProperties
(
IOobject
(
"physicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
);
dimensionedScalar epsilon0
(
physicalProperties.lookup("epsilon0")
);
dimensionedScalar k
(
physicalProperties.lookup("k")
);
Info<< "Reading field Phi\n" << endl;
volScalarField Phi
(
IOobject
(
"Phi",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field rhoc\n" << endl;
volScalarField rhoc
(
IOobject
(
"rhoc",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Creating field electric field\n" << endl;
volVectorField E
(
IOobject
(
"E",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
-fvc::grad(Phi)
);
surfaceScalarField snE
(
IOobject
(
"snE",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
-fvc::snGrad(Phi)
);

View file

@ -1,3 +1,5 @@
#include "createElectricField.H"
Info<< "Creating reaction model\n" << endl;
autoPtr<combustionModels::psiCombustionModel> reaction

View file

@ -94,6 +94,8 @@ int main(int argc, char *argv[])
while (pimple.loop())
{
#include "PhiEqn.H"
diff.correct();
#include "UEqn.H"