Modular solvers: Reorganised directory structure of applications and tutorials
The new flexible and extensible modular solvers structure already provides most
of the simulation functionality needed for single phase, multiphase,
multicomponent etc. fluid flow problems as well as a very effective method of
combining these with solid heat transfer, solid stress, surface film to solve
complex multi-region, multi-physics problems and are now the primary mechanism
for the further development of OpenFOAM simulation capability in future. To
emphasis this for both users and developers the applications/solvers directory
has been separated into applications/modules containing all the solver modules:
├── modules
│ ├── compressibleMultiphaseVoF
│ ├── compressibleVoF
│ ├── film
│ ├── fluid
│ ├── fluidSolver
│ ├── functions
│ ├── incompressibleDenseParticleFluid
│ ├── incompressibleDriftFlux
│ ├── incompressibleFluid
│ ├── incompressibleMultiphaseVoF
│ ├── incompressibleVoF
│ ├── isothermalFilm
│ ├── isothermalFluid
│ ├── movingMesh
│ ├── multicomponentFluid
│ ├── multiphaseEuler
│ ├── multiphaseVoFSolver
│ ├── shockFluid
│ ├── solid
│ ├── solidDisplacement
│ ├── twoPhaseSolver
│ ├── twoPhaseVoFSolver
│ ├── VoFSolver
│ └── XiFluid
applications/solvers containing the foamRun and foamMultiRun solver applications
which instantiate and execute the chosen solver modules and also standalone
solver applications for special initialisation and test activities:
├── solvers
│ ├── boundaryFoam
│ ├── chemFoam
│ ├── foamMultiRun
│ ├── foamRun
│ └── potentialFoam
and applications/legacy containing legacy solver applications which are not
currently being actively developed but the functionality of which will be merged
into the solver modules or form the basis of new solver modules as the need
arises:
├── legacy
│ ├── basic
│ │ ├── financialFoam
│ │ └── laplacianFoam
│ ├── combustion
│ │ └── PDRFoam
│ ├── compressible
│ │ └── rhoPorousSimpleFoam
│ ├── electromagnetics
│ │ ├── electrostaticFoam
│ │ ├── magneticFoam
│ │ └── mhdFoam
│ ├── incompressible
│ │ ├── adjointShapeOptimisationFoam
│ │ ├── dnsFoam
│ │ ├── icoFoam
│ │ ├── porousSimpleFoam
│ │ └── shallowWaterFoam
│ └── lagrangian
│ ├── dsmcFoam
│ ├── mdEquilibrationFoam
│ └── mdFoam
Correspondingly the tutorials directory structure has been reorganised with the
modular solver directories at the top level with names that make it easier for
users to find example cases relating to their particular requirements and a
legacy sub-directory containing cases corresponding to the legacy solver
applications listed above:
├── compressibleMultiphaseVoF
│ └── damBreak4phaseLaminar
├── compressibleVoF
│ ├── ballValve
│ ├── climbingRod
│ ├── damBreak
│ ├── depthCharge2D
│ ├── depthCharge3D
│ ├── sloshingTank2D
│ └── throttle
├── film
│ └── rivuletPanel
├── fluid
│ ├── aerofoilNACA0012
│ ├── aerofoilNACA0012Steady
│ ├── angledDuct
│ ├── angledDuctExplicitFixedCoeff
│ ├── angledDuctLTS
│ ├── annularThermalMixer
│ ├── BernardCells
│ ├── blockedChannel
│ ├── buoyantCavity
│ ├── cavity
│ ├── decompressionTank
│ ├── externalCoupledCavity
│ ├── forwardStep
│ ├── helmholtzResonance
│ ├── hotRadiationRoom
│ ├── hotRadiationRoomFvDOM
│ ├── hotRoom
│ ├── hotRoomBoussinesq
│ ├── hotRoomBoussinesqSteady
│ ├── hotRoomComfort
│ ├── iglooWithFridges
│ ├── mixerVessel2DMRF
│ ├── nacaAirfoil
│ ├── pitzDaily
│ ├── prism
│ ├── shockTube
│ ├── squareBend
│ ├── squareBendLiq
│ └── squareBendLiqSteady
├── incompressibleDenseParticleFluid
│ ├── column
│ ├── cyclone
│ ├── Goldschmidt
│ ├── GoldschmidtMPPIC
│ └── injectionChannel
├── incompressibleDriftFlux
│ ├── dahl
│ ├── mixerVessel2DMRF
│ └── tank3D
├── incompressibleFluid
│ ├── airFoil2D
│ ├── ballValve
│ ├── blockedChannel
│ ├── cavity
│ ├── cavityCoupledU
│ ├── channel395
│ ├── drivaerFastback
│ ├── ductSecondaryFlow
│ ├── elipsekkLOmega
│ ├── flowWithOpenBoundary
│ ├── hopperParticles
│ ├── impeller
│ ├── mixerSRF
│ ├── mixerVessel2D
│ ├── mixerVessel2DMRF
│ ├── mixerVesselHorizontal2DParticles
│ ├── motorBike
│ ├── motorBikeSteady
│ ├── movingCone
│ ├── offsetCylinder
│ ├── oscillatingInlet
│ ├── pipeCyclic
│ ├── pitzDaily
│ ├── pitzDailyLES
│ ├── pitzDailyLESDevelopedInlet
│ ├── pitzDailyLTS
│ ├── pitzDailyPulse
│ ├── pitzDailyScalarTransport
│ ├── pitzDailySteady
│ ├── pitzDailySteadyExperimentalInlet
│ ├── pitzDailySteadyMappedToPart
│ ├── pitzDailySteadyMappedToRefined
│ ├── planarContraction
│ ├── planarCouette
│ ├── planarPoiseuille
│ ├── porousBlockage
│ ├── propeller
│ ├── roomResidenceTime
│ ├── rotor2DRotating
│ ├── rotor2DSRF
│ ├── rotorDisk
│ ├── T3A
│ ├── TJunction
│ ├── TJunctionFan
│ ├── turbineSiting
│ ├── waveSubSurface
│ ├── windAroundBuildings
│ └── wingMotion
├── incompressibleMultiphaseVoF
│ ├── damBreak4phase
│ ├── damBreak4phaseFineLaminar
│ ├── damBreak4phaseLaminar
│ └── mixerVessel2DMRF
├── incompressibleVoF
│ ├── angledDuct
│ ├── capillaryRise
│ ├── cavitatingBullet
│ ├── climbingRod
│ ├── containerDischarge2D
│ ├── damBreak
│ ├── damBreakLaminar
│ ├── damBreakPorousBaffle
│ ├── damBreakWithObstacle
│ ├── DTCHull
│ ├── DTCHullMoving
│ ├── DTCHullWave
│ ├── floatingObject
│ ├── floatingObjectWaves
│ ├── forcedUpstreamWave
│ ├── mixerVessel
│ ├── mixerVessel2DMRF
│ ├── mixerVesselHorizontal2D
│ ├── nozzleFlow2D
│ ├── planingHullW3
│ ├── propeller
│ ├── sloshingCylinder
│ ├── sloshingTank2D
│ ├── sloshingTank2D3DoF
│ ├── sloshingTank3D
│ ├── sloshingTank3D3DoF
│ ├── sloshingTank3D6DoF
│ ├── testTubeMixer
│ ├── waterChannel
│ ├── wave
│ ├── wave3D
│ └── weirOverflow
├── isothermalFilm
│ └── rivuletPanel
├── isothermalFluid
│ ├── potentialFreeSurfaceMovingOscillatingBox
│ └── potentialFreeSurfaceOscillatingBox
├── legacy
│ ├── basic
│ │ ├── financialFoam
│ │ │ └── europeanCall
│ │ └── laplacianFoam
│ │ └── flange
│ ├── combustion
│ │ └── PDRFoam
│ │ └── flamePropagationWithObstacles
│ ├── compressible
│ │ └── rhoPorousSimpleFoam
│ │ ├── angledDuctExplicit
│ │ └── angledDuctImplicit
│ ├── electromagnetics
│ │ ├── electrostaticFoam
│ │ │ └── chargedWire
│ │ └── mhdFoam
│ │ └── hartmann
│ ├── incompressible
│ │ ├── adjointShapeOptimisationFoam
│ │ │ └── pitzDaily
│ │ ├── dnsFoam
│ │ │ └── boxTurb16
│ │ ├── icoFoam
│ │ │ ├── cavity
│ │ │ └── elbow
│ │ ├── porousSimpleFoam
│ │ │ ├── angledDuctExplicit
│ │ │ └── angledDuctImplicit
│ │ └── shallowWaterFoam
│ │ └── squareBump
│ ├── lagrangian
│ │ ├── dsmcFoam
│ │ │ ├── freeSpacePeriodic
│ │ │ ├── freeSpaceStream
│ │ │ ├── supersonicCorner
│ │ │ └── wedge15Ma5
│ │ ├── mdEquilibrationFoam
│ │ │ ├── periodicCubeArgon
│ │ │ └── periodicCubeWater
│ │ └── mdFoam
│ │ └── nanoNozzle
├── mesh
│ ├── blockMesh
│ │ ├── pipe
│ │ ├── sphere
│ │ ├── sphere7
│ │ └── sphere7ProjectedEdges
│ ├── refineMesh
│ │ └── refineFieldDirs
│ └── snappyHexMesh
│ ├── flange
│ └── pipe
├── movingMesh
│ └── SnakeRiverCanyon
├── multicomponentFluid
│ ├── aachenBomb
│ ├── counterFlowFlame2D
│ ├── counterFlowFlame2D_GRI
│ ├── counterFlowFlame2D_GRI_TDAC
│ ├── counterFlowFlame2DLTS
│ ├── counterFlowFlame2DLTS_GRI_TDAC
│ ├── DLR_A_LTS
│ ├── filter
│ ├── lockExchange
│ ├── membrane
│ ├── nc7h16
│ ├── parcelInBox
│ ├── SandiaD_LTS
│ ├── simplifiedSiwek
│ ├── smallPoolFire2D
│ ├── smallPoolFire3D
│ ├── verticalChannel
│ ├── verticalChannelLTS
│ └── verticalChannelSteady
├── multiphaseEuler
│ ├── bed
│ ├── bubbleColumn
│ ├── bubbleColumnEvaporating
│ ├── bubbleColumnEvaporatingDissolving
│ ├── bubbleColumnEvaporatingReacting
│ ├── bubbleColumnIATE
│ ├── bubbleColumnLaminar
│ ├── bubbleColumnLES
│ ├── bubblePipe
│ ├── damBreak4phase
│ ├── fluidisedBed
│ ├── fluidisedBedLaminar
│ ├── Grossetete
│ ├── hydrofoil
│ ├── injection
│ ├── LBend
│ ├── mixerVessel2D
│ ├── mixerVessel2DMRF
│ ├── pipeBend
│ ├── steamInjection
│ ├── titaniaSynthesis
│ ├── titaniaSynthesisSurface
│ ├── wallBoilingIATE
│ ├── wallBoilingPolydisperse
│ └── wallBoilingPolydisperseTwoGroups
├── multiRegion
│ ├── CHT
│ │ ├── circuitBoardCooling
│ │ ├── coolingCylinder2D
│ │ ├── coolingSphere
│ │ ├── heatedDuct
│ │ ├── heatExchanger
│ │ ├── multiphaseCoolingCylinder2D
│ │ ├── reverseBurner
│ │ ├── shellAndTubeHeatExchanger
│ │ ├── VoFcoolingCylinder2D
│ │ └── wallBoiling
│ └── film
│ ├── cylinder
│ ├── cylinderDripping
│ ├── cylinderVoF
│ ├── hotBoxes
│ ├── rivuletBox
│ ├── rivuletPanel
│ ├── splashPanel
│ └── VoFToFilm
├── potentialFoam
│ ├── cylinder
│ └── pitzDaily
├── resources
│ ├── blockMesh
│ ├── geometry
│ └── thermoData
├── shockFluid
│ ├── biconic25-55Run35
│ ├── forwardStep
│ ├── LadenburgJet60psi
│ ├── movingCone
│ ├── obliqueShock
│ ├── shockTube
│ └── wedge15Ma5
├── solidDisplacement
│ ├── beamEndLoad
│ └── plateHole
└── XiFluid
├── kivaTest
└── moriyoshiHomogeneous
This commit is contained in:
10
applications/modules/solidDisplacement/Allwmake
Executable file
10
applications/modules/solidDisplacement/Allwmake
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Parse arguments for library compilation
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
wmake $targetType solidDisplacementThermo
|
||||
wmake $targetType
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
5
applications/modules/solidDisplacement/Make/files
Normal file
5
applications/modules/solidDisplacement/Make/files
Normal file
@ -0,0 +1,5 @@
|
||||
derivedFvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C
|
||||
derivedFvPatchFields/hydrostaticDisplacement/hydrostaticDisplacementFvPatchVectorField.C
|
||||
solidDisplacement.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libsolidDisplacement
|
||||
23
applications/modules/solidDisplacement/Make/options
Normal file
23
applications/modules/solidDisplacement/Make/options
Normal file
@ -0,0 +1,23 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_MODULES)/solid/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/ThermophysicalTransportModels/thermophysicalTransportModel/lnInclude \
|
||||
-I$(LIB_SRC)/ThermophysicalTransportModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lsolid \
|
||||
-lsolidThermo \
|
||||
-lsolidDisplacementThermo \
|
||||
-lsolidThermophysicalTransportModels \
|
||||
-lcoupledThermophysicalTransportModels \
|
||||
-lspecie \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-lfvModels \
|
||||
-lfvConstraints
|
||||
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hydrostaticDisplacementFvPatchVectorField.H"
|
||||
#include "uniformDimensionedFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::hydrostaticDisplacementFvPatchVectorField::
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
tractionDisplacementFvPatchVectorField(p, iF),
|
||||
rhoLiquid_(0.0),
|
||||
liquidSurfacePressure_(0.0),
|
||||
liquidSurfacePoint_(Zero)
|
||||
{}
|
||||
|
||||
|
||||
Foam::hydrostaticDisplacementFvPatchVectorField::
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
tractionDisplacementFvPatchVectorField(p, iF),
|
||||
rhoLiquid_(dict.lookup<scalar>("rhoLiquid")),
|
||||
liquidSurfacePressure_(dict.lookup<scalar>("liquidSurfacePressure")),
|
||||
liquidSurfacePoint_(dict.lookup("liquidSurfacePoint"))
|
||||
{}
|
||||
|
||||
|
||||
Foam::hydrostaticDisplacementFvPatchVectorField::
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const hydrostaticDisplacementFvPatchVectorField& tdpvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
tractionDisplacementFvPatchVectorField(tdpvf, p, iF, mapper),
|
||||
rhoLiquid_(tdpvf.rhoLiquid_),
|
||||
liquidSurfacePressure_(tdpvf.liquidSurfacePressure_),
|
||||
liquidSurfacePoint_(tdpvf.liquidSurfacePoint_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::hydrostaticDisplacementFvPatchVectorField::
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const hydrostaticDisplacementFvPatchVectorField& tdpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
tractionDisplacementFvPatchVectorField(tdpvf, iF),
|
||||
rhoLiquid_(tdpvf.rhoLiquid_),
|
||||
liquidSurfacePressure_(tdpvf.liquidSurfacePressure_),
|
||||
liquidSurfacePoint_(tdpvf.liquidSurfacePoint_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::hydrostaticDisplacementFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const uniformDimensionedVectorField& g =
|
||||
db().lookupObject<uniformDimensionedVectorField>("g");
|
||||
|
||||
tractionDisplacementFvPatchVectorField::updateCoeffs
|
||||
(
|
||||
liquidSurfacePressure_
|
||||
+ rhoLiquid_
|
||||
*max(g.value() & (patch().Cf() - liquidSurfacePoint_), scalar(0))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::hydrostaticDisplacementFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntry(os, "rhoLiquid", rhoLiquid_);
|
||||
writeEntry(os, "liquidSurfacePressure", liquidSurfacePressure_);
|
||||
writeEntry(os, "liquidSurfacePoint", liquidSurfacePoint_);
|
||||
writeEntry(os, "value", *this);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,144 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::hydrostaticDisplacementFvPatchVectorField
|
||||
|
||||
Description
|
||||
Fixed traction boundary condition for the standard linear elastic, fixed
|
||||
coefficient displacement equation in which the traction is caused by
|
||||
the hydrostatic pressure of an external liquid reservoir.
|
||||
|
||||
SourceFiles
|
||||
hydrostaticDisplacementFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef hydrostaticDisplacementFvPatchVectorField_H
|
||||
#define hydrostaticDisplacementFvPatchVectorField_H
|
||||
|
||||
#include "tractionDisplacementFvPatchVectorField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class hydrostaticDisplacementFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class hydrostaticDisplacementFvPatchVectorField
|
||||
:
|
||||
public tractionDisplacementFvPatchVectorField
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Density of surrounding liquid
|
||||
scalar rhoLiquid_;
|
||||
|
||||
//- Pressure above the liquid
|
||||
scalar liquidSurfacePressure_;
|
||||
|
||||
//- Point on liquid surface
|
||||
vector liquidSurfacePoint_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("hydrostaticDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// hydrostaticDisplacementFvPatchVectorField onto a new patch
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const hydrostaticDisplacementFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Disallow copy without setting internal field reference
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const hydrostaticDisplacementFvPatchVectorField&
|
||||
) = delete;
|
||||
|
||||
//- Copy constructor setting internal field reference
|
||||
hydrostaticDisplacementFvPatchVectorField
|
||||
(
|
||||
const hydrostaticDisplacementFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new hydrostaticDisplacementFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,155 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tractionDisplacementFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(p, iF),
|
||||
traction_(p.size(), Zero),
|
||||
pressure_()
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
gradient() = Zero;
|
||||
}
|
||||
|
||||
|
||||
Foam::tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(p, iF),
|
||||
traction_("traction", dict, p.size()),
|
||||
pressure_(Function1<scalar>::New("pressure", dict))
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
gradient() = Zero;
|
||||
}
|
||||
|
||||
|
||||
Foam::tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField& tdpvf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(tdpvf, p, iF, mapper),
|
||||
traction_(mapper(tdpvf.traction_)),
|
||||
pressure_(tdpvf.pressure_, false)
|
||||
{}
|
||||
|
||||
|
||||
Foam::tractionDisplacementFvPatchVectorField::
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField& tdpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(tdpvf, iF),
|
||||
traction_(tdpvf.traction_),
|
||||
pressure_(tdpvf.pressure_, false)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::tractionDisplacementFvPatchVectorField::map
|
||||
(
|
||||
const fvPatchVectorField& ptf,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
{
|
||||
fixedGradientFvPatchVectorField::map(ptf, mapper);
|
||||
|
||||
const tractionDisplacementFvPatchVectorField& dmptf =
|
||||
refCast<const tractionDisplacementFvPatchVectorField>(ptf);
|
||||
|
||||
mapper(traction_, dmptf.traction_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::tractionDisplacementFvPatchVectorField::reset
|
||||
(
|
||||
const fvPatchVectorField& ptf
|
||||
)
|
||||
{
|
||||
fixedGradientFvPatchVectorField::reset(ptf);
|
||||
|
||||
const tractionDisplacementFvPatchVectorField& dmptf =
|
||||
refCast<const tractionDisplacementFvPatchVectorField>(ptf);
|
||||
|
||||
traction_.reset(dmptf.traction_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->updateCoeffs(pressure_->value(this->db().time().userTimeValue()));
|
||||
}
|
||||
|
||||
|
||||
void Foam::tractionDisplacementFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntry(os, "traction", traction_);
|
||||
writeEntry(os, pressure_());
|
||||
writeEntry(os, "value", *this);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
tractionDisplacementFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,178 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::tractionDisplacementFvPatchVectorField
|
||||
|
||||
Description
|
||||
Fixed traction boundary condition for the standard linear elastic, fixed
|
||||
coefficient displacement equation.
|
||||
|
||||
SourceFiles
|
||||
tractionDisplacementFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef tractionDisplacementFvPatchVectorField_H
|
||||
#define tractionDisplacementFvPatchVectorField_H
|
||||
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "Function1.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class tractionDisplacementFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class tractionDisplacementFvPatchVectorField
|
||||
:
|
||||
public fixedGradientFvPatchVectorField
|
||||
{
|
||||
// Private Data
|
||||
|
||||
vectorField traction_;
|
||||
autoPtr<Function1<scalar>> pressure_;
|
||||
|
||||
protected:
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
// for the given pressure
|
||||
template<class Type>
|
||||
void updateCoeffs(const Type& pressure);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("tractionDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// tractionDisplacementFvPatchVectorField onto a new patch
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Disallow copy without setting internal field reference
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField&
|
||||
) = delete;
|
||||
|
||||
//- Copy constructor setting internal field reference
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
const tractionDisplacementFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
virtual const vectorField& traction() const
|
||||
{
|
||||
return traction_;
|
||||
}
|
||||
|
||||
virtual vectorField& traction()
|
||||
{
|
||||
return traction_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map the given fvPatchField onto this fvPatchField
|
||||
virtual void map
|
||||
(
|
||||
const fvPatchVectorField&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reset the fvPatchField to the given fvPatchField
|
||||
// Used for mesh to mesh mapping
|
||||
virtual void reset(const fvPatchVectorField&);
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "tractionDisplacementFvPatchVectorFieldTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,87 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "tractionDisplacementFvPatchVectorField.H"
|
||||
#include "solidDisplacementThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::tractionDisplacementFvPatchVectorField::updateCoeffs
|
||||
(
|
||||
const Type& pressure
|
||||
)
|
||||
{
|
||||
const label patchi = patch().index();
|
||||
|
||||
const solidDisplacementThermo& thermo =
|
||||
db().lookupObject<solidDisplacementThermo>
|
||||
(
|
||||
physicalProperties::typeName
|
||||
);
|
||||
|
||||
const scalarField& E = thermo.E(patchi);
|
||||
const scalarField& nu = thermo.nu(patchi);
|
||||
|
||||
const scalarField mu(E/(2.0*(1.0 + nu)));
|
||||
const scalarField lambda
|
||||
(
|
||||
thermo.planeStress()
|
||||
? nu*E/((1 + nu)*(1 - nu))
|
||||
: nu*E/((1 + nu)*(1 - 2*nu))
|
||||
);
|
||||
const scalarField threeK
|
||||
(
|
||||
thermo.planeStress()
|
||||
? E/(1 - nu)
|
||||
: E/(1 - 2*nu)
|
||||
);
|
||||
|
||||
const scalarField twoMuLambda(2*mu + lambda);
|
||||
|
||||
const vectorField n(patch().nf());
|
||||
|
||||
const fvPatchField<symmTensor>& sigmaD =
|
||||
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
||||
|
||||
gradient() =
|
||||
(
|
||||
(traction_ - pressure*n)
|
||||
+ twoMuLambda*fvPatchField<vector>::snGrad() - (n & sigmaD)
|
||||
)/twoMuLambda;
|
||||
|
||||
if (thermo.thermalStress())
|
||||
{
|
||||
const scalarField& alphav = thermo.alphav(patchi);
|
||||
|
||||
gradient() +=
|
||||
n*threeK*alphav*thermo.T().boundaryField()[patchi]/twoMuLambda;
|
||||
}
|
||||
|
||||
fixedGradientFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
281
applications/modules/solidDisplacement/solidDisplacement.C
Normal file
281
applications/modules/solidDisplacement/solidDisplacement.C
Normal file
@ -0,0 +1,281 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "solidDisplacement.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "fvcLaplacian.H"
|
||||
#include "fvmD2dt2.H"
|
||||
#include "fvmLaplacian.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solvers
|
||||
{
|
||||
defineTypeNameAndDebug(solidDisplacement, 0);
|
||||
addToRunTimeSelectionTable(solver, solidDisplacement, fvMesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::solidDisplacement::readControls()
|
||||
{
|
||||
solid::readControls();
|
||||
|
||||
nCorr = pimple.dict().lookupOrDefault<int>("nCorrectors", 1);
|
||||
convergenceTolerance = pimple.dict().lookupOrDefault<scalar>("D", 0);
|
||||
pimple.dict().lookup("compactNormalStress") >> compactNormalStress;
|
||||
accFac = pimple.dict().lookupOrDefault<scalar>("accelerationFactor", 1);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::solidDisplacement::solidDisplacement(fvMesh& mesh)
|
||||
:
|
||||
solid
|
||||
(
|
||||
mesh,
|
||||
autoPtr<solidThermo>(new solidDisplacementThermo(mesh))
|
||||
),
|
||||
|
||||
thermo_(refCast<solidDisplacementThermo>(solid::thermo_)),
|
||||
|
||||
compactNormalStress(pimple.dict().lookup("compactNormalStress")),
|
||||
|
||||
D_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"D",
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
),
|
||||
|
||||
E(thermo_.E()),
|
||||
nu(thermo_.nu()),
|
||||
|
||||
mu(E/(2*(1 + nu))),
|
||||
|
||||
lambda
|
||||
(
|
||||
thermo_.planeStress()
|
||||
? nu*E/((1 + nu)*(1 - nu))
|
||||
: nu*E/((1 + nu)*(1 - 2*nu))
|
||||
),
|
||||
|
||||
threeK
|
||||
(
|
||||
thermo_.planeStress()
|
||||
? E/(1 - nu)
|
||||
: E/(1 - 2*nu)
|
||||
),
|
||||
|
||||
threeKalpha("threeKalpha", threeK*thermo_.alphav()),
|
||||
|
||||
sigmaD
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigmaD",
|
||||
runTime.name(),
|
||||
mesh
|
||||
),
|
||||
mu*twoSymm(fvc::grad(D_)) + lambda*(I*tr(fvc::grad(D_)))
|
||||
),
|
||||
|
||||
divSigmaExp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"divSigmaExp",
|
||||
runTime.name(),
|
||||
mesh
|
||||
),
|
||||
fvc::div(sigmaD)
|
||||
- (
|
||||
compactNormalStress
|
||||
? fvc::laplacian(2*mu + lambda, D_, "laplacian(DD,D)")
|
||||
: fvc::div((2*mu + lambda)*fvc::grad(D_), "div(sigmaD)")
|
||||
)
|
||||
),
|
||||
|
||||
thermo(thermo_),
|
||||
D(D_)
|
||||
{
|
||||
mesh.schemes().setFluxRequired(D.name());
|
||||
|
||||
// Read the controls
|
||||
readControls();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::solidDisplacement::~solidDisplacement()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::solidDisplacement::prePredictor()
|
||||
{
|
||||
if (thermo.thermalStress())
|
||||
{
|
||||
solid::prePredictor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::solidDisplacement::thermophysicalPredictor()
|
||||
{
|
||||
if (thermo.thermalStress())
|
||||
{
|
||||
solid::thermophysicalPredictor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::solidDisplacement::pressureCorrector()
|
||||
{
|
||||
volVectorField& D(D_);
|
||||
|
||||
const volScalarField& rho = thermo_.rho();
|
||||
|
||||
int iCorr = 0;
|
||||
scalar initialResidual = 0;
|
||||
|
||||
{
|
||||
{
|
||||
fvVectorMatrix DEqn
|
||||
(
|
||||
fvm::d2dt2(rho, D)
|
||||
==
|
||||
fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)")
|
||||
+ divSigmaExp
|
||||
+ rho*fvModels().d2dt2(D)
|
||||
);
|
||||
|
||||
if (thermo.thermalStress())
|
||||
{
|
||||
DEqn += fvc::grad(threeKalpha*T);
|
||||
}
|
||||
|
||||
fvConstraints().constrain(DEqn);
|
||||
|
||||
initialResidual = DEqn.solve().max().initialResidual();
|
||||
|
||||
// For steady-state optionally accelerate the solution
|
||||
// by over-relaxing the displacement
|
||||
if (mesh.schemes().steady() && accFac > 1)
|
||||
{
|
||||
D += (accFac - 1)*(D - D.oldTime());
|
||||
}
|
||||
|
||||
if (!compactNormalStress)
|
||||
{
|
||||
divSigmaExp = fvc::div(DEqn.flux());
|
||||
}
|
||||
}
|
||||
|
||||
const volTensorField gradD(fvc::grad(D));
|
||||
sigmaD = mu*twoSymm(gradD) + (lambda*I)*tr(gradD);
|
||||
|
||||
if (compactNormalStress)
|
||||
{
|
||||
divSigmaExp = fvc::div
|
||||
(
|
||||
sigmaD - (2*mu + lambda)*gradD,
|
||||
"div(sigmaD)"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
divSigmaExp += fvc::div(sigmaD);
|
||||
}
|
||||
|
||||
} while (initialResidual > convergenceTolerance && ++iCorr < nCorr);
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::solidDisplacement::postCorrector()
|
||||
{
|
||||
if (thermo.thermalStress())
|
||||
{
|
||||
solid::postCorrector();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::solidDisplacement::postSolve()
|
||||
{
|
||||
if (runTime.writeTime())
|
||||
{
|
||||
volSymmTensorField sigma
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigma",
|
||||
runTime.name(),
|
||||
mesh
|
||||
),
|
||||
sigmaD
|
||||
);
|
||||
|
||||
if (thermo.thermalStress())
|
||||
{
|
||||
sigma = sigma - I*(threeKalpha*thermo.T());
|
||||
}
|
||||
|
||||
volScalarField sigmaEq
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"sigmaEq",
|
||||
runTime.name(),
|
||||
mesh
|
||||
),
|
||||
sqrt((3.0/2.0)*magSqr(dev(sigma)))
|
||||
);
|
||||
|
||||
Info<< "Max sigmaEq = " << max(sigmaEq).value()
|
||||
<< endl;
|
||||
|
||||
sigma.write();
|
||||
sigmaEq.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
194
applications/modules/solidDisplacement/solidDisplacement.H
Normal file
194
applications/modules/solidDisplacement/solidDisplacement.H
Normal file
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::solvers::solidDisplacement
|
||||
|
||||
Description
|
||||
Solver module for steady or transient segregated finite-volume solution of
|
||||
linear-elastic, small-strain deformation of a solid body, with optional
|
||||
thermal diffusion and thermal stresses.
|
||||
|
||||
Solves for the displacement vector field D, also generating the stress
|
||||
tensor field sigma, including the thermal stress contribution if selected.
|
||||
|
||||
SourceFiles
|
||||
solidDisplacement.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidDisplacement_H
|
||||
#define solidDisplacement_H
|
||||
|
||||
#include "solid.H"
|
||||
#include "solidDisplacementThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solvers
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class solidDisplacement Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class solidDisplacement
|
||||
:
|
||||
public solid
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Thermophysical properties
|
||||
|
||||
solidDisplacementThermo& thermo_;
|
||||
|
||||
|
||||
// Solution algorithm controls
|
||||
|
||||
//- Switch for normal stress discretisation (required)
|
||||
// The compact form uses snGrad (more convergent, less accurate)
|
||||
// The non-compact form uses grad (less convergent, more accurate)
|
||||
Switch compactNormalStress;
|
||||
|
||||
//- Maximum number of displacement/stress correctors per time-step
|
||||
// Defaults to 1
|
||||
int nCorr;
|
||||
|
||||
//- Convergence tolerance for the displacement/stress correctors
|
||||
// Defaults to 0
|
||||
scalar convergenceTolerance;
|
||||
|
||||
//- Acceleration factor for faster steady-state simulations
|
||||
// Applies over-relaxation to the displacement field after solution
|
||||
// Typically between 1 and 2, the optimal value is case dependent
|
||||
// and should be selected to maximise convergence rate while
|
||||
// maintaining stability.
|
||||
// Should be set lower for higher Poisson's ratios for stability.
|
||||
scalar accFac;
|
||||
|
||||
|
||||
// Kinematic properties
|
||||
|
||||
//- Displacement field
|
||||
volVectorField D_;
|
||||
|
||||
//- Young's modulus
|
||||
const volScalarField& E;
|
||||
|
||||
//- Poisson's ratio
|
||||
const volScalarField& nu;
|
||||
|
||||
//- Lame's coefficient
|
||||
const volScalarField mu;
|
||||
|
||||
//- Lame's coefficient
|
||||
const volScalarField lambda;
|
||||
|
||||
const volScalarField threeK;
|
||||
|
||||
const volScalarField threeKalpha;
|
||||
|
||||
|
||||
// Cached temporary fields
|
||||
|
||||
//- Stress field
|
||||
volSymmTensorField sigmaD;
|
||||
|
||||
//- Divergence of the explicit part of the stress
|
||||
volVectorField divSigmaExp;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read controls
|
||||
virtual void readControls();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Public Data
|
||||
|
||||
//- Reference to the solid thermophysical properties
|
||||
const solidDisplacementThermo& thermo;
|
||||
|
||||
//- Reference to the Displacement field
|
||||
const volVectorField& D;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("solidDisplacement");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from region mesh
|
||||
solidDisplacement(fvMesh& mesh);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
solidDisplacement(const solidDisplacement&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~solidDisplacement();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Called at the beginning of the PIMPLE loop
|
||||
virtual void prePredictor();
|
||||
|
||||
//- Construct and solve the energy equation,
|
||||
// convert to temperature
|
||||
// and update thermophysical and transport properties
|
||||
virtual void thermophysicalPredictor();
|
||||
|
||||
//- Construct and solve the displacement equation to obtain the stress
|
||||
virtual void pressureCorrector();
|
||||
|
||||
//- Correct the thermophysical transport modelling
|
||||
virtual void postCorrector();
|
||||
|
||||
//- Called after the PIMPLE loop at the end of the time-step
|
||||
virtual void postSolve();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const solidDisplacement&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace solvers
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,3 @@
|
||||
solidDisplacementThermo.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libsolidDisplacementThermo
|
||||
@ -0,0 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lsolidThermo
|
||||
@ -0,0 +1,106 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "solidDisplacementThermo.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * Private Static Data * * * * * * * * * * * * * */
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(solidDisplacementThermo, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidDisplacementThermo::solidDisplacementThermo
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& phaseName
|
||||
)
|
||||
:
|
||||
constSolidThermo(mesh, phaseName),
|
||||
planeStress_(lookup("planeStress")),
|
||||
thermalStress_(lookup("thermalStress")),
|
||||
E_(readProperty<scalar>("E", dimPressure)),
|
||||
nu_(readProperty<scalar>("nu", dimless)),
|
||||
alphav_(readProperty<scalar>("alphav", dimless/dimTemperature))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solidDisplacementThermo::~solidDisplacementThermo()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::volScalarField& Foam::solidDisplacementThermo::E() const
|
||||
{
|
||||
return E_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarField& Foam::solidDisplacementThermo::E
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return E_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::solidDisplacementThermo::nu() const
|
||||
{
|
||||
return nu_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarField& Foam::solidDisplacementThermo::nu
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
|
||||
const Foam::volScalarField& Foam::solidDisplacementThermo::alphav() const
|
||||
{
|
||||
return alphav_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::scalarField& Foam::solidDisplacementThermo::alphav
|
||||
(
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return alphav_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::solidDisplacementThermo
|
||||
|
||||
Description
|
||||
Fundamental solid thermodynamic properties
|
||||
|
||||
SourceFiles
|
||||
solidDisplacementThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidDisplacementThermo_H
|
||||
#define solidDisplacementThermo_H
|
||||
|
||||
#include "constSolidThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class solidDisplacementThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class solidDisplacementThermo
|
||||
:
|
||||
public constSolidThermo
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Switch to enable plane stress
|
||||
Switch planeStress_;
|
||||
|
||||
//- Switch to enable thermal stress
|
||||
Switch thermalStress_;
|
||||
|
||||
//- Youngs modulus [Pa]
|
||||
volScalarField E_;
|
||||
|
||||
//- Poisson's ratio []
|
||||
volScalarField nu_;
|
||||
|
||||
//- Volumetric thermal expansion coefficient [1/T]
|
||||
volScalarField alphav_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("solidDisplacementThermo");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and phase name
|
||||
solidDisplacementThermo
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName = word::null
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~solidDisplacementThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Returns true to enable plane stress
|
||||
bool planeStress() const
|
||||
{
|
||||
return planeStress_;
|
||||
}
|
||||
|
||||
//- Returns true to enable thermal stress
|
||||
bool thermalStress() const
|
||||
{
|
||||
return thermalStress_;
|
||||
}
|
||||
|
||||
|
||||
// Access to thermophysical state variables
|
||||
|
||||
//- Youngs modulus [Pa]
|
||||
virtual const volScalarField& E() const;
|
||||
|
||||
//- Youngs modulus for a patch [Pa]
|
||||
virtual const scalarField& E(const label patchi) const;
|
||||
|
||||
//- Poisson's ratio []
|
||||
virtual const volScalarField& nu() const;
|
||||
|
||||
//- Poisson's ratio for a patch[]
|
||||
virtual const scalarField& nu(const label patchi) const;
|
||||
|
||||
//- Volumetric thermal expansion coefficient [1/T]
|
||||
virtual const volScalarField& alphav() const;
|
||||
|
||||
//- Volumetric thermal expansion coefficient for a patch [1/T]
|
||||
virtual const scalarField& alphav(const label patchi) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user