This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/readCouplingProperties.H

171 lines
4.6 KiB
C
Raw Normal View History

2012-09-11 15:42:55 +00:00
Info << "\nReading coupling properties" << endl;
IOdictionary couplingProperties
(
IOobject
(
"couplingProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
// Read solid patch data
word solidPatchName(couplingProperties.lookup("solidPatch"));
label solidPatchID
(
stressMesh.boundaryMesh().findPatchID(solidPatchName)
);
if (solidPatchID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding solid patch"
<< abort(FatalError);
}
word solidZoneName(couplingProperties.lookup("solidZone"));
label solidZoneID =
stressMesh.faceZones().findZoneID(solidZoneName);
if (solidZoneID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding solid zone"
<< abort(FatalError);
}
// const label solidPatchStart =
2012-09-11 15:42:55 +00:00
// stressMesh.boundaryMesh()[solidPatchID].start();
// const faceZone& solidZone = stressMesh.faceZones()[solidZoneID];
// Read fluid patch data
word fluidPatchName(couplingProperties.lookup("fluidPatch"));
label fluidPatchID =
mesh.boundaryMesh().findPatchID(fluidPatchName);
if (fluidPatchID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding fluid patch"
<< abort(FatalError);
}
word fluidZoneName(couplingProperties.lookup("fluidZone"));
label fluidZoneID =
mesh.faceZones().findZoneID(fluidZoneName);
if (fluidZoneID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding fluid zone"
<< abort(FatalError);
}
// const label fluidPatchStart =
2012-09-11 15:42:55 +00:00
// mesh.boundaryMesh()[fluidPatchID].start();
// const faceZone& fluidZone = mesh.faceZones()[fluidZoneID];
// Check mesh motion solver type
bool feMotionSolver =
2012-09-11 15:42:55 +00:00
mesh.objectRegistry::foundObject<tetPointVectorField>
(
2012-09-11 15:42:55 +00:00
"motionU"
);
2012-09-11 15:42:55 +00:00
bool fvMotionSolver =
mesh.objectRegistry::foundObject<pointVectorField>
(
2012-09-11 15:42:55 +00:00
"pointMotionU"
);
// Grab solid patch field
if
(
DU.boundaryField()[solidPatchID].type()
!= solidTractionFvPatchVectorField::typeName
//!= tractionDisplacementIncrementFvPatchVectorField::typeName
2012-09-11 15:42:55 +00:00
)
{
FatalErrorIn(args.executable())
<< "Bounary condition on " << DU.name()
<< " is "
<< DU.boundaryField()[solidPatchID].type()
<< "for fluid -solid interface patch, instead "
<< solidTractionFvPatchVectorField::typeName
//<< tractionDisplacementIncrementFvPatchVectorField::typeName
2012-09-11 15:42:55 +00:00
<< abort(FatalError);
}
//tractionDisplacementIncrementFvPatchVectorField& tForce =
// refCast<tractionDisplacementIncrementFvPatchVectorField>
solidTractionFvPatchVectorField& tForce =
refCast<solidTractionFvPatchVectorField>
(
DU.boundaryField()[solidPatchID]
);
// Accumulated fluid interface displacement
IOobject accumulatedFluidInterfaceDisplacementHeader
(
"accumulatedFluidInterfaceDisplacement",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
vectorField* accumulatedFluidInterfaceDisplacementPtr = NULL;
if(accumulatedFluidInterfaceDisplacementHeader.headerOk())
{
Pout << "Reading accumulated fluid interface displacement" << endl;
accumulatedFluidInterfaceDisplacementPtr =
new vectorIOField
(
IOobject
(
"accumulatedFluidInterfaceDisplacement",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
)
);
}
else
{
accumulatedFluidInterfaceDisplacementPtr =
new vectorIOField
(
IOobject
(
"accumulatedFluidInterfaceDisplacement",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
vectorField
(
mesh.boundaryMesh()[fluidPatchID].nPoints(),
2012-09-11 15:42:55 +00:00
vector::zero
)
);
}
vectorField& accumulatedFluidInterfaceDisplacement
2012-09-11 15:42:55 +00:00
= *accumulatedFluidInterfaceDisplacementPtr;