def _correctPhi(runTime, mesh, pimple, p, U, rAU, phi, pRefCell, pRefValue, cumulativeContErr): if mesh.changing(): for patchi in range(U.ext_boundaryField().size()): if U.ext_boundaryField()[patchi].fixesValue(): U.ext_boundaryField()[patchi].initEvaluate() pass pass for patchi in range(U.ext_boundaryField().size()): if U.ext_boundaryField()[patchi].fixesValue(): U.ext_boundaryField()[patchi].evaluate() phi.ext_boundaryField()[patchi] << ( U.ext_boundaryField()[patchi] & mesh.Sf().ext_boundaryField()[patchi]) pass pass pass pcorrTypes = ref.wordList(p.ext_boundaryField().size(), ref.zeroGradientFvPatchScalarField.typeName) for i in range(p.ext_boundaryField().size()): if p.ext_boundaryField()[i].fixesValue(): pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName pass pass pcorr = ref.volScalarField( ref.IOobject(ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh, ref.dimensionedScalar(ref.word("pcorr"), p.dimensions(), 0.0), pcorrTypes) while pimple.correctNonOrthogonal(): pcorrEqn = (ref.fvm.laplacian(rAU, pcorr) == ref.fvc.div(phi)) pcorrEqn.setReference(pRefCell, pRefValue) pcorrEqn.solve() if pimple.finalNonOrthogonalIter(): phi << phi() - pcorrEqn.flux() # mixed calculations pass pass cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr) return cumulativeContErr
def _correctPhi( runTime, mesh, pimple, p, U, rAU, phi, pRefCell, pRefValue, cumulativeContErr ): if mesh.changing(): for patchi in range( U.ext_boundaryField().size() ): if U.ext_boundaryField()[patchi].fixesValue(): U.ext_boundaryField()[patchi].initEvaluate() pass pass for patchi in range( U.ext_boundaryField().size() ): if U.ext_boundaryField()[patchi].fixesValue(): U.ext_boundaryField()[patchi].evaluate() phi.ext_boundaryField()[patchi] << ( U.ext_boundaryField()[patchi] & mesh.Sf().ext_boundaryField()[patchi] ) pass pass pass pcorrTypes = ref.wordList( p.ext_boundaryField().size(), ref.zeroGradientFvPatchScalarField.typeName ) for i in range( p.ext_boundaryField().size() ): if p.ext_boundaryField()[i].fixesValue(): pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName pass pass pcorr = ref.volScalarField( ref.IOobject( ref.word( "pcorr" ), ref.fileName( runTime.timeName() ), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE ), mesh, ref.dimensionedScalar( ref.word( "pcorr" ), p.dimensions(), 0.0), pcorrTypes ) while pimple.correctNonOrthogonal(): pcorrEqn = ( ref.fvm.laplacian( rAU, pcorr ) == ref.fvc.div( phi ) ) pcorrEqn.setReference(pRefCell, pRefValue) pcorrEqn.solve() if pimple.finalNonOrthogonalIter(): phi << phi() - pcorrEqn.flux() # mixed calculations pass pass cumulativeContErr = ref.ContinuityErrs( phi, runTime, mesh, cumulativeContErr ) return cumulativeContErr
def fun_correctPhi(runTime, mesh, phi, phiAbs, p, p_rgh, rho, U, cumulativeContErr, pimple, pRefCell, pRefValue): cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr) pcorrTypes = ref.wordList(p_rgh.ext_boundaryField().size(), ref.zeroGradientFvPatchScalarField.typeName) for i in range(p.ext_boundaryField().size()): if p_rgh.ext_boundaryField()[i].fixesValue(): pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName pass pass pcorr = ref.volScalarField( ref.IOobject( ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE ), mesh, ref.dimensionedScalar(ref.word("pcorr"), p_rgh.dimensions(), 0.0), pcorrTypes, ) rAUf = ref.dimensionedScalar(ref.word("(1|A(U))"), ref.dimTime / rho.dimensions(), 1.0) ref.adjustPhi(phi, U, pcorr) ref.fvc.makeAbsolute(phi, U) while pimple.correctNonOrthogonal(): pcorrEqn = ref.fvm.laplacian(rAUf, pcorr) == ref.fvc.div(phi) pcorrEqn.setReference(pRefCell, pRefValue) pcorrEqn.solve() if pimple.finalNonOrthogonalIter(): phi -= pcorrEqn.flux() phiAbs << phi ref.fvc.makeRelative(phi, U) pass cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr) return cumulativeContErr
def correctPhi(runTime, mesh, phi, p, p_rgh, rho, U, cumulativeContErr, pimple, pRefCell, pRefValue): cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr) pcorrTypes = ref.wordList(p_rgh.ext_boundaryField().size(), ref.zeroGradientFvPatchScalarField.typeName) for i in range(p.ext_boundaryField().size()): if p_rgh.ext_boundaryField()[i].fixesValue(): pcorrTypes[i] = ref.fixedValueFvPatchScalarField.typeName pass pass pcorr = ref.volScalarField( ref.IOobject(ref.word("pcorr"), ref.fileName(runTime.timeName()), mesh, ref.IOobject.NO_READ, ref.IOobject.NO_WRITE), mesh(), ref.dimensionedScalar(ref.word("pcorr"), p_rgh.dimensions(), 0.0), pcorrTypes) rAUf = ref.dimensionedScalar(ref.word("(1|A(U))"), ref.dimTime / rho.dimensions(), 1.0) ref.adjustPhi(phi, U, pcorr) while pimple.correctNonOrthogonal(): pcorrEqn = ref.fvm.laplacian(rAUf, pcorr) == ref.fvc.div(phi) pcorrEqn.setReference(pRefCell, pRefValue) pcorrEqn.solve() if pimple.finalNonOrthogonalIter(): phi -= pcorrEqn.flux() pass cumulativeContErr = ref.ContinuityErrs(phi, runTime, mesh, cumulativeContErr) return cumulativeContErr
def pyWordList(pyList): size = len(pyList) ret = ref.wordList(size) for i in xrange(size): ret[i] = ref.word(pyList[i]) return ret