Skip to content

Commit

Permalink
Release v1.2.0 (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
MakisH authored Nov 18, 2022
2 parents 3361db9 + 65222e0 commit 7afeaed
Show file tree
Hide file tree
Showing 43 changed files with 1,427 additions and 273 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build-custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ on:
required: true
type: choice
options:
- OpenFOAMv2206
- OpenFOAMv2112
- OpenFOAMv2106
- OpenFOAMv2012
- OpenFOAMv2006
- OpenFOAMv1912
- OpenFOAM10
- OpenFOAM9
- OpenFOAM8
- OpenFOAM7
Expand Down Expand Up @@ -76,6 +78,10 @@ jobs:
id: installOpenFOAM
run: |
case "${{ github.event.inputs.versionOpenFOAM }}" in
OpenFOAMv2206)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2206-dev
echo "::set-output name=openfoam_exec::/usr/bin/openfoam2206";;
OpenFOAMv2112)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2112-dev
Expand All @@ -96,6 +102,12 @@ jobs:
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam1912-dev
echo "::set-output name=openfoam_exec::/usr/bin/openfoam1912";;
OpenFOAM10)
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam10
echo "::set-output name=openfoam_exec::. /opt/openfoam10/etc/bashrc &&";;
OpenFOAM9)
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build with OpenFOAM v2112
name: Build with OpenFOAM v2206
on:
push:
branches-ignore:
Expand Down Expand Up @@ -39,4 +39,4 @@ jobs:
snapshot: '/'
exclude: '/boot /data /dev /mnt /proc /run /sys'
- name: Build OpenFOAM-preCICE adapter
run: /usr/bin/openfoam2112 ./Allwmake
run: /usr/bin/openfoam2206 ./Allwmake
10 changes: 5 additions & 5 deletions .github/workflows/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash -e

# Install OpenFOAM v2112
# Install OpenFOAM v2206
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2112-dev
sudo apt-get install openfoam2206-dev

# Install preCICE v2.3.0
wget https://github.com/precice/precice/releases/download/v2.3.0/libprecice2_2.3.0_focal.deb
sudo apt install ./libprecice2_2.3.0_focal.deb
# Install preCICE v2.5.0
wget https://github.com/precice/precice/releases/download/v2.5.0/libprecice2_2.5.0_focal.deb
sudo apt install ./libprecice2_2.5.0_focal.deb
22 changes: 22 additions & 0 deletions .github/workflows/update-website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update website
on:
push:
branches:
- 'develop'
paths:
- 'docs/**'
jobs:
trigger:
runs-on: ubuntu-latest
env:
WORKFLOW_FILENAME: update-submodules.yml
steps:
- name: Trigger workflow
run: |
curl \
--request POST \
--url https://api.github.com/repos/precice/precice.github.io/actions/workflows/$WORKFLOW_FILENAME/dispatches \
--header "authorization: token ${{ secrets.WORKFLOW_DISPATCH_TOKEN }}" \
--header "Accept: application/vnd.github.v3+json" \
--data '{"ref":"master"}' \
--fail
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# OpenFOAM / WMake
lnInclude/
Make/linux64GccDPInt32Opt/
Make/darwin64ClangDPInt32Opt/

