diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index e0300c915241a01b3da3e105bf007550d57528a9..69b9e9f8306a3502980318c0e3e34bd707d18c0f 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -241,6 +241,7 @@ $(derivedFvPatchFields)/swirlFanVelocity/swirlFanVelocityFvPatchField.C $(derivedFvPatchFields)/acousticWaveTransmissive/acousticWaveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/prghPermeableAlphaTotalPressure/prghPermeableAlphaTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/pressurePermeableAlphaInletOutletVelocity/pressurePermeableAlphaInletOutletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C $(derivedFvPatchFields)/mappedMixed/mappedMixedFvPatchFields.C $(derivedFvPatchFields)/mappedField/Sampled/makeSampledPatchFunction1s.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..1c36d90d8173528a3a899f0d3472107613ccc04b --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.C @@ -0,0 +1,593 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "electrostaticDepositionFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::electrostaticDepositionFvPatchScalarField& +Foam::electrostaticDepositionFvPatchScalarField::eVPatch +( + const label patchi +) const +{ + const auto& eV = + db().lookupObject<volScalarField>(this->internalField().name()); + + const volScalarField::Boundary& bf = eV.boundaryField(); + + const auto& eVpf = + refCast<const electrostaticDepositionFvPatchScalarField>(bf[patchi]); + + return const_cast<electrostaticDepositionFvPatchScalarField&>(eVpf); +} + + +void Foam::electrostaticDepositionFvPatchScalarField::setMaster() const +{ + if (master_ != -1) + { + return; + } + + const auto& eV = + db().lookupObject<volScalarField>(this->internalField().name()); + + const volScalarField::Boundary& bf = eV.boundaryField(); + + label master = -1; + forAll(bf, patchi) + { + if (isA<electrostaticDepositionFvPatchScalarField>(bf[patchi])) + { + electrostaticDepositionFvPatchScalarField& eVpf = eVPatch(patchi); + + if (master == -1) + { + master = patchi; + } + + eVpf.master() = master; + } + } +} + + +void Foam::electrostaticDepositionFvPatchScalarField::round +( + scalarField& fld, + const scalar dcml +) const +{ + for (auto& f : fld) + { + f = std::round(f*dcml)/dcml; + } +} + + +void Foam::electrostaticDepositionFvPatchScalarField::writeFilmFields() const +{ + const auto& eV = + db().lookupObject<volScalarField>(this->internalField().name()); + + const volScalarField::Boundary& bf = eV.boundaryField(); + + const fvMesh& mesh = eV.mesh(); + + volScalarField h + ( + IOobject + ( + IOobject::scopedName(word("electrostaticDeposition"), "h"), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false // do not register + ), + mesh, + dimensionedScalar(dimLength) + ); + + forAll(bf, patchi) + { + if (isA<electrostaticDepositionFvPatchScalarField>(bf[patchi])) + { + electrostaticDepositionFvPatchScalarField& eVpf = eVPatch(patchi); + + auto& hp = h.boundaryFieldRef()[patchi]; + + hp = eVpf.h(); + } + } + + h.write(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::electrostaticDepositionFvPatchScalarField:: +electrostaticDepositionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(p, iF), + h_(p.size(), 0), + qcum_(p.size(), 0), + Vfilm_(p.size(), 0), + Ceffptr_(nullptr), + rptr_(nullptr), + jMin_(0), + qMin_(0), + Rbody_(0), + Vi_(0), + Vanode_(GREAT), + phasesDict_(), + phaseNames_(), + phases_(), + sigmas_(), + sigma_(sqr(dimCurrent)*pow3(dimTime)/(dimMass*pow3(dimLength)), scalar(1)), + timei_(-1), + master_(-1) +{} + + +Foam::electrostaticDepositionFvPatchScalarField:: +electrostaticDepositionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict, false), + h_("h", dict, p.size()), + qcum_ + ( + dict.found("qCumulative") + ? scalarField("qCumulative", dict, p.size()) + : scalarField(p.size(), 0) + ), + Vfilm_ + ( + dict.found("Vfilm") + ? scalarField("Vfilm", dict, p.size()) + : scalarField(p.size(), 0) + ), + Ceffptr_ + ( + PatchFunction1<scalar>::New(p.patch(), "CoulombicEfficiency", dict) + ), + rptr_(PatchFunction1<scalar>::New(p.patch(), "resistivity", dict)), + jMin_(dict.getCheckOrDefault<scalar>("jMin", 0, scalarMinMax::ge(0))), + qMin_(dict.getCheckOrDefault<scalar>("qMin", 0, scalarMinMax::ge(0))), + Rbody_(dict.getCheckOrDefault<scalar>("Rbody", 0, scalarMinMax::ge(0))), + Vi_(dict.getOrDefault<scalar>("Vi", 0)), + Vanode_(dict.getOrDefault<scalar>("Vanode", GREAT)), + phasesDict_(dict.subOrEmptyDict("phases")), + phaseNames_(), + phases_(), + sigmas_(), + sigma_ + ( + dimensionedScalar + ( + sqr(dimCurrent)*pow3(dimTime)/(dimMass*pow3(dimLength)), + dict.getCheckOrDefault<scalar> + ( + "sigma", + scalar(1), + scalarMinMax::ge(SMALL) + ) + ) + ), + timei_(-1), + master_(-1) +{ + if (dict.found("value")) + { + fvPatchScalarField::operator= + ( + scalarField("value", dict, p.size()) + ); + } + else + { + fvPatchScalarField::operator=(patchInternalField()); + } + + // If flow is multiphase + if (!phasesDict_.empty()) + { + phaseNames_.setSize(phasesDict_.size()); + phases_.setSize(phasesDict_.size()); + sigmas_.setSize(phasesDict_.size()); + + label phasei = 0; + forAllConstIters(phasesDict_, iter) + { + const word& key = iter().keyword(); + + if (!phasesDict_.isDict(key)) + { + FatalErrorInFunction + << "Found non-dictionary entry " << iter() + << " in top-level dictionary " << phasesDict_ + << exit(FatalError); + } + + const dictionary& subDict = phasesDict_.subDict(key); + + phaseNames_[phasei] = key; + + sigmas_.set + ( + phasei, + new dimensionedScalar + ( + sqr(dimCurrent)*pow3(dimTime)/(dimMass*pow3(dimLength)), + subDict.getCheck<scalar> + ( + "sigma", + scalarMinMax::ge(SMALL) + ) + ) + ); + + ++phasei; + } + + forAll(phaseNames_, i) + { + phases_.set + ( + i, + db().getObjectPtr<volScalarField>(phaseNames_[i]) + ); + } + } +} + + +Foam::electrostaticDepositionFvPatchScalarField:: +electrostaticDepositionFvPatchScalarField +( + const electrostaticDepositionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + h_(ptf.h_, mapper), + qcum_(ptf.qcum_, mapper), + Vfilm_(ptf.Vfilm_, mapper), + Ceffptr_(ptf.Ceffptr_.clone(p.patch())), + rptr_(ptf.rptr_.clone(p.patch())), + jMin_(ptf.jMin_), + qMin_(ptf.qMin_), + Rbody_(ptf.Rbody_), + Vi_(ptf.Vi_), + Vanode_(ptf.Vanode_), + phasesDict_(ptf.phasesDict_), + phaseNames_(ptf.phaseNames_), + phases_(ptf.phases_), + sigmas_(), + sigma_(ptf.sigma_), + timei_(ptf.timei_), + master_(-1) +{} + + +Foam::electrostaticDepositionFvPatchScalarField:: +electrostaticDepositionFvPatchScalarField +( + const electrostaticDepositionFvPatchScalarField& ptf +) +: + fixedValueFvPatchScalarField(ptf), + h_(ptf.h_), + qcum_(ptf.qcum_), + Vfilm_(ptf.Vfilm_), + Ceffptr_(ptf.Ceffptr_.clone(patch().patch())), + rptr_(ptf.rptr_.clone(patch().patch())), + jMin_(ptf.jMin_), + qMin_(ptf.qMin_), + Rbody_(ptf.Rbody_), + Vi_(ptf.Vi_), + Vanode_(ptf.Vanode_), + phasesDict_(ptf.phasesDict_), + phaseNames_(ptf.phaseNames_), + phases_(ptf.phases_), + sigmas_(), + sigma_(ptf.sigma_), + timei_(ptf.timei_), + master_(-1) +{} + + +Foam::electrostaticDepositionFvPatchScalarField:: +electrostaticDepositionFvPatchScalarField +( + const electrostaticDepositionFvPatchScalarField& ptf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(ptf, iF), + h_(ptf.h_), + qcum_(ptf.qcum_), + Vfilm_(ptf.Vfilm_), + Ceffptr_(ptf.Ceffptr_.clone(patch().patch())), + rptr_(ptf.rptr_.clone(patch().patch())), + jMin_(ptf.jMin_), + qMin_(ptf.qMin_), + Rbody_(ptf.Rbody_), + Vi_(ptf.Vi_), + Vanode_(ptf.Vanode_), + phasesDict_(ptf.phasesDict_), + phaseNames_(ptf.phaseNames_), + phases_(ptf.phases_), + sigmas_(), + sigma_(ptf.sigma_), + timei_(ptf.timei_), + master_(-1) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::electrostaticDepositionFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + + h_.autoMap(m); + qcum_.autoMap(m); + Vfilm_.autoMap(m); + + if (Ceffptr_) + { + Ceffptr_->autoMap(m); + } + + if (rptr_) + { + rptr_->autoMap(m); + } +} + + +void Foam::electrostaticDepositionFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const auto& tiptf = + refCast<const electrostaticDepositionFvPatchScalarField>(ptf); + + h_.rmap(tiptf.h_, addr); + qcum_.rmap(tiptf.qcum_, addr); + Vfilm_.rmap(tiptf.Vfilm_, addr); + + if (Ceffptr_) + { + Ceffptr_->rmap(tiptf.Ceffptr_(), addr); + } + + if (rptr_) + { + rptr_->rmap(tiptf.rptr_(), addr); + } +} + + +Foam::tmp<Foam::scalarField> +Foam::electrostaticDepositionFvPatchScalarField::sigma() const +{ + const label patchi = patch().index(); + + if (phases_.size()) + { + tmp<scalarField> tsigma = + phases_[0].boundaryField()[patchi]*sigmas_[0].value(); + + for (label i = 1; i < phases_.size(); ++i) + { + tsigma.ref() += + phases_[i].boundaryField()[patchi]*sigmas_[i].value(); + } + + return tsigma; + } + + return tmp<scalarField>::New(patch().size(), sigma_.value()); +} + + +void Foam::electrostaticDepositionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + if (timei_ == db().time().timeIndex()) + { + return; + } + + const scalar t = db().time().timeOutputValue(); + const scalar dt = db().time().deltaTValue(); + const label patchi = patch().index(); + + const auto& eV = + db().lookupObject<volScalarField>(this->internalField().name()); + + // Current density on film interface + tmp<scalarField> tjnp = -this->sigma()*eV.boundaryField()[patchi].snGrad(); + scalarField& jnp = tjnp.ref(); + jnp = max(jnp, scalar(0)); // experimental - do not allow any negative jnp + // experimental - avoid micro/nano currents/volts + // to reduce snowballing effects of lateral gradients on the patch + round(jnp); + + + // Calculate film-thickness finite increments + tmp<scalarField> tCoulombicEfficiency = Ceffptr_->value(t); + tmp<scalarField> tdh = tCoulombicEfficiency*(jnp - jMin_)*dt; + scalarField& dh = tdh.ref(); + + // Do not allow any depletion or abrasion of deposition + dh = max(dh, scalar(0)); + + // Do not allow any deposition when accumulative specific + // charge is less than minimum accumulative specific charge + qcum_ += jnp*dt; + + forAll(dh, i) + { + if (qcum_[i] < qMin_) + { + dh[i] = 0; + } + } + + // Add finite increments of film thickness to total film thickness + h_ += dh; + + + // Calculate incremental electric potential due to film resistance + tmp<scalarField> tresistivity = rptr_->value(t); + tmp<scalarField> tRfilm = tresistivity*tdh; + tmp<scalarField> tdV = jnp*tRfilm; + Vfilm_ += tdV; + Vfilm_ = min(Vfilm_, Vanode_); + + + // Calculate electric potential due to body resistance + tmp<scalarField> tVbody = tjnp*Rbody_; + + + // Add all electric potential contributions + operator==(min(Vi_ + Vfilm_ + tVbody, Vanode_)); + + + fixedValueFvPatchScalarField::updateCoeffs(); + + timei_ = db().time().timeIndex(); + + { + const scalar hMin = gMin(h_); + const scalar hMax = gMax(h_); + const scalar hAvg = gAverage(h_); + + if (Pstream::master()) + { + Info<< " patch: " << patch().name() + << ", h: min = " << hMin + << ", max = " << hMax + << ", average = " << hAvg << nl + << endl; + } + } + + // Write here to avoid any upset to redistributePar-decompose + if (db().time().writeTime()) + { + // Write film thickness fields as patch fields of a volScalarField + setMaster(); + + if (patch().index() == master_) + { + writeFilmFields(); + } + } +} + + +void Foam::electrostaticDepositionFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + + h_.writeEntry("h", os); + + if (Ceffptr_) + { + Ceffptr_->writeData(os); + } + + if (rptr_) + { + rptr_->writeData(os); + } + + if (!phasesDict_.empty()) + { + phasesDict_.writeEntry(phasesDict_.dictName(), os); + } + else + { + sigma_.writeEntry("sigma", os); + } + + os.writeEntryIfDifferent<scalar>("jMin", 0, jMin_); + os.writeEntryIfDifferent<scalar>("qMin", 0, qMin_); + os.writeEntryIfDifferent<scalar>("Rbody", 0, Rbody_); + os.writeEntryIfDifferent<scalar>("Vi", 0, Vi_); + os.writeEntryIfDifferent<scalar>("Vanode", GREAT, Vanode_); + qcum_.writeEntry("qCumulative", os); + Vfilm_.writeEntry("Vfilm", os); + + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + electrostaticDepositionFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..efda99389e287db995b4078a158f7705e67c137a --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/electrostaticDeposition/electrostaticDepositionFvPatchScalarField.H @@ -0,0 +1,385 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::electrostaticDepositionFvPatchScalarField + +Group + grpGenericBoundaryConditions + +Description + The \c electrostaticDeposition is a boundary condition to + calculate electric potential (\c V) on a given boundary + based on film thickness (\c h) and film resistance (\c R) fields + which are updated based on a given patch-normal current density + field (\c jn), Coulombic efficiency and film resistivity. + + \f[ + j_n = - \sigma \nabla^\perp_p V = - \sigma (\vec{n}\cdot(\nabla V)_p) + \f] + + \f[ + \frac{dh}{dt} = C_{eff} (j_n - j_{min}) + \f] + + \f[ + \frac{dR}{dt} = \rho \frac{dh}{dt} = \rho C_{eff} (j_n - j_{min}) + \f] + + \f[ + V_{film}^n = V_{film}^o + j_n R_\Delta + \f] + + \f[ + V_{body} = j_n R_{body} + \f] + + \f[ + V_p^n = V_i + V_{body} + V_{film}^n + \f] + + where + \vartable + j_n | Patch-normal current density [A/m^2] + V_p^n | Electric potential on film-fluid interface [volt = kg m^2/(A s^3)] + V_p^o | Previous time-step electric potential on the interface [volt] + V_{film} | Electric potential due to film resistance [volt] + V_{body} | Electric potential due to body resistance [volt] + V_i | Initial electric potential [volt] + R_\Delta| Film resistance (finite increment) [ohm m^2 = kg m^4/(A^2 s^3)] + R_{body} | Body resistance [ohm m^2 = kg m^4/(A^2 s^3)] + \rho | Isotropic film resistivity [ohm m = kg m^3/(A^2 s^3)] + h | Film thickness [m] + C_{eff} | Volumetric Coulombic efficiency [m^3/(A s)] + j_{min} | Minimum current density for deposition onset [A/m^2] + \sigma | Isotropic conductivity of mixture [S/m = A^2 s^3/(kg m^3)] + \vec{n} | Patch-normal unit vector [-] + \endvartable + +Usage + Example of the boundary condition specification: + \verbatim + <patchName> + { + // Mandatory entries + type electrostaticDeposition; + h <scalarField>; + CoulombicEfficiency <PatchFunction1>; + resistivity <PatchFunction1>; + + // Conditional mandatory entries + + // Option-1: single-phase + sigma <scalar>; + + // Option-2: multiphase + phases + { + alpha.air + { + sigma <scalar>; + } + alpha.water + { + sigma <scalar>; + } + alpha.mercury + { + sigma <scalar>; + } + ... + } + + // Optional entries + jMin <scalar>; + qMin <scalar>; + Rbody <scalar>; + Vi <scalar>; + Vanode <scalar>; + qCumulative <scalarField>; + + // Inherited entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: electrostaticDeposition | word | yes | - + h | Film thickness | scalarField | yes | - + CoulombicEfficiency | Coulombic efficiency <!-- + --> | PatchFunction1\<scalar\> | yes | - + resistivity | Isotropic film resistivity <!-- + --> | PatchFunction1\<scalar\> | yes | - + sigma | Isotropic electrical conductivity of phase | scalar | yes | - + jMin | Minimum current density for deposition onset | scalar | no | 0 + qMin | Minimum accumulative specific charge for deposition onset <!-- + --> | scalar | no | 0 + Rbody | Resistance due to main body and/or <!-- + --> pretreatment layers | scalar | no | 0 + Vi | Initial electric potential | scalar | no | 0 + Vanode | Anode electric potential | scalar | no | GREAT + qCumulative | Accumulative specific charge [A s/m^2] <!-- + --> | scalarField | no | 0 + \endtable + + The inherited entries are elaborated in: + - \link fixedValueFvPatchFields.H \endlink + - \link PatchFunction1.H \endlink + +Note + - Depletion or abrasion of material due to negative current is not allowed. + - When accumulative specific charge (\c qCumulative) is less than minimum + accumulative specific charge (\c qMin), no deposition occurs. + - Boundary-condition updates are not allowed during outer corrections + to prevent spurious accumulation of film thickness. + - \c resistivity, \c jMin, \c qMin and \c Rbody are always non-negative. + +SourceFiles + electrostaticDepositionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef electrostaticDepositionFvPatchScalarField_H +#define electrostaticDepositionFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" +#include "Enum.H" +#include "PatchFunction1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class electrostaticDepositionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class electrostaticDepositionFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private Data + + //- Film thickness + scalarField h_; + + //- Accumulative specific charge + scalarField qcum_; + + //- Electric potential due to film resistance + scalarField Vfilm_; + + //- Coulombic efficiency + autoPtr<PatchFunction1<scalar>> Ceffptr_; + + //- Isotropic film resistivity + autoPtr<PatchFunction1<scalar>> rptr_; + + //- Minimum current density for the deposition onset + scalar jMin_; + + //- Minimum accumulative specific charge for the deposition onset + scalar qMin_; + + //- Resistance due to main body and/or pretreatment layers + scalar Rbody_; + + //- Initial electric potential + scalar Vi_; + + //- Anode electric potential + scalar Vanode_; + + // Isotropic electrical conductivitiy properties + + //- Dictionary of phase data + dictionary phasesDict_; + + //- List of phase names + wordList phaseNames_; + + //- Unallocated list of phase fields + UPtrList<volScalarField> phases_; + + //- List of isotropic electrical conductivity of phases + PtrList<dimensionedScalar> sigmas_; + + //- Isotropic electrical conductivity of a single phase + dimensionedScalar sigma_; + + //- Time index - used to prevent film accumulation during outer iters + label timei_; + + //- Master patch ID + mutable label master_; + + + // Private Member Functions + + //- Return non-const access to an electrostaticDeposition patch + electrostaticDepositionFvPatchScalarField& eVPatch + ( + const label patchi + ) const; + + //- Return non-const access to the master patch ID + label& master() noexcept + { + return master_; + } + + //- Set master patch ID + void setMaster() const; + + //- Round scalars of a given scalar field to dcml points decimal + void round(scalarField& fld, const scalar dcml=1e8) const; + + //- Write film thickness field to facilitate postprocessing + void writeFilmFields() const; + + +public: + + //- Runtime type information + TypeName("electrostaticDeposition"); + + + // Constructors + + //- Construct from patch and internal field + electrostaticDepositionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + electrostaticDepositionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + //- electrostaticDepositionFvPatchScalarField onto a new patch + electrostaticDepositionFvPatchScalarField + ( + const electrostaticDepositionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + electrostaticDepositionFvPatchScalarField + ( + const electrostaticDepositionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new electrostaticDepositionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + electrostaticDepositionFvPatchScalarField + ( + const electrostaticDepositionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new electrostaticDepositionFvPatchScalarField(*this, iF) + ); + } + + + // Member Functions + + // Access + + //- Return const access to film thickness patch field + const scalarField& h() const noexcept + { + return h_; + } + + + // Mapping + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // Evaluation + + //- Return the isotropic electrical conductivity field of mixture + tmp<scalarField> sigma() const; + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/functionObjects/solvers/Make/files b/src/functionObjects/solvers/Make/files index ce5306b1c832eeec2a0dea067368eb313e450a49..b37d8bafb0eaa63ecc4f74aa1fd95640eecab001 100644 --- a/src/functionObjects/solvers/Make/files +++ b/src/functionObjects/solvers/Make/files @@ -1,4 +1,5 @@ scalarTransport/scalarTransport.C energyTransport/energyTransport.C +electricPotential/electricPotential.C LIB = $(FOAM_LIBBIN)/libsolverFunctionObjects diff --git a/src/functionObjects/solvers/electricPotential/electricPotential.C b/src/functionObjects/solvers/electricPotential/electricPotential.C new file mode 100644 index 0000000000000000000000000000000000000000..92d6b8913d1da8131910d3babfa36ed79013b8e0 --- /dev/null +++ b/src/functionObjects/solvers/electricPotential/electricPotential.C @@ -0,0 +1,423 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "electricPotential.H" +#include "fvc.H" +#include "fvm.H" +#include "calculatedFvPatchField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + defineTypeNameAndDebug(electricPotential, 0); + addToRunTimeSelectionTable(functionObject, electricPotential, dictionary); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::volScalarField& +Foam::functionObjects::electricPotential::operandField() +{ + if (!foundObject<volScalarField>(fieldName_)) + { + auto tfldPtr = tmp<volScalarField>::New + ( + IOobject + ( + fieldName_, + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh_ + ); + store(fieldName_, tfldPtr); + } + + return lookupObjectRef<volScalarField>(fieldName_); +} + + +Foam::tmp<Foam::volScalarField> +Foam::functionObjects::electricPotential::sigma() const +{ + const IOobject sigmaIO + ( + IOobject::scopedName(typeName, "sigma"), + mesh_.time().timeName(), + mesh_.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ); + + if (phases_.size()) + { + tmp<volScalarField> tsigma = phases_[0]*sigmas_[0]; + + for (label i = 1; i < phases_.size(); ++i) + { + tsigma.ref() += phases_[i]*sigmas_[i]; + } + + return tmp<volScalarField>::New + ( + sigmaIO, + tsigma, + calculatedFvPatchField<scalar>::typeName + ); + } + + return tmp<volScalarField>::New + ( + sigmaIO, + mesh_, + sigma_, + calculatedFvPatchField<scalar>::typeName + ); +} + + +Foam::tmp<Foam::volScalarField> +Foam::functionObjects::electricPotential::epsilonm() const +{ + // Vacuum permittivity (aka the electric constant) [A^2 s^4/(kg m^3)] + const dimensionedScalar epsilon0 + ( + sqr(dimCurrent)*pow4(dimTime)/(dimMass*pow3(dimLength)), + 8.8541878128e-12 // CODATA value + ); + + const IOobject epsilonrIO + ( + IOobject::scopedName(typeName, "epsilonr"), + mesh_.time().timeName(), + mesh_.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ); + + if (phases_.size()) + { + tmp<volScalarField> tepsilonr = phases_[0]*epsilonrs_[0]; + + for (label i = 1; i < phases_.size(); ++i) + { + tepsilonr.ref() += phases_[i]*epsilonrs_[i]; + } + + return tmp<volScalarField>::New + ( + epsilonrIO, + epsilon0*tepsilonr, + calculatedFvPatchField<scalar>::typeName + ); + } + + return tmp<volScalarField>::New + ( + epsilonrIO, + mesh_, + epsilon0*epsilonr_, + calculatedFvPatchField<scalar>::typeName + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::functionObjects::electricPotential::electricPotential +( + const word& name, + const Time& runTime, + const dictionary& dict +) +: + fvMeshFunctionObject(name, runTime, dict), + phasesDict_(dict.subOrEmptyDict("phases")), + phaseNames_(), + phases_(), + sigmas_(), + sigma_ + ( + dimensionedScalar + ( + sqr(dimCurrent)*pow3(dimTime)/(dimMass*pow3(dimLength)), + dict.getCheckOrDefault<scalar> + ( + "sigma", + scalar(1), + scalarMinMax::ge(SMALL) + ) + ) + ), + epsilonrs_(), + epsilonr_ + ( + dimensionedScalar + ( + dimless, + dict.getCheckOrDefault<scalar> + ( + "epsilonr", + scalar(1), + scalarMinMax::ge(SMALL) + ) + ) + ), + fieldName_ + ( + dict.getOrDefault<word> + ( + "field", + IOobject::scopedName(typeName, "V") + ) + ), + nCorr_(1), + writeDerivedFields_(false) +{ + read(dict); + + // Force creation of transported field so any BCs using it can + // look it up + volScalarField& eV = operandField(); + eV.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::functionObjects::electricPotential::read(const dictionary& dict) +{ + if (fvMeshFunctionObject::read(dict)) + { + Log << type() << " read: " << name() << endl; + + dict.readIfPresent("sigma", sigma_); + dict.readIfPresent("epsilonr", epsilonr_); + dict.readIfPresent("nCorr", nCorr_); + dict.readIfPresent("writeDerivedFields", writeDerivedFields_); + + // If flow is multiphase + if (!phasesDict_.empty()) + { + phaseNames_.setSize(phasesDict_.size()); + phases_.setSize(phasesDict_.size()); + sigmas_.setSize(phasesDict_.size()); + + if (writeDerivedFields_) + { + epsilonrs_.setSize(phasesDict_.size()); + } + + label phasei = 0; + forAllConstIters(phasesDict_, iter) + { + const word& key = iter().keyword(); + + if (!phasesDict_.isDict(key)) + { + FatalErrorInFunction + << "Found non-dictionary entry " << iter() + << " in top-level dictionary " << phasesDict_ + << exit(FatalError); + } + + const dictionary& subDict = phasesDict_.subDict(key); + + phaseNames_[phasei] = key; + + sigmas_.set + ( + phasei, + new dimensionedScalar + ( + sqr(dimCurrent)*pow3(dimTime)/(dimMass*pow3(dimLength)), + subDict.getCheck<scalar> + ( + "sigma", + scalarMinMax::ge(SMALL) + ) + ) + ); + + if (writeDerivedFields_) + { + epsilonrs_.set + ( + phasei, + new dimensionedScalar + ( + dimless, + subDict.getCheck<scalar> + ( + "epsilonr", + scalarMinMax::ge(SMALL) + ) + ) + ); + } + + ++phasei; + } + + forAll(phaseNames_, i) + { + phases_.set + ( + i, + mesh_.getObjectPtr<volScalarField>(phaseNames_[i]) + ); + } + } + + return true; + } + + return false; +} + + +bool Foam::functionObjects::electricPotential::execute() +{ + Log << type() << " execute: " << name() << endl; + + tmp<volScalarField> tsigma = this->sigma(); + const volScalarField& sigma = tsigma(); + + volScalarField& eV = operandField(); + + for (label i = 1; i <= nCorr_; ++i) + { + fvScalarMatrix eVEqn + ( + - fvm::laplacian(sigma, eV) + ); + + eVEqn.relax(); + + eVEqn.solve(); + } + + Log << endl; + + return true; +} + + +bool Foam::functionObjects::electricPotential::write() +{ + Log << type() << " write: " << name() << nl + << tab << fieldName_ + << endl; + + volScalarField& eV = operandField(); + + if (writeDerivedFields_) + { + // Write the electric field + const volVectorField E + ( + IOobject + ( + IOobject::scopedName(typeName, "E"), + mesh_.time().timeName(), + mesh_.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + -fvc::grad(eV), + calculatedFvPatchField<vector>::typeName + ); + + Log << tab << E.name() << endl; + + E.write(); + + + // Write the current density field + tmp<volScalarField> tsigma = this->sigma(); + + auto eJ = tmp<volVectorField>::New + ( + IOobject + ( + IOobject::scopedName(typeName, "J"), + mesh_.time().timeName(), + mesh_.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + -tsigma*fvc::grad(eV), + calculatedFvPatchField<vector>::typeName + ); + + Log << tab << eJ().name() << endl; + + eJ->write(); + + + // Write the free-charge density field + tmp<volScalarField> tepsilonm = this->epsilonm(); + + auto erho = tmp<volScalarField>::New + ( + IOobject + ( + IOobject::scopedName(typeName, "rho"), + mesh_.time().timeName(), + mesh_.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + fvc::div(tepsilonm*E), + calculatedFvPatchField<scalar>::typeName + ); + + Log << tab << erho().name() << endl; + + erho->write(); + } + + eV.write(); + + return true; +} + + +// ************************************************************************* // diff --git a/src/functionObjects/solvers/electricPotential/electricPotential.H b/src/functionObjects/solvers/electricPotential/electricPotential.H new file mode 100644 index 0000000000000000000000000000000000000000..83fdfbd7b24ac4c0d82bbf3f28d593ffaa244ea5 --- /dev/null +++ b/src/functionObjects/solvers/electricPotential/electricPotential.H @@ -0,0 +1,275 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::functionObjects::electricPotential + +Group + grpSolversFunctionObjects + +Description + Computes the steady-state equation of charge conservation to obtain + the electric potential by strictly assuming a quasi-static electrostatic + field for single-phase and multiphase applications. + + The steady-state equation of the charge conservation: + + \f[ + \nabla \cdot \left( \sigma \nabla V \right) = 0 + \f] + + where + \vartable + V | Electric potential [volt = kg m^2/(A s^3)] + \sigma | Isotropic conductivity of mixture [S/m = A^2 s^3/(kg m^3)] + \endvartable + + Optionally, electric field, current density and free-charge + density fields can be written out by using the following equations: + + \f[ + \vec{E} = - \nabla V + \f] + + \f[ + \vec{J} = \sigma \vec{E} = - \sigma \nabla V + \f] + + \f[ + \rho_E = \nabla \cdot \left(\epsilon_m \vec{E} \right) + = \nabla \cdot \left(\epsilon_0 \epsilon_r \vec{E} \right) + \f] + + where + \vartable + \vec{E} | Electric field [m kg/(s^3 A)] + \vec{J} | Current density [A/m^2] + \rho_E | Volume charge density [C/m^3 = A s/m^3] + \epsilon_m | Isotropic permittivity of mixture [F/m = A^2 s^4/(kg m^3)] + \epsilon_0 | Isotropic vacuum permittivity [F/m = A^2 s^4/(kg m^3)] + \epsilon_r | Isotropic relative permittivity of mixture [-] + \endvartable + + For multiphase applications, \c sigma and \c epsilonr are blended + (to consider their interface values) by using the simple weighted + arithmetic mean interpolation, for example: + + \f[ + \sigma = \alpha_1 \sigma_1 + \alpha_2 \sigma_2 + = \alpha_1 \sigma_1 + (1 - \alpha_1) \sigma_2 + \f] + +Usage + Minimal example by using \c system/controlDict.functions: + \verbatim + electricPotential1 + { + // Mandatory entries + type electricPotential; + libs (solverFunctionObjects); + + // Conditional entries + + // Option-1: single-phase + sigma <scalar>; + epsilonr <scalar>; + + // Option-2: multiphase + phases + { + alpha.air + { + sigma <scalar>; + epsilonr <scalar>; + } + alpha.water + { + sigma <scalar>; + epsilonr <scalar>; + } + alpha.mercury + { + sigma <scalar>; + epsilonr <scalar>; + } + ... + } + + // Optional entries + nCorr <label>; + writeDerivedFields <bool>; + fieldName <word>; + + // Inherited entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: electricPotential | word | yes | - + libs | Library name: solverFunctionObjects | word | yes | - + sigma | Isotropic electrical conductivity of phase | scalar | yes | - + epsilonr | Isotropic relative permittivity of phase | scalar | no | - + nCorr | Number of corrector iterations | label | no | 1 + writeDerivedFields | Flag to write extra fields | bool | no | false + fieldName | Name of operand field | word | no | electricPotential:V + \endtable + + The inherited entries are elaborated in: + - \link functionObject.H \endlink + + Fields written out when the \c writeDerivedFields entry is \c true: + \table + Operand | Type | Location + Electric field | volVectorField | \<time\>/electricPotential:E + Current density | volVectorField | \<time\>/electricPotential:J + Charge density | volScalarField | \<time\>/electricPotential:rho + \endtable + +SourceFiles + electricPotential.C + +\*---------------------------------------------------------------------------*/ + +#ifndef functionObjects_electricPotential_H +#define functionObjects_electricPotential_H + +#include "fvMeshFunctionObject.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace functionObjects +{ + +/*---------------------------------------------------------------------------*\ + Class electricPotential Declaration +\*---------------------------------------------------------------------------*/ + +class electricPotential +: + public fvMeshFunctionObject +{ + // Private Data + + //- Dictionary of phase data + dictionary phasesDict_; + + //- List of phase names + wordList phaseNames_; + + //- Unallocated list of phase fields + UPtrList<volScalarField> phases_; + + //- List of isotropic electrical conductivity of phases + PtrList<dimensionedScalar> sigmas_; + + //- Isotropic electrical conductivity of a single phase + dimensionedScalar sigma_; + + //- List of isotropic relative permittivity of phases + PtrList<dimensionedScalar> epsilonrs_; + + //- Isotropic relative permittivity of a single phase + dimensionedScalar epsilonr_; + + //- Name of the operand field + word fieldName_; + + //- Number of corrector iterations + label nCorr_; + + //- Flag to write derived fields of + //- electric field, current density and free-charge density + bool writeDerivedFields_; + + + // Private Member Functions + + //- Return reference to the registered operand field + volScalarField& operandField(); + + //- Return the isotropic electrical conductivity field of the mixture + tmp<volScalarField> sigma() const; + + //- Return the isotropic permittivity field of the mixture + tmp<volScalarField> epsilonm() const; + + + //- No copy construct + electricPotential(const electricPotential&) = delete; + + //- No copy assignment + void operator=(const electricPotential&) = delete; + + +public: + + //- Runtime type information + TypeName("electricPotential"); + + + // Constructors + + //- Construct from Time and dictionary + electricPotential + ( + const word& name, + const Time& runTime, + const dictionary& dict + ); + + + //- Destructor + virtual ~electricPotential() = default; + + + // Member Functions + + //- Read the function object data + virtual bool read(const dictionary& dict); + + //- Calculate the function object + virtual bool execute(); + + //- Write the function object output + virtual bool write(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace functionObjects +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/U b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/U new file mode 100644 index 0000000000000000000000000000000000000000..a719c0b5a7969de65ddf1aea1765cc2b44b9008d --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/U @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + metalSheet + { + type movingWallVelocity; + value uniform (0 0 0); + } + + "side-.*" + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/alpha.water b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/alpha.water new file mode 100644 index 0000000000000000000000000000000000000000..a1db4410f6f039ffc1bf623c24e3fe83b16e647d --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/alpha.water @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + metalSheet + { + type zeroGradient; + } + + "(side-01|side-06|side-03|side-04|side-05)" + { + type variableHeightFlowRate; + lowerBound 0; + upperBound 1; + value uniform 0; + } + + side-02 + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/electricPotential:V b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/electricPotential:V new file mode 100644 index 0000000000000000000000000000000000000000..e8ddde9aafdccbe2e1042d3d858c30ea369524e6 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/electricPotential:V @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object electricPotential:V; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 2 -3 0 0 -1 0]; + +internalField uniform 0; + +boundaryField +{ + metalSheet + { + // Mandatory entries + type electrostaticDeposition; + h uniform 0; + CoulombicEfficiency uniform 2.14e-08; + resistivity uniform 3.00e+06; + + // Conditional mandatory entries + phases + { + alpha.air + { + sigma 1e-10; + } + alpha.water + { + sigma 0.14; + } + } + + // Optional entries + jMin 0; + qMin 0; + Rbody 0.1; + Vi 0; + qCumulative uniform 0; + + // Inherited entries + value uniform 0; + } + + "side-05" + { + type fixedValue; + value uniform 100; + } + + "(side-01|side-02|side-03|side-04|side-06)" + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/k b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/k new file mode 100644 index 0000000000000000000000000000000000000000..1aa5e1a38ce4e0112976578ba55a85588bc9e6cb --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/k @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 1e-3; + +boundaryField +{ + metalSheet + { + type kqRWallFunction; + value $internalField; + } + + "side-.*" + { + type inletOutlet; + inletValue uniform 1e-3; + value uniform 1e-3; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/nut b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/nut new file mode 100644 index 0000000000000000000000000000000000000000..171d330cf4e0562de0b7eae133442c21433662d6 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/nut @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 1e-05; + +boundaryField +{ + metalSheet + { + type nutkWallFunction; + value $internalField; + } + + "side-.*" + { + type calculated; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/omega b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/omega new file mode 100644 index 0000000000000000000000000000000000000000..db89c49f33f1f4e48bad32850f21da329e06918a --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/omega @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 0.22; + +boundaryField +{ + metalSheet + { + type omegaWallFunction; + value $internalField; + } + + "side-.*" + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/p_rgh b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..23afaea8a2837aa2e551fee4587cf3bf3fcef670 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/0.orig/p_rgh @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + metalSheet + { + type fixedFluxPressure; + value $internalField; + } + + "side-.*" + { + type totalPressure; + p0 uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allclean b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..fb1f3847301c377e02e12439ba58cbf303af3ef9 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions +#------------------------------------------------------------------------------ + +cleanCase0 + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..78d5debbe7f687177b9c06cd6b65b939d99f8820 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun @@ -0,0 +1,10 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +./Allrun.pre + +runApplication $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun-parallel b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun-parallel new file mode 100755 index 0000000000000000000000000000000000000000..c6ef1e77d72408d756a0f2f3e11373156f6a8100 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun-parallel @@ -0,0 +1,29 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +./Allrun.pre + +runApplication decomposePar + +runParallel -s 1 $(getApplication) + +runApplication reconstructPar + + +# restart + +latestTime=$(foamListTimes -latestTime) + +mv -f "$latestTime" "$latestTime".bak + +rm -rf processor* + +runParallel -s decompose redistributePar -decompose -latestTime + +runParallel -s 2 $(getApplication) + +runParallel -s reconstruct redistributePar -reconstruct -latestTime + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun.pre b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..838bd0b7b9bfbfa7a1d266a7f6c99a46834bc69d --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/Allrun.pre @@ -0,0 +1,20 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +runApplication blockMesh + +runApplication snappyHexMesh -overwrite + +rm -rf 0/ + +restore0Dir + +runApplication setFields + +runApplication transformPoints -rollPitchYaw "(0 -90 0)" + +runApplication checkMesh -allGeometry -allTopology + +#------------------------------------------------------------------------------ diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/dynamicMeshDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..2c81b3b60b44d0197501293038ac83a3a498441f --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/dynamicMeshDict @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMotionSolverFvMesh; + +motionSolver solidBody; + +solidBodyMotionFunction tabulated6DoFMotion; + +timeDataFileName "<constant>/meshMotion.dat"; + +CofG (0 0 0); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/g b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..692f4b237c97f1b89eef486f7f158ab0953ab0a6 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 -9.81); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/hRef b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/hRef new file mode 100644 index 0000000000000000000000000000000000000000..c776b062f3d6d1693ef76bf38f8e9a694f30abd0 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/hRef @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedScalarField; + object hRef; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; +value -0.3; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/meshMotion.dat b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/meshMotion.dat new file mode 100644 index 0000000000000000000000000000000000000000..67db1ba7f794c1e176a21591b7b4bb26fd985ef9 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/meshMotion.dat @@ -0,0 +1,9 @@ +4 +( + // Time Linear (xyz) Rotation (xyz) + (0 ((0 0 0) (0 0 0))) + (10 ((0 0 -0.80) (0 0 0))) + (11 ((0 0 -0.80) (0 0 0))) + (21 ((0 0 0) (0 0 0))) +) + diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/transportProperties b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..b2a79d68961cacee82fe6da8005adfc692fcba5a --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/transportProperties @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + rho 997.561; + nu 8.90883e-07; +} + +air +{ + transportModel Newtonian; + rho 1.1765; + nu 1.58e-05; +} + +sigma 0.072; + + +// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/triSurface/metalSheet.stl.gz b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/triSurface/metalSheet.stl.gz new file mode 100644 index 0000000000000000000000000000000000000000..10b6d02eb5bedd34900df612b7c6fb29394b4719 Binary files /dev/null and b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/triSurface/metalSheet.stl.gz differ diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/turbulenceProperties b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..37d673336ffebb5f886743badc79723fabec8453 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/constant/turbulenceProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kOmegaSST; +} + + +// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/FOelectricPotential b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/FOelectricPotential new file mode 100644 index 0000000000000000000000000000000000000000..f75cd15be58ed7cb02f530d64fb3434516713beb --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/FOelectricPotential @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2107 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object FOelectricPotential; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +electricPotential +{ + // Mandatory entries + type electricPotential; + libs (solverFunctionObjects); + phases + { + alpha.air + { + epsilonr 1.12940906737; + sigma 1e-10; + } + alpha.water + { + epsilonr 3.38822720212; + sigma 0.14; + } + } + + // Optional entries + nCorr 1; + writeDerivedFields true; + + // Inherited entries + region region0; + enabled true; + log true; + timeStart 0; + timeEnd 100; + executeControl timeStep; + executeInterval 1; + writeControl outputTime; + writeInterval -1; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/blockMeshDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..a5fc076502a10766742744cae4769e1a7d46d79c --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/blockMeshDict @@ -0,0 +1,93 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 0.001; + +vertices +( + ( -1000 -500 -500 ) + ( 1000 -500 -500 ) + ( 1000 500 -500 ) + ( -1000 500 -500 ) + ( -1000 -500 500 ) + ( 1000 -500 500 ) + ( 1000 500 500 ) + ( -1000 500 500 ) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) ( 40 15 15 ) simpleGrading ( 1 1 1 ) +); + +edges +( +); + +boundary +( + side-01 + { + type patch; + faces + ( + (0 4 7 3) + ); + } + side-02 + { + type patch; + faces + ( + (1 2 6 5) + ); + } + side-03 + { + type patch; + faces + ( + (0 1 5 4) + ); + } + side-04 + { + type patch; + faces + ( + (3 7 6 2) + ); + } + side-05 + { + type patch; + faces + ( + (0 3 2 1) + ); + } + side-06 + { + type patch; + faces + ( + (4 5 6 7) + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/controlDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..0f378b1e3a62c3f1c3b3dee2ffa1615af3b0aae3 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/controlDict @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 20; + +deltaT 0.001; + +writeControl adjustableRunTime; + +writeInterval 0.5; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 12; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 10; + +maxAlphaCo 20; + +maxDeltaT 0.05; + +functions +{ + #include "FOelectricPotential" + + fieldMinMax1 + { + type fieldMinMax; + libs (fieldFunctionObjects); + fields ("electricPotential:V"); + } +} + + +// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/decomposeParDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..d505ad3bad801ef7bdae3c4dba2fb6a1bf6c7190 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/decomposeParDict @@ -0,0 +1,27 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +coeffs +{ + n (4 1 1); +} + + +// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/fvSchemes b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..e4ffa606187f8fb8a4ba9ac923ef34230a34e794 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/fvSchemes @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default cellLimited leastSquares 1; +} + +divSchemes +{ + default Gauss linear; + div(rhoPhi,U) Gauss upwind; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,omega) Gauss upwind; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; + laplacian(electricPotential:sigma,electricPotential:V) Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +wallDist +{ + method meshWave; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/fvSolution b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..dee59e5a28a155270eefa4765bc4c36679637804 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/fvSolution @@ -0,0 +1,118 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 2; + nAlphaSubCycles 2; + cAlpha 0.8; + icAlpha 0; + + MULESCorr yes; + nLimiterIter 15; + alphaApplyPrevCorr no; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-10; + relTol 0; + minIter 1; + } + + "pcorr.*" + { + solver GAMG; + smoother DIC; + tolerance 1e-3; + relTol 0; + }; + + p_rgh + { + solver GAMG; + smoother DIC; + tolerance 5e-8; + relTol 0.01; + }; + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "(U|k|omega)" + { + solver smoothSolver; + smoother symGaussSeidel; + nSweeps 1; + tolerance 1e-7; + relTol 0.1; + minIter 1; + }; + + "(U|k|omega)Final" + { + solver smoothSolver; + smoother symGaussSeidel; + nSweeps 1; + tolerance 1e-7; + relTol 0; + minIter 1; + }; + + "electricPotential:V" + { + solver PBiCGStab; + preconditioner DIC; + tolerance 1e-12; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + + nOuterCorrectors 1; + nCorrectors 3; + nNonOrthogonalCorrectors 1; + + correctPhi no; + moveMeshOuterCorrectors no; + turbOnFinalIterOnly yes; + pRefCell 0; + pRefValue 0; +} + +relaxationFactors +{ + equations + { + ".*" 1; + "electricPotential:V" 0.5; + } +} + +cache +{ + grad(U); +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/meshQualityDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/meshQualityDict new file mode 100644 index 0000000000000000000000000000000000000000..8bbd4170b1de245baf58d385e16c2c1b4b19935a --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/meshQualityDict @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object meshQualityDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Include defaults parameters from master dictionary +#includeEtc "caseDicts/meshQualityDict" + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/setFieldsDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..bc53d9abc56081cba2a63225fcecfa09e7dc3226 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/setFieldsDict @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (-1 -1 -1) (-0.3 1 1); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/snappyHexMeshDict b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/snappyHexMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..ccd942bb93d67cad1260be1bf331ec489ecf4c36 --- /dev/null +++ b/tutorials/multiphase/interFoam/RAS/electrostaticDeposition/system/snappyHexMeshDict @@ -0,0 +1,150 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +castellatedMesh true; +snap true; +addLayers false; + +geometry +{ + metalSheet.stl + { + type triSurfaceMesh; + name metalSheet; + } +}; + +castellatedMeshControls +{ + maxLocalCells 200000000; + maxGlobalCells 300000000; + minRefinementCells 0; + nCellsBetweenLevels 5; + maxLoadUnbalance 0.2; + allowFreeStandingZoneFaces false; + resolveFeatureAngle 1; + + features + ( + ); + + refinementSurfaces + { + metalSheet + { + level (3 3); + } + } + + refinementRegions + { + metalSheet + { + mode distance; + levels ((0.05 3) (0.1 2)); + } + } + + locationInMesh ( 0.8 0 0 ) ; +} + +snapControls +{ + tolerance 1; + implicitFeatureSnap true; + explicitFeatureSnap false; + multiRegionFeatureSnap false; + detectNearSurfacesSnap true; + nSmoothPatch 3; + nSolveIter 30; + nRelaxIter 5; + nFeatureSnapIter 5; + strictRegionSnap true; +} + +addLayersControls +{ + layers + { + } + relativeSizes true ; + expansionRatio 1.2 ; + firstLayerThickness 0.1 ; + featureAngle 85; + slipFeatureAngle 30; + nGrow 0; + nBufferCellsNoExtrude 0; + minMedianAxisAngle 90; + maxFaceThicknessRatio 0.2; + maxThicknessToMedialRatio 0.3; + minThickness 1e-06; + nLayerIter 50; + nRelaxIter 5; + nSmoothSurfaceNormals 10; + nSmoothNormals 3; + nSmoothThickness 10; + nRelaxedIter 10; + nMedialAxisIter 10; +} + +meshQualityControls +{ + minVol 1e-13; + minTetQuality 1e-13; + minArea 1e-13; + minTwist 0.05; + minDeterminant 1e-06; + minFaceWeight 0.02; + minVolRatio 0.01; + minTriangleTwist 0.01; + minFlatness 0.5; + maxNonOrtho 60; + maxBoundarySkewness 20; + maxInternalSkewness 4; + maxConcave 80; + nSmoothScale 4; + errorReduction 0.75; + + relaxed + { + minVol 1e-15; + minTetQuality 1e-15; + minArea 1e-15; + minTwist 0.001; + minDeterminant 1e-06; + minFaceWeight 1e-06; + minVolRatio 0.01; + minTriangleTwist 0.01; + minFlatness 0.5; + maxNonOrtho 65; + maxBoundarySkewness 20; + maxInternalSkewness 4; + maxConcave 80; + nSmoothScale 4; + errorReduction 0.75; + } +} + +mergeTolerance 1e-08; +debug 0; + +writeFlags +( + scalarLevels +); + + +// ************************************************************************* // \ No newline at end of file