Skip to content

Commit

Permalink
Integrate Alpha into FF Module
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamriel committed Nov 17, 2023
1 parent f588a92 commit ea75272
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FF/AlphaGradient.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ std::size_t preciceAdapter::FF::AlphaGradient::write(double* buffer, bool meshCo
-gradientPatch[i];
}
}
return bufferIndex;
}

void preciceAdapter::FF::AlphaGradient::read(double* buffer, const unsigned int dim)
Expand All @@ -59,7 +60,6 @@ void preciceAdapter::FF::AlphaGradient::read(double* buffer, const unsigned int
buffer[bufferIndex++];
}
}
return bufferIndex;
}

bool preciceAdapter::FF::AlphaGradient::isLocationTypeSupported(const bool meshConnectivity) const
Expand Down
32 changes: 32 additions & 0 deletions FF/FF.C
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ bool preciceAdapter::FF::FluidFluid::readConfig(const IOdictionary& adapterConfi
nameT_ = FFdict.lookupOrDefault<word>("nameT", "T");
DEBUG(adapterInfo(" temperature field name : " + nameT_));

// Read the name of the phase variable field (if different)
nameAlpha_ = FFdict.lookupOrDefault<word>("nameAlpha", "alpha");
DEBUG(adapterInfo(" phase variable (alpha) field name : " + nameAlpha_));

// Read the name of the face flux field (if different)
namePhi_ = FFdict.lookupOrDefault<word>("namePhi", "phi");
DEBUG(adapterInfo(" face flux field name : " + namePhi_));
Expand Down Expand Up @@ -155,6 +159,20 @@ bool preciceAdapter::FF::FluidFluid::addWriters(std::string dataName, Interface*
new Temperature(mesh_, nameT_));
DEBUG(adapterInfo("Added writer: Flow Temperature."));
}
else if (dataName.find("AlphaGradient") == 0)
{
interface->addCouplingDataWriter(
dataName,
new AlphaGradient(mesh_, nameAlpha_));
DEBUG(adapterInfo("Added writer: Alpha Gradient."));
}
else if (dataName.find("Alpha") == 0)
{
interface->addCouplingDataWriter(
dataName,
new Alpha(mesh_, nameAlpha_));
DEBUG(adapterInfo("Added writer: Alpha."));
}
else
{
found = false;
Expand Down Expand Up @@ -215,6 +233,20 @@ bool preciceAdapter::FF::FluidFluid::addReaders(std::string dataName, Interface*
new Temperature(mesh_, nameT_));
DEBUG(adapterInfo("Added reader: Flow Temperature."));
}
else if (dataName.find("AlphaGradient") == 0)
{
interface->addCouplingDataReader(
dataName,
new AlphaGradient(mesh_, nameAlpha_));
DEBUG(adapterInfo("Added reader: Alpha Gradient."));
}
else if (dataName.find("Alpha") == 0)
{
interface->addCouplingDataReader(
dataName,
new Alpha(mesh_, nameAlpha_));
DEBUG(adapterInfo("Added reader: Alpha."));
}
else
{
found = false;
Expand Down
5 changes: 5 additions & 0 deletions FF/FF.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
#include "FF/Velocity.H"
#include "FF/Pressure.H"
#include "FF/Temperature.H"
#include "FF/Alpha.H"
#include "FF/PressureGradient.H"
#include "FF/VelocityGradient.H"
#include "FF/TemperatureGradient.H"
#include "FF/AlphaGradient.H"

#include "fvCFD.H"

Expand Down Expand Up @@ -38,6 +40,9 @@ protected:
//- Name of the temperature field
std::string nameT_ = "T";

//- Name of the phase variable (alpha) field
std::string nameAlpha_ = "alpha";

//- Name of the face flux field
std::string namePhi_ = "phi";

Expand Down
2 changes: 2 additions & 0 deletions FF/ModuleFF.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
#include "PressureGradient.C"
#include "Temperature.C"
#include "TemperatureGradient.C"
#include "Alpha.C"
#include "AlphaGradient.C"
#include "BoundaryConditions/coupledPressure/coupledPressureFvPatchField.C"
#include "BoundaryConditions/coupledVelocity/coupledVelocityFvPatchField.C"

0 comments on commit ea75272

Please sign in to comment.