# Editors
.cproject
Expand Down
90 changes: 78 additions & 12 deletions Adapter.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ preciceAdapter::Adapter::Adapter(const Time& runTime, const fvMesh& mesh)
: runTime_(runTime),
mesh_(mesh)
{
adapterInfo("Loaded the OpenFOAM-preCICE adapter - v1.1.0.", "info");
adapterInfo("Loaded the OpenFOAM-preCICE adapter - v1.2.0.", "info");

return;
}
Expand All @@ -23,6 +23,7 @@ bool preciceAdapter::Adapter::configFileRead()
// See also comment in preciceAdapter::Adapter::configure().
try
{
SETUP_TIMER();
adapterInfo("Reading preciceDict...", "info");

// TODO: static is just a quick workaround to be able
Expand Down Expand Up @@ -161,10 +162,9 @@ bool preciceAdapter::Adapter::configFileRead()
if (interfacesConfig_.at(i).meshConnectivity == true)
{
adapterInfo(
"Mesh connectivity is not supported for FSI, as, usually, "
"the Solid participant needs to provide the connectivity information. "
"Therefore, set provideMeshConnectivity = false. "
"Have a look in the adapter documentation for more information. ",
"You have requested mesh connectivity (most probably for nearest-projection mapping) "
"and you have enabled the FSI module. "
"Mapping with connectivity information is not implemented for FSI, only for CHT-related fields. "
"warning");
return false;
}
Expand Down Expand Up @@ -196,6 +196,8 @@ bool preciceAdapter::Adapter::configFileRead()

// TODO: Loading modules should be implemented in more general way,
// in order to avoid code duplication. See issue #16 on GitHub.

ACCUMULATE_TIMER(timeInConfigRead_);
}
catch (const Foam::error& e)
{
Expand Down Expand Up @@ -239,18 +241,26 @@ void preciceAdapter::Adapter::configure()
DEBUG(adapterInfo(" Timestep type: fixed."));
}

// Initialize preCICE
// Construct preCICE
SETUP_TIMER();
DEBUG(adapterInfo("Creating the preCICE solver interface..."));
DEBUG(adapterInfo(" Number of processes: " + std::to_string(Pstream::nProcs())));
DEBUG(adapterInfo(" MPI rank: " + std::to_string(Pstream::myProcNo())));
precice_ = new precice::SolverInterface(participantName_, preciceConfigFilename_, Pstream::myProcNo(), Pstream::nProcs());
DEBUG(adapterInfo(" preCICE solver interface was created."));

ACCUMULATE_TIMER(timeInPreciceConstruct_);

// Create interfaces
REUSE_TIMER();
DEBUG(adapterInfo("Creating interfaces..."));
for (uint i = 0; i < interfacesConfig_.size(); i++)
{
Interface* interface = new Interface(*precice_, mesh_, interfacesConfig_.at(i).meshName, interfacesConfig_.at(i).locationsType, interfacesConfig_.at(i).patchNames, interfacesConfig_.at(i).meshConnectivity);
std::string namePointDisplacement = FSIenabled_ ? FSI_->getPointDisplacementFieldName() : "default";
std::string nameCellDisplacement = FSIenabled_ ? FSI_->getCellDisplacementFieldName() : "default";
bool restartFromDeformed = FSIenabled_ ? FSI_->isRestartingFromDeformed() : false;

Interface* interface = new Interface(*precice_, mesh_, interfacesConfig_.at(i).meshName, interfacesConfig_.at(i).locationsType, interfacesConfig_.at(i).patchNames, interfacesConfig_.at(i).meshConnectivity, restartFromDeformed, namePointDisplacement, nameCellDisplacement);
interfaces_.push_back(interface);
DEBUG(adapterInfo("Interface created on mesh " + interfacesConfig_.at(i).meshName));

Expand Down Expand Up @@ -330,6 +340,7 @@ void preciceAdapter::Adapter::configure()
// Create the interface's data buffer
interface->createBuffer();
}
ACCUMULATE_TIMER(timeInMeshSetup_);

// Initialize preCICE and exchange the first coupling data
initialize();
Expand Down Expand Up @@ -434,6 +445,7 @@ void preciceAdapter::Adapter::execute()
// coupling, we write again when the coupling timestep is complete.
// Check the behavior e.g. by using watch on a result file:
// watch -n 0.1 -d ls --full-time Fluid/0.01/T.gz
SETUP_TIMER();
if (checkpointing_ && isCouplingTimeWindowComplete())
{
// Check if the time directory already exists
Expand All @@ -447,6 +459,7 @@ void preciceAdapter::Adapter::execute()
const_cast<Time&>(runTime_).writeNow();
}
}
ACCUMULATE_TIMER(timeInWriteResults_);

// Read the received coupling data from the buffer
readCouplingData();
Expand Down Expand Up @@ -487,32 +500,40 @@ void preciceAdapter::Adapter::adjustTimeStep()

