Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various adjustments #209

Merged
merged 7 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
454 changes: 105 additions & 349 deletions Adapter.C

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Adapter.H
Original file line number Diff line number Diff line change
Expand Up @@ -315,37 +315,37 @@ private:
// Add checkpoint fields, depending on the type

//- Add a volScalarField to checkpoint
void addCheckpointField(volScalarField& field);
void addCheckpointField(volScalarField* field);

//- Add a volVectorField to checkpoint
void addCheckpointField(volVectorField& field);
void addCheckpointField(volVectorField* field);

//- Add a surfaceScalarField to checkpoint
void addCheckpointField(surfaceScalarField& field);
void addCheckpointField(surfaceScalarField* field);

//- Add a surfaceVectorField to checkpoint
void addCheckpointField(surfaceVectorField& field);
void addCheckpointField(surfaceVectorField* field);

//- Add a pointScalarField to checkpoint
void addCheckpointField(pointScalarField& field);
void addCheckpointField(pointScalarField* field);

//- Add a pointVectorField to checkpoint
void addCheckpointField(pointVectorField& field);
void addCheckpointField(pointVectorField* field);

// NOTE: Add here methods to add other object types to checkpoint,
// if needed.

//- Add a volTensorField to checkpoint
void addCheckpointField(volTensorField& field);
void addCheckpointField(volTensorField* field);

//- Add a surfaceTensorField to checkpoint
void addCheckpointField(surfaceTensorField& field);
void addCheckpointField(surfaceTensorField* field);

//- Add a pointTensorField to checkpoint
void addCheckpointField(pointTensorField& field);
void addCheckpointField(pointTensorField* field);

//- Add a volSymmTensorField to checkpoint
void addCheckpointField(volSymmTensorField& field);
void addCheckpointField(volSymmTensorField* field);

