49#define DEBUG_ERR ( 1e-6 )
54int FE2FluidMaterial :: n = 1;
56void FE2FluidMaterialStatus :: setTimeStep(
TimeStep *tStep)
67 double r_vol = val.second + eps.
at(1) + eps.
at(2) + eps.
at(3);
70 " extended macro-formulation which doesn't assume incompressibility is required");
99 return {stress_dev, r_vol};
106 if ( mode != TangentStiffness ) {
119 if ( mode != TangentStiffness ) {
131 computeDeviatoricStressVector(sig, epspvol, gp, tempStrain, 0., tStep);
133 for (
int k = 1; k <= 6; ++k ) {
136 double tmp = strain.
at(1) + strain.
at(2) + strain.
at(3);
137 strain.
at(1) -= tmp/3.0;
138 strain.
at(2) -= tmp/3.0;
139 strain.
at(3) -= tmp/3.0;
141 computeDeviatoricStressVector(sigPert, epspvol, gp, strain, 0., tStep);
146 numericalATS.
times(1. / h);
148 printf(
"Analytical deviatoric tangent = ");
149 dsdd.printYourself();
150 printf(
"Numerical deviatoric tangent = ");
163 double epspvol, pressure = 0.0;
165 computeDeviatoricStressVector(sig, epspvol, gp, strain, pressure, tStep);
166 computeDeviatoricStressVector(sigh, epspvol, gp, strain, pressure + h, tStep);
172 printf(
"Analytical deviatoric pressure tangent = ");
173 dsdp.printYourself();
174 printf(
"Numerical deviatoric pressure tangent = ");
179 OOFEM_ERROR(
"Error in deviatoric pressure tangent");
187 double epspvol, epspvol11, epspvol22, epspvol12, pressure = 0.0;
190 computeDeviatoricStressVector(sig, epspvol, gp, tempStrain, pressure, tStep);
193 computeDeviatoricStressVector(sig, epspvol11, gp, strain, pressure, tStep);
196 computeDeviatoricStressVector(sig, epspvol22, gp, strain, pressure, tStep);
199 computeDeviatoricStressVector(sig, epspvol12, gp, strain, pressure, tStep);
202 dvol.
at(1) = ( epspvol11 - epspvol ) / h;
203 dvol.
at(2) = ( epspvol22 - epspvol ) / h;
204 dvol.
at(3) = ( epspvol12 - epspvol ) / h;
208 printf(
"Analytical volumetric deviatoric tangent = ");
209 dedd.printYourself();
210 printf(
"Numerical volumetric deviatoric tangent = ");
215 OOFEM_ERROR(
"Error in volumetric deviatoric tangent");
223 double epspvol, epspvolh, pressure = 0.0;
226 computeDeviatoricStressVector(sig, epspvol, gp, strain, pressure, tStep);
227 computeDeviatoricStressVector(sig, epspvolh, gp, strain, pressure + h, tStep);
229 double dvol = -( epspvolh - epspvol ) / h;
231 printf(
"Analytical volumetric pressure tangent = %e\n", dedp);
232 printf(
"Numerical volumetric pressure tangent = %e\n", dvol);
234 double norm = fabs(dvol - dedp);
236 OOFEM_ERROR(
"Error in volumetric pressure tangent");
249 FluidDynamicMaterial :: initializeFrom(ir);
255 FluidDynamicMaterial :: giveInputRecord(input);
263 if ( type == IST_VOFFraction ) {
266 }
else if ( type == IST_Pressure ) {
269 }
else if ( type == IST_Undefined ) {
275 double epspvol, epspvolh, pressure = 0.0;
278 computeDeviatoricStressVector(sig, epspvol, gp, strain, pressure, tStep);
279 computeDeviatoricStressVector(sig, epspvolh, gp, strain, pressure + h, tStep);
281 double dvol = - ( epspvolh - epspvol ) / h;
285 printf(
"Numerical volumetric pressure tangent = %f\n", dvol);
289 OOFEM_ERROR(
"Error in volumetric pressure tangent");
295 return FluidDynamicMaterial :: giveIPValue(answer, gp, type, tStep);
300std::unique_ptr<MaterialStatus> FE2FluidMaterial :: CreateStatus(
GaussPoint *gp)
const
303 if ( this->
domain->giveEngngModel()->isParallel() && this->domain->giveEngngModel()->giveNumberOfProcesses() > 1 ) {
304 rank = this->
domain->giveEngngModel()->giveRank();
306 return std::make_unique<FE2FluidMaterialStatus>(
n++, rank, gp, this->
inputfile);
309int FE2FluidMaterial :: checkConsistency()
314FE2FluidMaterialStatus :: FE2FluidMaterialStatus(
int n,
int rank,
GaussPoint *
gp,
const std :: string &inputfile) :
325bool FE2FluidMaterialStatus :: createRVE(
int n,
int rank,
GaussPoint *
gp,
const std :: string &inputfile)
331 this->
rve->checkProblemConsistency();
332 this->
rve->initMetaStepAttributes( this->
rve->giveMetaStep(1) );
333 this->
rve->giveNextStep();
336 std :: ostringstream name;
337 name << this->
rve->giveOutputBaseFileName() <<
"-gp" << n;
342 this->
rve->letOutputBaseFileNameBe( name.str() );
346 OOFEM_ERROR(
"RVE doesn't have necessary boundary condition; should have MixedGradientPressure as first b.c. (in first domain)");
352void FE2FluidMaterialStatus :: printOutputAt(FILE *file,
TimeStep *tStep)
const
354 FluidDynamicMaterialStatus :: printOutputAt(file, tStep);
357void FE2FluidMaterialStatus :: updateYourself(
TimeStep *tStep)
359 double fluid_area = this->
rve->giveDomain(1)->giveSize();
360 double total_area = this->
bc->domainSize();
362 FluidDynamicMaterialStatus :: updateYourself(tStep);
364 this->
rve->updateYourself(tStep);
365 this->
rve->terminate(tStep);
368void FE2FluidMaterialStatus :: initTempStatus()
370 FluidDynamicMaterialStatus :: initTempStatus();
375 FluidDynamicMaterialStatus :: saveContext(stream, mode);
376 this->
rve->saveContext(stream, mode);
381 FluidDynamicMaterialStatus :: restoreContext(stream, mode);
383 this->
rve->restoreContext(stream, mode);
386void FE2FluidMaterialStatus :: markOldTangents() { this->
oldTangents =
true; }
388void FE2FluidMaterialStatus :: computeTangents(
TimeStep *tStep)
413 v = ( t.at(1, 1) * 2. - t.at(1, 2) - t.at(1, 3) ) / 3. +
414 ( -t.at(2, 1) + t.at(2, 2) * 2. - t.at(2, 3) ) / 3. +
415 ( -t.at(3, 1) - t.at(3, 2) + t.at(3, 3) * 2. ) / 3. +
416 4. * ( t.at(4, 4) + t.at(5, 5) + t.at(6, 6) );
419 v = ( t.at(1, 1) * 2. - t.at(1, 2) ) / 3. +
420 ( -t.at(2, 1) + t.at(2, 2) * 2. ) / 3. +
#define REGISTER_Material(class)
virtual TimeStep * giveCurrentStep(bool force=false)
virtual void solveYourselfAt(TimeStep *tStep)
FloatMatrix & giveDeviatoricTangent()
void computeTangents(TimeStep *tStep)
std ::unique_ptr< EngngModel > rve
The subscale flow.
void letPressureBe(double val)
FloatArray & giveVolumetricDeviatoricTangent()
MixedGradientPressureBC * giveBC()
MixedGradientPressureBC * bc
Boundary condition in RVE that performs the computational homogenization.
void setTimeStep(TimeStep *tStep)
Copies time step data to RVE.
FloatArray & giveDeviatoricPressureTangent()
bool createRVE(int n, int rank, GaussPoint *gp, const std ::string &inputfile)
Creates/Initiates the RVE problem.
double & giveVolumetricPressureTangent()
std::pair< FloatArrayF< 6 >, double > computeDeviatoricStress3D(const FloatArrayF< 6 > &eps, double pressure, GaussPoint *gp, TimeStep *tStep) const override
Domain * domain
Link to domain object, useful for communicating with other FEM components.
double & at(std::size_t i)
double computeNorm() const
virtual void printYourself() const
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
void zero()
Zeroes all coefficients of receiver.
void subtract(const FloatArray &src)
void setColumn(const FloatArray &src, int c)
*Prints matrix to stdout Useful for debugging void printYourself() const
double computeFrobeniusNorm() const
void subtract(const FloatMatrix &a)
FluidDynamicMaterialStatus(GaussPoint *g)
Constructor - creates new TransportMaterialStatus with number n, belonging to domain d and integratio...
void letDeviatoricStrainRateVectorBe(const FloatArrayF< 6 > &v)
void letDeviatoricStressVectorBe(const FloatArrayF< 6 > &v)
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
GaussPoint * gp
Associated integration point.
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
virtual void setPrescribedDeviatoricGradientFromVoigt(const FloatArray &ddev)=0
virtual void computeFields(FloatArray &stressDev, double &vol, TimeStep *tStep)=0
virtual void setPrescribedPressure(double p)=0
double giveTimeIncrement()
Returns solution step associated time increment.
void setNumber(int i)
Set receiver's number.
double giveTargetTime()
Returns target time.
void setTimeIncrement(double newDt)
Sets solution step time increment.
int giveNumber()
Returns receiver's number.
bool isTheCurrentTimeStep()
void setTime(double newt)
Sets target and intrinsic time to be equal.
#define _IFT_FE2FluidMaterial_fileName
double norm(const FloatArray &x)
std::unique_ptr< EngngModel > InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)