Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
IshaanDesai committed Dec 19, 2023
1 parent d08cd9b commit 87f0aba
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 56 deletions.
18 changes: 8 additions & 10 deletions examples/dummysolver/main_dummysolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ try {
if (couplingParticipant.requiresToWriteInitialData()) {
std::cout << "DUMMY (" << mpiHelper.rank()
<< "): Writing initial data\n";
couplingParticipant.writeQuantityVector(
meshName, scalarDataWriteName, writeScalarData);
couplingParticipant.writeQuantityVector(meshName, scalarDataWriteName,
writeScalarData);
couplingParticipant.writeQuantityToOtherSolver(meshName,
scalarDataWriteName);
couplingParticipant.writeQuantityVector(
meshName, vectorDataWriteName, writeVectorData);
couplingParticipant.writeQuantityVector(meshName, vectorDataWriteName,
writeVectorData);
couplingParticipant.writeQuantityToOtherSolver(meshName,
vectorDataWriteName);
}
Expand All @@ -120,17 +120,15 @@ try {
meshName, vectorDataReadName, preciceDt);

const std::vector<double> &readScalarQuantity =
couplingParticipant.getQuantityVector(meshName,
scalarDataReadName);
couplingParticipant.getQuantityVector(meshName, scalarDataReadName);

std::cout << "DUMMY (" << mpiHelper.rank() << "): Scalar data\n";
for (const double &value : readScalarQuantity)
std::cout << value << ",";
std::cout << "\n";

const std::vector<double> &readVectorQuantity =
couplingParticipant.getQuantityVector(meshName,
vectorDataReadName);
couplingParticipant.getQuantityVector(meshName, vectorDataReadName);

std::cout << "DUMMY (" << mpiHelper.rank() << "): Vector data\n";
for (const double &value : readVectorQuantity)
Expand Down Expand Up @@ -239,8 +237,8 @@ try {
scalarDataWriteName);

// Write vector data
couplingParticipant.writeQuantityVector(
meshName, vectorDataWriteName, writeVectorData);
couplingParticipant.writeQuantityVector(meshName, vectorDataWriteName,
writeVectorData);
couplingParticipant.writeQuantityToOtherSolver(meshName,
vectorDataWriteName);
preciceDt = couplingParticipant.getMaxTimeStepSize();
Expand Down
16 changes: 6 additions & 10 deletions examples/ff-pm/flow-over-cube-3d/main_ff-reversed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ std::tuple<double, double, double> writeVelocitiesOnInterfaceToFile(
if (couplingParticipant.isCoupledEntity(scvf.index())) {
const auto &pos = scvf.center();
for (int i = 0;
i < couplingParticipant.getMeshDimensions(meshName);
++i) {
i < couplingParticipant.getMeshDimensions(meshName); ++i) {
ofs << pos[i] << ",";
}
const double v = problem.dirichlet(element, scvf)[1];
Expand Down Expand Up @@ -255,8 +254,7 @@ void writePressuresOnInterfaceToFile(const std::string &meshName,
if (couplingParticipant.isCoupledEntity(scvf.index())) {
const auto &pos = scvf.center();
for (int i = 0;
i < couplingParticipant.getMeshDimensions(meshName);
++i) {
i < couplingParticipant.getMeshDimensions(meshName); ++i) {
ofs << pos[i] << ",";
}
const double p = pressureAtInterface<FluxVariables>(
Expand Down Expand Up @@ -402,8 +400,7 @@ try {
setInterfacePressures<FluxVariables>(*freeFlowProblem,
*freeFlowGridVariables, sol,
meshName, dataNameViewP);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameViewP);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameViewP);
}
couplingParticipant.initialize();

Expand Down Expand Up @@ -440,17 +437,16 @@ try {
sol_checkpoint = sol;
}

couplingParticipant.readQuantityFromOtherSolver(meshName,
dataNameViewV, dt);
couplingParticipant.readQuantityFromOtherSolver(meshName, dataNameViewV,
dt);
// solve the non-linear system
nonLinearSolver.solve(sol);

// TODO
setInterfacePressures<FluxVariables>(*freeFlowProblem,
*freeFlowGridVariables, sol,
meshName, dataNameViewP);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameViewP);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameViewP);
//Read checkpoint
freeFlowVtkWriter.write(vtkTime);
vtkTime += 1.;
Expand Down
20 changes: 8 additions & 12 deletions examples/ff-pm/flow-over-cube-3d/main_pm-reversed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,9 @@ try {
using FluxVariables = GetPropType<DarcyTypeTag, Properties::FluxVariables>;
if (couplingParticipant.requiresToWriteInitialData()) {
//TODO
setInterfaceVelocities<FluxVariables>(*darcyProblem,
*darcyGridVariables, sol,
meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameV);
setInterfaceVelocities<FluxVariables>(
*darcyProblem, *darcyGridVariables, sol, meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameV);
}
couplingParticipant.initialize();

Expand Down Expand Up @@ -477,16 +475,14 @@ try {
sol_checkpoint = sol;
}

couplingParticipant.readQuantityFromOtherSolver(meshName,
dataNameP, dt);
couplingParticipant.readQuantityFromOtherSolver(meshName, dataNameP,
dt);

// solve the non-linear system
nonLinearSolver.solve(sol);
setInterfaceVelocities<FluxVariables>(*darcyProblem,
*darcyGridVariables, sol,
meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameV);
setInterfaceVelocities<FluxVariables>(
*darcyProblem, *darcyGridVariables, sol, meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameV);

couplingParticipant.advance(dt);
preciceDt = couplingParticipant.getMaxTimeStepSize();
Expand Down
20 changes: 8 additions & 12 deletions examples/ff-pm/flow-over-square-2d/main_ff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,9 @@ try {
GetPropType<FreeFlowTypeTag, Properties::FluxVariables>;

if (couplingParticipant.requiresToWriteInitialData()) {
setInterfacePressures<FluxVariables>(*freeFlowProblem,
*freeFlowGridVariables, sol,
meshName, dataNameP);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameP);
setInterfacePressures<FluxVariables>(
*freeFlowProblem, *freeFlowGridVariables, sol, meshName, dataNameP);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameP);
}
couplingParticipant.initialize();

Expand Down Expand Up @@ -328,17 +326,15 @@ try {
sol_checkpoint = sol;
}

couplingParticipant.readQuantityFromOtherSolver(meshName,
dataNameV, dt);
couplingParticipant.readQuantityFromOtherSolver(meshName, dataNameV,
dt);
// solve the non-linear system
nonLinearSolver.solve(sol);

// TODO
setInterfacePressures<FluxVariables>(*freeFlowProblem,
*freeFlowGridVariables, sol,
meshName, dataNameP);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameP);
setInterfacePressures<FluxVariables>(
*freeFlowProblem, *freeFlowGridVariables, sol, meshName, dataNameP);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameP);
//Read checkpoint
freeFlowVtkWriter.write(vtkTime);
vtkTime += 1.;
Expand Down
20 changes: 8 additions & 12 deletions examples/ff-pm/flow-over-square-2d/main_pm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,9 @@ try {
using FluxVariables = GetPropType<DarcyTypeTag, Properties::FluxVariables>;
if (couplingParticipant.requiresToWriteInitialData()) {
//TODO
setInterfaceVelocities<FluxVariables>(*darcyProblem,
*darcyGridVariables, sol,
meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameV);
setInterfaceVelocities<FluxVariables>(
*darcyProblem, *darcyGridVariables, sol, meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameV);
}
couplingParticipant.initialize();

Expand Down Expand Up @@ -370,16 +368,14 @@ try {
sol_checkpoint = sol;
}

couplingParticipant.readQuantityFromOtherSolver(meshName,
dataNameP, dt);
couplingParticipant.readQuantityFromOtherSolver(meshName, dataNameP,
dt);

// solve the non-linear system
nonLinearSolver.solve(sol);
setInterfaceVelocities<FluxVariables>(*darcyProblem,
*darcyGridVariables, sol,
meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName,
dataNameV);
setInterfaceVelocities<FluxVariables>(
*darcyProblem, *darcyGridVariables, sol, meshName, dataNameV);
couplingParticipant.writeQuantityToOtherSolver(meshName, dataNameV);

couplingParticipant.advance(dt);
preciceDt = couplingParticipant.getMaxTimeStepSize();
Expand Down

0 comments on commit 87f0aba

Please sign in to comment.