-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Volume coupling module #183
Volume coupling module #183
Conversation
Co-authored-by: David Schneider <david.schneider@ipvs.uni-stuttgart.de>
Co-authored-by: David Schneider <david.schneider@ipvs.uni-stuttgart.de>
Co-authored-by: David Schneider <david.schneider@ipvs.uni-stuttgart.de>
Co-authored-by: David Schneider <david.schneider@ipvs.uni-stuttgart.de>
…hard coding the dimensions
Adapter.C
Outdated
if (module == "Volume_Coupling") | ||
{ | ||
Volume_Couplingenabled_ = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style-wise, the adapter uses nearly exclusively CamelCase, VolumeCouplingEnabled_
. I guess it would be good to stick to it.
@@ -186,6 +190,14 @@ bool preciceAdapter::Adapter::configFileRead() | |||
} | |||
} | |||
|
|||
// If the Volume_Coupling module is enabled, create it, read the | |||
// Volume_Coupling-specific options and configure it. | |||
if (Volume_Couplingenabled_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask you to add this option in the if
block below in order to bail out in case no module was enabled?
|
||
|
||
//- Name of the Porosity | ||
std::string nameYour_Volume_Field_ = "Your_Volume_Field"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to read this name through the dictionary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a placeholder. I have added `Fluid_Velocity' and 'Temperature'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should take this from the configuration file of the adapter.
#include "Volume_Coupling/Generic_volScalarField.H" | ||
#include "Volume_Coupling/Generic_volVectorField.H" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These includes are still missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will be pushing things soon.
I should have named the PR with Draft as I was still working on cleaning up few things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I converted the PR to draft, mark as "ready for review" when you are ready. :-)
…scalar and vector fiels on, so as to reduce the efforts for doing the same coding again and again
Regarding clang-format. The issue was that I was using Ubuntu 18.04. And clamg-format 11 is not supported on any OS below Ubuntu 20.04. I updated my OS to 20.04, and installed the correct clang-format version. But I am unable to use the
I tried changing the permissions for |
Does just running |
|
Then just change the Alternatively, you can set an |
Thank you Makis. This worked properly. Pushed the changes for Edit: |
@MakisH @davidscn I would like some hints/direction on this one. I went through the OF API, OF source code for OF v7 and v2012 relating to motion solver, I couldn't find any difference between the two versions. This is the error for quick reference.
|
for (uint j = 0; j < patchIDs_.size(); j++) | ||
{ | ||
// Get the face centers of the current patch | ||
const vectorField faceCenters = | ||
mesh.boundaryMesh()[patchIDs_.at(j)].faceCentres(); | ||
|
||
// Assign the (x,y,z) locations to the vertices | ||
for (int i = 0; i < faceCenters.size(); i++) | ||
{ | ||
vertices[verticesIndex++] = faceCenters[i].x(); | ||
vertices[verticesIndex++] = faceCenters[i].y(); | ||
if (dim_ == 3) | ||
{ | ||
vertices[verticesIndex++] = faceCenters[i].z(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the configuration for such a case look like? Do I need to specify all involved patches or are all patches automatically included. I just want to raise a warning that we might run into issues with empty
patches in case we run 2D simulations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unanswered question. Configuration actually ignores different type of mapping for volumes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@engenegr what do you mean by "ignores different type of mapping for volumes"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@engenegr what do you mean by "ignores different type of mapping for volumes"?
I guess it means that there is no configuration option to set particular boundaries empty
.
Some news: we are picking up this together with a student, to integrate it in the main branch of the adapter, write documentation, and add some tutorials on the website. Expect updates over the next months / by the end of the year. |
Hi, I used your volume coupling adaptor. I slightly modified it, it works fine with compilation. But I have an error which states that "there were undefined symbols". This is because I added some additional variables "alpha (volume fraction)" and "AF(acoustic force)" to the adapter. I know I have to include the required libraries to Make/Options. But those variables are added in "CreateFields.H" file in my modified solver, which do not have a library. Any suggestions to add those symbols? |
@yinjun5200 To summarize, your adapter compiles fine. But when you try to run the coupled simulation, you get this error, correct?
Also could you please tell me if you solved the compilation errors for OF v2022? |
@alphaoo1 Thanks for you kind reply. Yes, it compiles fine. But at the end of the compilation, it print out "Everything looks fine in wmake.log === ERROR: Building completed with linking problems: there were undefined symbol. I attached my ldd.log and wmake.log files there. I added these fields in modified interFoam solver in "createFeilds.H" file, as seen in the attached file. I think I have to provide the library to link those variables in Make/options to solve this problem? But I don't have any developed library for those variables. I need your guide ! I used volume coupling, I think it should be fine to discuss there? But I don't mind if we need to create a new issue. :) NO, I used OpenFOAM6, not OF 2022. ldd.log |
int patchID = patchIDs_.at(j); | ||
|
||
// Get the field on the patch | ||
fixedValuePointPatchVectorField& pointGeneric_volVectorPatch = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the compilation issues with OFv2012: did you mean to make this a fvPatchVectorField
? Since you are making a refCast
to fvPatchVectorField
anyway. I can't find information on fixedValuePointPatchVectorField
in the OF v7 documentation (however, I am finding fixedValuePointPatchField
)
// if ( module.empty ) | ||
// { | ||
// return false; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alphaoo1 What was the intention here? Why is this commented out?
@@ -277,6 +293,12 @@ void preciceAdapter::Adapter::configure() | |||
FF_->addWriters(dataName, interface); | |||
} | |||
|
|||
// Add Momentum-related coupling data writers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "momentum-related"?
@@ -186,6 +194,14 @@ bool preciceAdapter::Adapter::configFileRead() | |||
} | |||
} | |||
|
|||
// If the Volume_Coupling module is enabled, create it, read the | |||
// Volume_Coupling-specific options and configure it. | |||
if (Volume_Couplingenabled_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(long term / document)
With this approach, we have the choice between {CHT, FSI, FF, Volume Coupling}
. In the long run, we want volume coupling to be possible for all (?) of {CHT, FSI, FF}
.
@@ -32,15 +32,15 @@ void preciceAdapter::CHT::SinkTemperature::write(double* buffer, bool meshConnec | |||
tmp<scalarField> patchInternalFieldTmp = TPatch.patchInternalField(); | |||
const scalarField& patchInternalField = patchInternalFieldTmp(); | |||
|
|||
//If we use the mesh connectivity, we interpolate from the centres to the nodes | |||
// If we use the mesh connectivity, we interpolate from the centres to the nodes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge develop
to the volume_coupling
branch first, then the volume_coupling
branch to this branch, and then check the formatting again. Maybe some of these changes have already been introduced before.
for (uint j = 0; j < patchIDs_.size(); j++) | ||
{ | ||
// Get the face centers of the current patch | ||
const vectorField faceCenters = | ||
mesh.boundaryMesh()[patchIDs_.at(j)].faceCentres(); | ||
|
||
// Assign the (x,y,z) locations to the vertices | ||
for (int i = 0; i < faceCenters.size(); i++) | ||
{ | ||
vertices[verticesIndex++] = faceCenters[i].x(); | ||
vertices[verticesIndex++] = faceCenters[i].y(); | ||
if (dim_ == 3) | ||
{ | ||
vertices[verticesIndex++] = faceCenters[i].z(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@engenegr what do you mean by "ignores different type of mapping for volumes"?
// Read the name of the field Fluid_Velocity (if different) | ||
nameFluid_Velocity_ = Volume_Couplingdict.lookupOrDefault<word>("nameFluid_Velocity", "Fluid_Velocity"); | ||
DEBUG(adapterInfo(" Fluid_Velocity field name : " + nameFluid_Velocity_)); | ||
|
||
// Read the name of the field Volume_Porosity (if different) | ||
nameT_ = Volume_Couplingdict.lookupOrDefault<word>("nameT", "T"); | ||
DEBUG(adapterInfo(" Temperature field name : " + nameT_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Application-specfiic
if (dataName.find("Fluid_Velocity") == 0) | ||
{ | ||
interface->addCouplingDataWriter( | ||
dataName, | ||
new Generic_volVectorField(mesh_, nameFluid_Velocity_)); | ||
DEBUG(adapterInfo("Added writer: Fluid_Velocity.")); | ||
} | ||
|
||
else if (dataName.find("T") == 0) | ||
{ | ||
interface->addCouplingDataWriter( | ||
dataName, | ||
new Generic_volScalarField(mesh_, nameT_)); | ||
DEBUG(adapterInfo("Added writer: T.")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Application-specific, check
if (dataName.find("Fluid_Velocity") == 0) | ||
{ | ||
interface->addCouplingDataReader( | ||
dataName, | ||
new Generic_volVectorField(mesh_, nameFluid_Velocity_)); | ||
DEBUG(adapterInfo("Added reader: Fluid_Velocity.")); | ||
} | ||
|
||
else if (dataName.find("T") == 0) | ||
{ | ||
interface->addCouplingDataReader( | ||
dataName, | ||
new Generic_volScalarField(mesh_, nameT_)); | ||
DEBUG(adapterInfo("Added reader: T.")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Application-specific, check.
|
||
|
||
//- Name of the Porosity | ||
std::string nameYour_Volume_Field_ = "Your_Volume_Field"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should take this from the configuration file of the adapter.
find . \( -iname "*.H" -o -iname "*.C" \) -exec clang-format-11 -i {} \; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use whatever develop
is using (after merging develop
here).
We will continue our work on the volume-coupling branch of |
In this PR I add a class for the Volume coupling module.
This will form the basis for further development on the Volume Coupling module, it's data fields and test cases.
TODO list:
docs/
changelog-entries/
(create directory if missing)