void preciceAdapter::Adapter::readCouplingData()
{
SETUP_TIMER();
DEBUG(adapterInfo("Reading coupling data..."));

for (uint i = 0; i < interfaces_.size(); i++)
{
interfaces_.at(i)->readCouplingData();
}

ACCUMULATE_TIMER(timeInRead_);

return;
}

void preciceAdapter::Adapter::writeCouplingData()
{
SETUP_TIMER();
DEBUG(adapterInfo("Writing coupling data..."));

for (uint i = 0; i < interfaces_.size(); i++)
{
interfaces_.at(i)->writeCouplingData();
}

ACCUMULATE_TIMER(timeInWrite_);

return;
}

void preciceAdapter::Adapter::initialize()
{
DEBUG(adapterInfo("Initalizing the preCICE solver interface..."));
DEBUG(adapterInfo("Initializing the preCICE solver interface..."));
SETUP_TIMER();
timestepPrecice_ = precice_->initialize();
ACCUMULATE_TIMER(timeInInitialize_);

preciceInitialized_ = true;

Expand All @@ -523,7 +544,9 @@ void preciceAdapter::Adapter::initialize()
}

DEBUG(adapterInfo("Initializing preCICE data..."));
REUSE_TIMER();
precice_->initializeData();
ACCUMULATE_TIMER(timeInInitializeData_);

adapterInfo("preCICE was configured and initialized", "info");

Expand All @@ -537,7 +560,9 @@ void preciceAdapter::Adapter::finalize()
DEBUG(adapterInfo("Finalizing the preCICE solver interface..."));

// Finalize the preCICE solver interface
SETUP_TIMER();
precice_->finalize();
ACCUMULATE_TIMER(timeInFinalize_);

preciceInitialized_ = false;

Expand All @@ -556,7 +581,9 @@ void preciceAdapter::Adapter::advance()
{
DEBUG(adapterInfo("Advancing preCICE..."));

SETUP_TIMER();
timestepPrecice_ = precice_->advance(timestepSolver_);
ACCUMULATE_TIMER(timeInAdvance_);

return;
}
Expand Down Expand Up @@ -757,6 +784,12 @@ void preciceAdapter::Adapter::storeMeshPoints()

void preciceAdapter::Adapter::reloadMeshPoints()
{
if (!mesh_.moving())
{
DEBUG(adapterInfo("Mesh points not moved as the mesh is not moving"));
return;
}

// In Foam::polyMesh::movePoints.
// TODO: The function movePoints overwrites the pointer to the old mesh.
// Therefore, if you revert the mesh, the oldpointer will be set to the points, which are the new values.
Expand Down Expand Up @@ -856,6 +889,8 @@ void preciceAdapter::Adapter::setupMeshVolCheckpointing()

void preciceAdapter::Adapter::setupCheckpointing()
{
SETUP_TIMER();

// Add fields in the checkpointing list - sorted for parallel consistency
DEBUG(adapterInfo("Adding in checkpointed fields..."));

Expand Down Expand Up @@ -884,6 +919,8 @@ void preciceAdapter::Adapter::setupCheckpointing()
// NOTE: Add here other object types to checkpoint, if needed.

#undef doLocalCode

ACCUMULATE_TIMER(timeInCheckpointingSetup_);
}


Expand Down Expand Up @@ -1021,6 +1058,8 @@ void preciceAdapter::Adapter::addCheckpointField(volSymmTensorField* field)

void preciceAdapter::Adapter::readCheckpoint()
{
SETUP_TIMER();

// TODO: To increase efficiency: only the oldTime() fields of the quantities which are used in the time
// derivative are necessary. (In general this is only the velocity). Also old information of the mesh
// is required.
Expand Down Expand Up @@ -1211,12 +1250,16 @@ void preciceAdapter::Adapter::readCheckpoint()
"Checkpoint was read. Time = " + std::to_string(runTime_.value()));
#endif

ACCUMULATE_TIMER(timeInCheckpointingRead_);

return;
}


void preciceAdapter::Adapter::writeCheckpoint()
{
SETUP_TIMER();

DEBUG(adapterInfo("Writing a checkpoint..."));

// Store the runTime
Expand Down Expand Up @@ -1294,15 +1337,17 @@ void preciceAdapter::Adapter::writeCheckpoint()
"Checkpoint for time t = " + std::to_string(runTime_.value()) + " was stored.");
#endif

