ENH: enable custom input of U for devRhoReff and devReff

This commit is contained in:
Kutalmis Bercin 2021-06-07 15:51:11 +01:00 committed by Andrew Heather
parent c8a52fad96
commit 3207e315b2
31 changed files with 313 additions and 13 deletions

View File

@ -149,6 +149,17 @@ Foam::DPMIncompressibleTurbulenceModel<TransportModel>::devReff() const
}
template<class TransportModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::DPMIncompressibleTurbulenceModel<TransportModel>::devReff
(
const volVectorField& U
) const
{
return devRhoReff(U);
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::DPMIncompressibleTurbulenceModel<TransportModel>::divDevReff
@ -170,6 +181,19 @@ Foam::DPMIncompressibleTurbulenceModel<TransportModel>::devRhoReff() const
}
template<class TransportModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::DPMIncompressibleTurbulenceModel<TransportModel>::devRhoReff
(
const volVectorField& U
) const
{
NotImplemented;
return nullptr;
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::DPMIncompressibleTurbulenceModel<TransportModel>::divDevRhoReff

View File

@ -116,12 +116,24 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
};

View File

@ -123,6 +123,13 @@ public:
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devRhoReff() const = 0;
//- Return the effective stress tensor including
//- the laminar stress based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const = 0;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const = 0;

View File

@ -107,6 +107,17 @@ Foam::IncompressibleTurbulenceModel<TransportModel>::devReff() const
}
template<class TransportModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::IncompressibleTurbulenceModel<TransportModel>::devReff
(
const volVectorField& U
) const
{
return devRhoReff(U);
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::IncompressibleTurbulenceModel<TransportModel>::divDevReff
@ -128,6 +139,19 @@ Foam::IncompressibleTurbulenceModel<TransportModel>::devRhoReff() const
}
template<class TransportModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::IncompressibleTurbulenceModel<TransportModel>::devRhoReff
(
const volVectorField& U
) const
{
NotImplemented;
return nullptr;
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::IncompressibleTurbulenceModel<TransportModel>::divDevRhoReff

View File

@ -108,12 +108,24 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -139,6 +139,13 @@ public:
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const = 0;
//- Return the effective stress tensor including
//- the laminar stress based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const = 0;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0;
};

View File

@ -138,6 +138,13 @@ public:
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const = 0;
//- Return the effective stress tensor including
//- the laminar stress based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const = 0;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0;
};

View File

@ -150,6 +150,17 @@ Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::devReff() const
}
template<class TransportModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::devReff
(
const volVectorField& U
) const
{
return devRhoReff(U);
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::divDevReff
@ -171,6 +182,19 @@ Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::devRhoReff() const
}
template<class TransportModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::devRhoReff
(
const volVectorField& U
) const
{
NotImplemented;
return nullptr;
}
template<class TransportModel>
Foam::tmp<Foam::fvVectorMatrix>
Foam::PhaseIncompressibleTurbulenceModel<TransportModel>::divDevRhoReff

View File

@ -117,12 +117,24 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;
};

View File

@ -208,6 +208,17 @@ Foam::ReynoldsStress<BasicTurbulenceModel>::k() const
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::ReynoldsStress<BasicTurbulenceModel>::devRhoReff() const
{
return devRhoReff(this->U_);
}
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::ReynoldsStress<BasicTurbulenceModel>::devRhoReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>
(
@ -223,7 +234,7 @@ Foam::ReynoldsStress<BasicTurbulenceModel>::devRhoReff() const
),
this->alpha_*this->rho_*R_
- (this->alpha_*this->rho_*this->nu())
*dev(twoSymm(fvc::grad(this->U_)))
*dev(twoSymm(fvc::grad(U)))
)
);
}

View File

@ -140,6 +140,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -104,6 +104,7 @@ bool Maxwell<BasicTurbulenceModel>::read()
return false;
}
template<class BasicTurbulenceModel>
tmp<Foam::volSymmTensorField>
Maxwell<BasicTurbulenceModel>::R() const
@ -111,9 +112,18 @@ Maxwell<BasicTurbulenceModel>::R() const
return sigma_;
}
template<class BasicTurbulenceModel>
tmp<Foam::volSymmTensorField>
Maxwell<BasicTurbulenceModel>::devRhoReff() const
{
return devRhoReff(this->U_);
}
template<class BasicTurbulenceModel>
tmp<Foam::volSymmTensorField>
Maxwell<BasicTurbulenceModel>::devRhoReff(const volVectorField& U) const
{
return tmp<volSymmTensorField>
(
@ -129,7 +139,7 @@ Maxwell<BasicTurbulenceModel>::devRhoReff() const
),
this->alpha_*this->rho_*sigma_
- (this->alpha_*this->rho_*this->nu())
*dev(twoSymm(fvc::grad(this->U_)))
*dev(twoSymm(fvc::grad(U)))
)
);
}

View File

@ -143,6 +143,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -70,6 +70,17 @@ bool Foam::linearViscousStress<BasicTurbulenceModel>::read()
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::linearViscousStress<BasicTurbulenceModel>::devRhoReff() const
{
return devRhoReff(this->U_);
}
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::linearViscousStress<BasicTurbulenceModel>::devRhoReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>
(
@ -84,7 +95,7 @@ Foam::linearViscousStress<BasicTurbulenceModel>::devRhoReff() const
IOobject::NO_WRITE
),
(-(this->alpha_*this->rho_*this->nuEff()))
*dev(twoSymm(fvc::grad(this->U_)))
*dev(twoSymm(fvc::grad(U)))
)
);
}

View File

@ -91,6 +91,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -88,12 +88,24 @@ Foam::nonlinearEddyViscosity<BasicTurbulenceModel>::R() const
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::nonlinearEddyViscosity<BasicTurbulenceModel>::devRhoReff() const
{
return devRhoReff(this->U_);
}
template<class BasicTurbulenceModel>
Foam::tmp<Foam::volSymmTensorField>
Foam::nonlinearEddyViscosity<BasicTurbulenceModel>::devRhoReff
(
const volVectorField& U
) const
{
tmp<volSymmTensorField> tdevRhoReff
(
eddyViscosity<BasicTurbulenceModel>::devRhoReff()
eddyViscosity<BasicTurbulenceModel>::devRhoReff(U)
);
tdevRhoReff.ref() += this->rho_*nonlinearStress_;
return tdevRhoReff;
}

View File

@ -107,6 +107,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -71,6 +71,15 @@ adjointLaminar::adjointLaminar
tmp<volSymmTensorField> adjointLaminar::devReff() const
{
const volVectorField& Ua = adjointVars_.Ua();
return devReff(Ua);
}
tmp<volSymmTensorField> adjointLaminar::devReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>
(
new volSymmTensorField
@ -83,7 +92,7 @@ tmp<volSymmTensorField> adjointLaminar::devReff() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nu()*dev(twoSymm(fvc::grad(Ua)))
-nu()*dev(twoSymm(fvc::grad(U)))
)
);
}

View File

@ -100,6 +100,12 @@ public:
//- Return the effective stress tensor, i.e. the adjointLaminar stress
virtual tmp<volSymmTensorField> devReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const;
//- Return the diffusion term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;

View File

@ -261,6 +261,12 @@ public:
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const = 0;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const = 0;
//- Return the diffusion term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0;

View File

@ -703,7 +703,17 @@ adjointSpalartAllmaras::adjointSpalartAllmaras
tmp<volSymmTensorField> adjointSpalartAllmaras::devReff() const
{
const volVectorField& Ua = adjointVars_.UaInst();
return tmp<volSymmTensorField>::New
return devReff(Ua);
}
tmp<volSymmTensorField> adjointSpalartAllmaras::devReff
(
const volVectorField& U
) const
{
return
tmp<volSymmTensorField>::New
(
IOobject
(
@ -713,7 +723,7 @@ tmp<volSymmTensorField> adjointSpalartAllmaras::devReff() const
IOobject::NO_READ,
IOobject::NO_WRITE
),
-nuEff()*dev(twoSymm(fvc::grad(Ua)))
-nuEff()*dev(twoSymm(fvc::grad(U)))
);
}