//- Read the checkpoint - restore the mesh fields and time
void readMeshCheckpoint();
Expand Down
4 changes: 2 additions & 2 deletions CHT/CHT.C
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool preciceAdapter::CHT::ConjugateHeatTransfer::configure(const IOdictionary& a

bool preciceAdapter::CHT::ConjugateHeatTransfer::readConfig(const IOdictionary& adapterConfig)
{
const dictionary CHTdict = adapterConfig.subOrEmptyDict("CHT");
const dictionary& CHTdict = adapterConfig.subOrEmptyDict("CHT");

// Read the solver type (if not specified, it is determined automatically)
solverType_ = CHTdict.lookupOrDefault<word>("solverType", "");
Expand Down Expand Up @@ -91,7 +91,7 @@ std::string preciceAdapter::CHT::ConjugateHeatTransfer::determineSolverType()

if (mesh_.foundObject<volScalarField>("p"))
{
volScalarField p_ = mesh_.lookupObject<volScalarField>("p");
const volScalarField& p_ = mesh_.lookupObject<volScalarField>("p");

if (p_.dimensions() == pressureDimensionsCompressible)
{
Expand Down
8 changes: 4 additions & 4 deletions CHT/KappaEffective.C
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ preciceAdapter::CHT::KappaEff_Incompressible::KappaEff_Incompressible(
DEBUG(adapterInfo(" Name of turbulent thermal diffusivity: " + nameAlphat_));

// Get the preciceDict/CHT dictionary
const dictionary CHTDict =
const dictionary& CHTDict =
mesh_.lookupObject<IOdictionary>("preciceDict").subOrEmptyDict("CHT");

// Read the Prandtl number
Expand Down Expand Up @@ -119,8 +119,8 @@ void preciceAdapter::CHT::KappaEff_Incompressible::extract(uint patchID, bool me
// Does the turbulent thermal diffusivity exist in the object registry?
if (mesh_.foundObject<volScalarField>(nameAlphat_))
{
const scalarField& alphat(
mesh_.lookupObject<volScalarField>(nameAlphat_).boundaryField()[patchID]);
const scalarField& alphat =
mesh_.lookupObject<volScalarField>(nameAlphat_).boundaryField()[patchID];

alphaEff = nu / Pr_.value() + alphat;
}
Expand Down Expand Up @@ -172,7 +172,7 @@ preciceAdapter::CHT::KappaEff_Basic::KappaEff_Basic(
DEBUG(adapterInfo(" Name of conductivity: " + nameKappa_));

// Get the preciceDict/CHT dictionary
const dictionary CHTDict =
const dictionary& CHTDict =
mesh_.lookupObject<IOdictionary>("preciceDict").subOrEmptyDict("CHT");

// Read the conductivity
Expand Down
4 changes: 2 additions & 2 deletions FF/FF.C
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bool preciceAdapter::FF::FluidFluid::configure(const IOdictionary& adapterConfig

bool preciceAdapter::FF::FluidFluid::readConfig(const IOdictionary& adapterConfig)
{
const dictionary FFdict = adapterConfig.subOrEmptyDict("FF");
const dictionary& FFdict = adapterConfig.subOrEmptyDict("FF");

// Read the solver type (if not specified, it is determined automatically)
solverType_ = FFdict.lookupOrDefault<word>("solverType", "");
Expand Down Expand Up @@ -74,7 +74,7 @@ std::string preciceAdapter::FF::FluidFluid::determineSolverType()

if (mesh_.foundObject<volScalarField>("p"))
{
volScalarField p_ = mesh_.lookupObject<volScalarField>("p");
const volScalarField& p_ = mesh_.lookupObject<volScalarField>("p");

if (p_.dimensions() == pressureDimensionsCompressible)
solverType = "compressible";
Expand Down
4 changes: 2 additions & 2 deletions FF/PressureGradient.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ void preciceAdapter::FF::PressureGradient::write(double* buffer, bool meshConnec
int patchID = patchIDs_.at(j);

// Get the pressure gradient boundary patch
scalarField gradientPatch =
scalarField gradientPatch(
refCast<fixedValueFvPatchScalarField>(
p_->boundaryFieldRef()[patchID])
.snGrad();
.snGrad());

// For every cell of the patch
forAll(gradientPatch, i)
Expand Down
4 changes: 2 additions & 2 deletions FF/VelocityGradient.C
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ void preciceAdapter::FF::VelocityGradient::write(double* buffer, bool meshConnec
int patchID = patchIDs_.at(j);

// Get the velocity gradient boundary patch
vectorField gradientPatch =
vectorField gradientPatch(
refCast<fixedValueFvPatchVectorField>(
U_->boundaryFieldRef()[patchID])
.snGrad();
.snGrad());

// For every cell of the patch
forAll(gradientPatch, i)
Expand Down
4 changes: 2 additions & 2 deletions FF/VelocityGradient.H
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public:
const std::string nameU);

//- Write the velocity gradient values into the buffer
void write(double* buffer, bool meshConnectivity, const unsigned int dim);
void write(double* buffer, bool meshConnectivity, const unsigned int dim) override;

//- Read the velocity gradient values from the buffer
void read(double* buffer, const unsigned int dim);
void read(double* buffer, const unsigned int dim) override;
};

}
Expand Down
4 changes: 2 additions & 2 deletions FSI/Displacement.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public:
const std::string nameCellDisplacement);

//- Write the displacement values into the buffer
void write(double* buffer, bool meshConnectivity, const unsigned int dim);
void write(double* buffer, bool meshConnectivity, const unsigned int dim) override;

//- Read the displacement values from the buffer
void read(double* buffer, const unsigned int dim);
void read(double* buffer, const unsigned int dim) override;

//- We need to initialize the cell-based vector and the interpolation object
// in case we want to use the faceCenter location for the coupling
Expand Down
4 changes: 2 additions & 2 deletions FSI/DisplacementDelta.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public:
const std::string nameCellDisplacement);

//- Write the displacementDelta values into the buffer
void write(double* buffer, bool meshConnectivity, const unsigned int dim);
void write(double* buffer, bool meshConnectivity, const unsigned int dim) override;

//- Read the displacementDelta values from the buffer
void read(double* buffer, const unsigned int dim);
void read(double* buffer, const unsigned int dim) override;

//- We need to initialize the cell-based vector and the interpolation object
// in case we want to use the faceCenter location for the coupling
Expand Down
4 changes: 2 additions & 2 deletions FSI/FSI.C
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool preciceAdapter::FSI::FluidStructureInteraction::configure(const IOdictionar

bool preciceAdapter::FSI::FluidStructureInteraction::readConfig(const IOdictionary& adapterConfig)
{
const dictionary FSIdict = adapterConfig.subOrEmptyDict("FSI");
const dictionary& FSIdict = adapterConfig.subOrEmptyDict("FSI");

// Read the solver type (if not specified, it is determined automatically)
solverType_ = FSIdict.lookupOrDefault<word>("solverType", "");
Expand Down Expand Up @@ -81,7 +81,7 @@ std::string preciceAdapter::FSI::FluidStructureInteraction::determineSolverType(

if (mesh_.foundObject<volScalarField>("p"))
{
volScalarField p_ = mesh_.lookupObject<volScalarField>("p");
const volScalarField& p_ = mesh_.lookupObject<volScalarField>("p");

if (p_.dimensions() == pressureDimensionsCompressible)
{
Expand Down
2 changes: 1 addition & 1 deletion FSI/Force.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void preciceAdapter::FSI::Force::read(double* buffer, const unsigned int dim)
this->readFromBuffer(buffer);
}

vectorField preciceAdapter::FSI::Force::getFaceVectors(const unsigned int patchID) const
Foam::tmp<Foam::vectorField> preciceAdapter::FSI::Force::getFaceVectors(const unsigned int patchID) const
{
// Normal vectors multiplied by face area
return mesh_.boundary()[patchID].Sf();
Expand Down
6 changes: 3 additions & 3 deletions FSI/Force.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public:
const std::string solverType);

//- Write the forces values into the buffer
void write(double* buffer, bool meshConnectivity, const unsigned int dim);
void write(double* buffer, bool meshConnectivity, const unsigned int dim) override;

//- Read the forces values from the buffer
void read(double* buffer, const unsigned int dim);
void read(double* buffer, const unsigned int dim) override;

//- Returns the normal vectors multiplied by the face area
Foam::vectorField getFaceVectors(const unsigned int patchID) const override;
Foam::tmp<Foam::vectorField> getFaceVectors(const unsigned int patchID) const override;

//- Destructor
~Force();
Expand Down
8 changes: 3 additions & 5 deletions FSI/ForceBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,13 @@ void preciceAdapter::FSI::ForceBase::writeToBuffer(double* buffer,
trho().boundaryField();

// Pressure boundary field
tmp<volScalarField> tp = mesh_.lookupObject<volScalarField>("p");
const volScalarField::Boundary& pb(
tp().boundaryField());
const auto& pb = mesh_.lookupObject<volScalarField>("p").boundaryField();

// For every boundary patch of the interface
for (const label patchID : patchIDs_)
{

const auto& surface = getFaceVectors(patchID);
tmp<vectorField> tsurface = getFaceVectors(patchID);
const auto& surface = tsurface();

// Pressure forces
// FIXME: We need to substract the reference pressure for incompressible calculations
Expand Down
2 changes: 1 addition & 1 deletion FSI/ForceBase.H
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public:

void readFromBuffer(double* buffer) const;

virtual Foam::vectorField getFaceVectors(const unsigned int patchID) const = 0;
virtual Foam::tmp<Foam::vectorField> getFaceVectors(const unsigned int patchID) const = 0;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion FSI/Stress.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void preciceAdapter::FSI::Stress::read(double* buffer, const unsigned int dim)
this->readFromBuffer(buffer);
}

vectorField preciceAdapter::FSI::Stress::getFaceVectors(const unsigned int patchID) const
Foam::tmp<Foam::vectorField> preciceAdapter::FSI::Stress::getFaceVectors(const unsigned int patchID) const
{
// face normal vectors
return mesh_.boundary()[patchID].nf();
Expand Down
6 changes: 3 additions & 3 deletions FSI/Stress.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public:
const std::string solverType);

//- Write the stress values into the buffer
void write(double* buffer, bool meshConnectivity, const unsigned int dim);
void write(double* buffer, bool meshConnectivity, const unsigned int dim) override;

//- Read the stress values from the buffer
void read(double* buffer, const unsigned int dim);
void read(double* buffer, const unsigned int dim) override;

//- Returns the face normal vectors (no multiplication by area)
Foam::vectorField getFaceVectors(const unsigned int patchID) const override;
Foam::tmp<Foam::vectorField> getFaceVectors(const unsigned int patchID) const override;

//- Destructor
~Stress();
Expand Down
8 changes: 4 additions & 4 deletions preciceAdapterFunctionObject.H
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ class preciceAdapterFunctionObject

// Private Member Functions

//- Disallow default bitwise copy construct
preciceAdapterFunctionObject(const preciceAdapterFunctionObject&);
//- No copy construct
preciceAdapterFunctionObject(const preciceAdapterFunctionObject&) = delete;

//- Disallow default bitwise assignment
void operator=(const preciceAdapterFunctionObject&);
//- No copy assignment
void operator=(const preciceAdapterFunctionObject&) = delete;


public:
Expand Down