ACCUMULATE_TIMER(timeInCheckpointingWrite_);

return;
}

void preciceAdapter::Adapter::readMeshCheckpoint()
{
DEBUG(adapterInfo("Reading a mesh checkpoint..."));

//TODO only the meshPhi field is here, which is a surfaceScalarField. The other fields can be removed.
// Reload all the fields of type mesh surfaceScalarField
// TODO only the meshPhi field is here, which is a surfaceScalarField. The other fields can be removed.
// Reload all the fields of type mesh surfaceScalarField
for (uint i = 0; i < meshSurfaceScalarFields_.size(); i++)
{
// Load the volume field
Expand Down Expand Up @@ -1529,8 +1574,8 @@ void preciceAdapter::Adapter::teardown()
}
meshVolVectorFieldCopies_.clear();

//TODO for the internal volume
// volScalarInternal
// TODO for the internal volume
// volScalarInternal
for (uint i = 0; i < volScalarInternalFieldCopies_.size(); i++)
{
delete volScalarInternalFieldCopies_.at(i);
Expand Down Expand Up @@ -1603,5 +1648,26 @@ preciceAdapter::Adapter::~Adapter()
{
teardown();

TIMING_MODE(
// Continuing the output started in the destructor of preciceAdapterFunctionObject
Info << "Time exclusively in the adapter: " << (timeInConfigRead_ + timeInMeshSetup_ + timeInCheckpointingSetup_ + timeInWrite_ + timeInRead_ + timeInCheckpointingWrite_ + timeInCheckpointingRead_).str() << nl;
Info << " (S) reading preciceDict: " << timeInConfigRead_.str() << nl;
Info << " (S) constructing preCICE: " << timeInPreciceConstruct_.str() << nl;
Info << " (S) setting up the interfaces: " << timeInMeshSetup_.str() << nl;
Info << " (S) setting up checkpointing: " << timeInCheckpointingSetup_.str() << nl;
Info << " (I) writing data: " << timeInWrite_.str() << nl;
Info << " (I) reading data: " << timeInRead_.str() << nl;
Info << " (I) writing checkpoints: " << timeInCheckpointingWrite_.str() << nl;
Info << " (I) reading checkpoints: " << timeInCheckpointingRead_.str() << nl;
Info << " (I) writing OpenFOAM results: " << timeInWriteResults_.str() << " (at the end of converged time windows)" << nl << nl;
Info << "Time exclusively in preCICE: " << (timeInInitialize_ + timeInInitializeData_ + timeInAdvance_ + timeInFinalize_).str() << nl;
Info << " (S) initialize(): " << timeInInitialize_.str() << nl;
Info << " (S) initializeData(): " << timeInInitializeData_.str() << nl;
Info << " (I) advance(): " << timeInAdvance_.str() << nl;
Info << " (I) finalize(): " << timeInFinalize_.str() << nl;
Info << " These times include time waiting for other participants." << nl;
Info << " See also precice-<participant>-events-summary.log." << nl;
Info << "-------------------------------------------------------------------------------------" << nl;)

return;
}
17 changes: 17 additions & 0 deletions Adapter.H
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ private:
//- Configuration interfaces
std::vector<struct InterfaceConfig> interfacesConfig_;

#ifdef ADAPTER_ENABLE_TIMINGS
//- Timers
clockValue timeInConfigRead_;
clockValue timeInPreciceConstruct_;
clockValue timeInMeshSetup_;
clockValue timeInInitialize_;
clockValue timeInInitializeData_;
clockValue timeInCheckpointingSetup_;
clockValue timeInWrite_;
clockValue timeInAdvance_;
clockValue timeInRead_;
clockValue timeInCheckpointingRead_;
clockValue timeInCheckpointingWrite_;
clockValue timeInWriteResults_;
clockValue timeInFinalize_;
#endif

//- OpenFOAM runTime object
const Foam::Time& runTime_;

Expand Down
Loading

0 comments on commit 7afeaed

Please sign in to comment.