View File

@ -317,6 +317,8 @@ public:
virtual tmp<volSymmTensorField> devReff() const;
virtual tmp<volSymmTensorField> devReff(const volVectorField& U) const;
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const;
virtual tmp<volVectorField> adjointMeanFlowSource();

View File

@ -186,6 +186,12 @@ public:
//- Return the effective stress tensor including the laminar stress
virtual tmp<volSymmTensorField> devReff() const = 0;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devReff
(
const volVectorField& U
) const = 0;
//- Return the diffusion term for the momentum equation
virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const = 0;

View File

@ -311,6 +311,16 @@ Foam::RASModels::kineticTheoryModel::pPrimef() const
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::kineticTheoryModel::devRhoReff() const
{
return devRhoReff(U_);
}
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::kineticTheoryModel::devRhoReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>
(
@ -318,14 +328,14 @@ Foam::RASModels::kineticTheoryModel::devRhoReff() const
(
IOobject
(
IOobject::groupName("devRhoReff", U_.group()),
IOobject::groupName("devRhoReff", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
- (rho_*nut_)
*dev(twoSymm(fvc::grad(U_)))
*dev(twoSymm(fvc::grad(U)))
- ((rho_*lambda_)*fvc::div(phi_))*symmTensor::I
)
);

View File

@ -223,6 +223,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -200,6 +200,16 @@ Foam::RASModels::phasePressureModel::pPrimef() const
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::phasePressureModel::devRhoReff() const
{
return devRhoReff(U_);
}
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::phasePressureModel::devRhoReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>
(
@ -207,7 +217,7 @@ Foam::RASModels::phasePressureModel::devRhoReff() const
(
IOobject
(
IOobject::groupName("devRhoReff", U_.group()),
IOobject::groupName("devRhoReff", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,

View File

@ -174,6 +174,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -311,6 +311,16 @@ Foam::RASModels::kineticTheoryModel::pPrimef() const
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::kineticTheoryModel::devRhoReff() const
{
return devRhoReff(U_);
}
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::kineticTheoryModel::devRhoReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>
(
@ -318,14 +328,14 @@ Foam::RASModels::kineticTheoryModel::devRhoReff() const
(
IOobject
(
IOobject::groupName("devRhoReff", U_.group()),
IOobject::groupName("devRhoReff", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
- (rho_*nut_)
*dev(twoSymm(fvc::grad(U_)))
*dev(twoSymm(fvc::grad(U)))
- ((rho_*lambda_)*fvc::div(phi_))*symmTensor::I
)
);

View File

@ -223,6 +223,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;

View File

@ -203,12 +203,22 @@ Foam::RASModels::phasePressureModel::pPrimef() const
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::phasePressureModel::devRhoReff() const
{
return devRhoReff(U_);
}
Foam::tmp<Foam::volSymmTensorField>
Foam::RASModels::phasePressureModel::devRhoReff
(
const volVectorField& U
) const
{
return tmp<volSymmTensorField>::New
(
IOobject
(
IOobject::groupName("devRhoReff", U_.group()),
IOobject::groupName("devRhoReff", U.group()),
runTime_.timeName(),
mesh_,
IOobject::NO_READ,

View File

@ -178,6 +178,12 @@ public:
//- Return the effective stress tensor
virtual tmp<volSymmTensorField> devRhoReff() const;
//- Return the effective stress tensor based on a given velocity field
virtual tmp<volSymmTensorField> devRhoReff
(
const volVectorField& U
) const;
//- Return the source term for the momentum equation
virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const;