From ea752729593171485f2826975a1c9bb5dfbc3ead Mon Sep 17 00:00:00 2001 From: Markus Muehlhaeusser Date: Fri, 17 Nov 2023 17:27:18 +0100 Subject: [PATCH] Integrate Alpha into FF Module --- FF/AlphaGradient.C | 2 +- FF/FF.C | 32 ++++++++++++++++++++++++++++++++ FF/FF.H | 5 +++++ FF/ModuleFF.C | 2 ++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/FF/AlphaGradient.C b/FF/AlphaGradient.C index e80452be..00260801 100644 --- a/FF/AlphaGradient.C +++ b/FF/AlphaGradient.C @@ -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) @@ -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 diff --git a/FF/FF.C b/FF/FF.C index 15b2e53b..37d41b26 100644 --- a/FF/FF.C +++ b/FF/FF.C @@ -63,6 +63,10 @@ bool preciceAdapter::FF::FluidFluid::readConfig(const IOdictionary& adapterConfi nameT_ = FFdict.lookupOrDefault("nameT", "T"); DEBUG(adapterInfo(" temperature field name : " + nameT_)); + // Read the name of the phase variable field (if different) + nameAlpha_ = FFdict.lookupOrDefault("nameAlpha", "alpha"); + DEBUG(adapterInfo(" phase variable (alpha) field name : " + nameAlpha_)); + // Read the name of the face flux field (if different) namePhi_ = FFdict.lookupOrDefault("namePhi", "phi"); DEBUG(adapterInfo(" face flux field name : " + namePhi_)); @@ -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; @@ -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; diff --git a/FF/FF.H b/FF/FF.H index fbcee8cb..b7b28e9a 100644 --- a/FF/FF.H +++ b/FF/FF.H @@ -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" @@ -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"; diff --git a/FF/ModuleFF.C b/FF/ModuleFF.C index 30465704..695df4be 100644 --- a/FF/ModuleFF.C +++ b/FF/ModuleFF.C @@ -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"