mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: moved sources to eqn rhs
This commit is contained in:
@ -55,7 +55,7 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
|
||||
}
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*T[i]*E) & U[cells[i]];
|
||||
Usource[cells[i]] -= ((Vcells[cells[i]]/V())*T[i]*E) & U[cells[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ Description
|
||||
duration 1000.0; // duration
|
||||
selectionMode cellSet; // cellSet // points //cellZone
|
||||
|
||||
On evaluation, source expects to be added to the rhs of the equation
|
||||
|
||||
|
||||
SourceFiles
|
||||
basicSource.C
|
||||
|
||||
@ -81,32 +81,9 @@ void Foam::ExplicitSetValue<Type>::setValue
|
||||
<< ">::setValue for source " << name_ << endl;
|
||||
}
|
||||
|
||||
DimensionedField<Type, volMesh> rhs
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name_ + fieldNames_[fieldI] + "rhs",
|
||||
eqn.psi().mesh().time().timeName(),
|
||||
eqn.psi().mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
eqn.psi().mesh(),
|
||||
dimensioned<Type>
|
||||
(
|
||||
"zero",
|
||||
dimless,
|
||||
pTraits<Type>::zero
|
||||
)
|
||||
);
|
||||
|
||||
List<Type> values(cells_.size());
|
||||
|
||||
forAll(values, i)
|
||||
{
|
||||
values[i] = injectionRate_[fieldI];
|
||||
}
|
||||
UIndirectList<Type>(values, cells_) = injectionRate_[fieldI];
|
||||
|
||||
eqn.setValues(cells_, values);
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ void Foam::ExplicitSource<Type>::addSup
|
||||
const label fieldI
|
||||
)
|
||||
{
|
||||
// if (debug)
|
||||
if (debug)
|
||||
{
|
||||
Info<< "ExplicitSource<"<< pTraits<Type>::typeName
|
||||
<< ">::addSup for source " << name_ << endl;
|
||||
@ -163,12 +163,9 @@ void Foam::ExplicitSource<Type>::addSup
|
||||
false
|
||||
);
|
||||
|
||||
forAll(cells_, i)
|
||||
{
|
||||
Su[cells_[i]] = injectionRate_[fieldI]/VDash_;
|
||||
}
|
||||
UIndirectList<Type>(Su, cells_) = injectionRate_[fieldI]/VDash_;
|
||||
|
||||
eqn -= Su;
|
||||
eqn += Su;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ addRadialActuationDiskAxialInertialResistance
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
Usource[cells[i]] += ((Vcells[cells[i]]/V_)*Tr[i]*E) & U[cells[i]];
|
||||
Usource[cells[i]] -= ((Vcells[cells[i]]/V_)*Tr[i]*E) & U[cells[i]];
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
||||
@ -399,7 +399,7 @@ Foam::rotorDiskSource::~rotorDiskSource()
|
||||
|
||||
void Foam::rotorDiskSource::addSup(fvMatrix<vector>& eqn, const label fieldI)
|
||||
{
|
||||
// add source to lhs of eqn
|
||||
// add source to rhs of eqn
|
||||
|
||||
const volVectorField& U = eqn.psi();
|
||||
|
||||
@ -410,7 +410,7 @@ void Foam::rotorDiskSource::addSup(fvMatrix<vector>& eqn, const label fieldI)
|
||||
const volScalarField& rho =
|
||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||
|
||||
eqn += calculateForces
|
||||
eqn -= calculateForces
|
||||
(
|
||||
rho.internalField(),
|
||||
inflowVelocity(U),
|
||||
@ -419,7 +419,7 @@ void Foam::rotorDiskSource::addSup(fvMatrix<vector>& eqn, const label fieldI)
|
||||
}
|
||||
else
|
||||
{
|
||||
eqn += calculateForces
|
||||
eqn -= calculateForces
|
||||
(
|
||||
oneField(),
|
||||
inflowVelocity(U),
|
||||
|
||||
Reference in New Issue
Block a user