initpEqn.H
Go to the documentation of this file.
1
13{
14 volScalarField rAU(permeability/mu); //K/mu
15 surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));//rho/A on surface
16 volVectorField HbyA(U*0);
17
18 surfaceScalarField phig("phig",(fvc::interpolate(rho)*rhorAUf * g) & mesh.Sf());
19
20 surfaceScalarField phiHbyA
21 (
22 "phiHbyA",
23 phig
24 );
25 // Update the pressure BCs to ensure flux consistency
27
28 // fvScalarMatrix p_rghDDtEqn
29 // (
30 // porosity*rho*beta_f*fvm::ddt(p)
31 // -porosity*rho*alpha_f*fvc::ddt(T)
32 // +
33 // fvc::div(phiHbyA)
34 // );
35 while (pimple.correctNonOrthogonal())
36 {
37 fvScalarMatrix pEqn
38 (
39 fvc::div(phiHbyA) - fvm::laplacian(rhorAUf, p)
40 );
41 pEqn.solve();
42 if (pimple.finalNonOrthogonalIter())
43 {
44 // option 1: calculate velocity using Darcy's law directly
45 // U=-permeability/mu*(fvc::grad(p)-rho*g);
46
47 // option 2: using flux reconstruct velocity
48 phi = phiHbyA + pEqn.flux();
49
50 U = HbyA + rAU*fvc::reconstruct((phig + pEqn.flux())/rhorAUf);
51 U.correctBoundaryConditions();
52 }
53 }
54}
volScalarField & p
Definition: createFields.H:10
volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), mesh, dimensionedVector("U", dimensionSet(0, 1,-1, 0, 0, 0, 0), vector::zero))
volScalarField permeability(IOobject("permeability", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh)
surfaceScalarField phig("phig",(fvc::interpolate(rho) *rhorAUf *g) &mesh.Sf())
volVectorField HbyA(U *0)
constrainPressure(p, rho, U, phiHbyA, rhorAUf)
surfaceScalarField phiHbyA("phiHbyA", phig)
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho *rAU))
mu
Definition: updateProps.H:3
rho
Definition: updateProps.H:2