Commit e3dce28c authored by Alexander Jaust's avatar Alexander Jaust
Browse files

Update to preCICE v2

I updated the adapter and the configuration files to preCICE 2. I also added a switch in the params.input to deactivate the CSV output.

Has been tested/adapted only for code in 'coupling-ff-pm/iterative-reversed/'
parent 09539b9f
......@@ -425,6 +425,9 @@ int main(int argc, char** argv) try
using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>;
NewtonSolver nonLinearSolver(assembler, linearSolver);
// Check whether we have to write the CSV containing data on the interface
const bool writeInterfaceDataToCSV = getParamFromGroup<bool>("preCICE", "writeCSV");
auto dt = preciceDt;
auto sol_checkpoint = sol;
......@@ -485,7 +488,7 @@ int main(int argc, char** argv) try
const double preciceDt = couplingInterface.advance( dt );
dt = std::min( preciceDt, dt );
if ( writeInterfaceDataToCSV )
{
double min = std::numeric_limits<double>::max();
double max = std::numeric_limits<double>::min();
......@@ -515,6 +518,7 @@ int main(int argc, char** argv) try
ofs.close();
}
}
if ( writeInterfaceDataToCSV )
{
const std::string filename = getParam<std::string>("Problem.Name") + "-" + darcyProblem->name() + "-interface-pressure-" + std::to_string(iter);
writePressuresOnInterfaceToFile( filename,
......@@ -544,7 +548,7 @@ int main(int argc, char** argv) try
}
// write vtk output
darcyVtkWriter.write(1.0);
if ( writeInterfaceDataToCSV )
{
double min = std::numeric_limits<double>::max();
double max = std::numeric_limits<double>::min();
......@@ -574,6 +578,7 @@ int main(int argc, char** argv) try
ofs.close();
}
}
if ( writeInterfaceDataToCSV )
{
const std::string filename = getParam<std::string>("Problem.Name") + "-" + darcyProblem->name() + "-interface-pressure";
writePressuresOnInterfaceToFile( filename,
......
......@@ -33,6 +33,9 @@ Permeability = 1e-6 # m^2
Porosity = 0.4
AlphaBeaversJoseph = 1.0
[preCICE]
writeCSV = false
[Problem]
Name = ex_ff-pm-interface
EnableGravity = false
......
......@@ -40,12 +40,12 @@
<write-data name="Velocity" mesh="DarcyMesh"/>
</participant>
<m2n:sockets from="FreeFlow" to="Darcy" distribution-type="gather-scatter" network="lo" />
<m2n:sockets from="FreeFlow" to="Darcy" network="lo" />
<coupling-scheme:parallel-implicit>
<max-time value="1"/>
<timestep-length value="1" />
<time-window-size value="1" />
<max-iterations value="100"/>
......@@ -63,15 +63,15 @@
<extrapolation-order value="0"/>
<post-processing:IQN-ILS>
<acceleration:IQN-ILS>
<data mesh="DarcyMesh" name="Velocity" />
<data mesh="DarcyMesh" name="Pressure" />
<preconditioner type="residual-sum" />
<initial-relaxation value="0.1" />
<max-used-iterations value="9" />
<timesteps-reused value="10" />
<time-windows-reused value="10" />
<filter type="QR2" limit="1e-3" />
</post-processing:IQN-ILS>
</acceleration:IQN-ILS>
</coupling-scheme:parallel-implicit>
</solver-interface>
......
......@@ -40,12 +40,12 @@
<write-data name="Velocity" mesh="DarcyMesh"/>
</participant>
<m2n:sockets from="FreeFlow" to="Darcy" distribution-type="gather-scatter" network="lo" />
<m2n:sockets from="FreeFlow" to="Darcy" network="lo" />
<coupling-scheme:serial-explicit>
<max-time value="1"/>
<timestep-length value="1" />
<time-window-size value="1" />
<participants first="FreeFlow" second="Darcy"/>
<exchange data="Pressure" mesh="DarcyMesh" from="FreeFlow" to="Darcy" initialize="false" />
......
......@@ -40,12 +40,12 @@
<write-data name="Velocity" mesh="DarcyMesh"/>
</participant>
<m2n:sockets from="FreeFlow" to="Darcy" distribution-type="gather-scatter" network="lo" />
<m2n:sockets from="FreeFlow" to="Darcy" network="lo" />
<coupling-scheme:serial-implicit>
<max-time value="1"/>
<timestep-length value="1" />
<time-window-size value="1" />
<max-iterations value="10"/>
......@@ -64,13 +64,13 @@
<extrapolation-order value="0"/>
<!--
<post-processing:IQN-ILS>
<acceleration:IQN-ILS>
<data mesh="DarcyMesh" name="Velocity" />
<initial-relaxation value="0.1" />
<max-used-iterations value="9" />
<timesteps-reused value="10" />
<time-windows-reused value="10" />
<filter type="QR2" limit="1e-3" />
</post-processing:IQN-ILS>
</acceleration:IQN-ILS>
-->
</coupling-scheme:serial-implicit>
......
......@@ -40,12 +40,12 @@
<write-data name="Velocity" mesh="DarcyMesh"/>
</participant>
<m2n:sockets from="FreeFlow" to="Darcy" distribution-type="gather-scatter" network="lo" />
<m2n:sockets from="FreeFlow" to="Darcy" network="lo" />
<coupling-scheme:serial-implicit>
<max-time value="1"/>
<timestep-length value="1" />
<time-window-size value="1" />
<max-iterations value="10"/>
......@@ -64,13 +64,13 @@
<extrapolation-order value="0"/>
<!--
<post-processing:IQN-ILS>
<acceleration:IQN-ILS>
<data mesh="DarcyMesh" name="Velocity" />
<initial-relaxation value="0.1" />
<max-used-iterations value="9" />
<timesteps-reused value="10" />
<time-windows-reused value="10" />
<filter type="QR2" limit="1e-3" />
</post-processing:IQN-ILS>
</acceleration:IQN-ILS>
-->
</coupling-scheme:serial-implicit>
......
......@@ -24,9 +24,8 @@ PreciceAdapter& PreciceAdapter::getInstance()
void PreciceAdapter::announceSolver(const std::string &name, const std::string configurationFileName, const int rank, const int size)
{
assert( precice_ == nullptr );
precice_ = std::make_unique<precice::SolverInterface>(name, rank, size);
precice_ = std::make_unique<precice::SolverInterface>(name, configurationFileName, rank, size);
wasCreated_ = true;
precice_->configure( configurationFileName );
}
size_t PreciceAdapter::announceQuantity(const std::string &name)
......@@ -258,7 +257,7 @@ bool PreciceAdapter::checkIfActionIsRequired( const std::string& condition )
void PreciceAdapter::actionIsFulfilled(const std::string& condition)
{
assert( wasCreated_ );
precice_->fulfilledAction( condition );
precice_->markActionFulfilled( condition );
}
void PreciceAdapter::readBlockScalarDataFromPrecice(const int dataID, std::vector<double> &data)
......@@ -284,7 +283,7 @@ bool PreciceAdapter::hasToWriteInitialData()
void PreciceAdapter::announceInitialDataWritten()
{
assert( wasCreated_ );
precice_->fulfilledAction( precice::constants::actionWriteInitialData() );
precice_->markActionFulfilled( precice::constants::actionWriteInitialData() );
}
bool PreciceAdapter::hasToReadIterationCheckpoint()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment