63int StructuralFE2Material :: n = 1;
72 StructuralMaterial :: initializeFrom(ir);
82 StructuralMaterial :: giveInputRecord(input);
91std::unique_ptr<MaterialStatus>
92StructuralFE2Material :: CreateStatus(
GaussPoint *gp)
const
95 auto emodel = this->
domain->giveEngngModel();
96 if ( emodel->isParallel() && emodel->giveNumberOfProcesses() > 1 ) {
97 rank = emodel->giveRank();
99 return std::make_unique<StructuralFE2MaterialStatus>(rank, gp, this->
inputfile);
115 ms->setTimeStep(tStep);
117 ms->giveBC()->setPrescribedGradientVoigt(strain);
119 ms->giveRVE()->solveYourselfAt(tStep);
122 ms->giveBC()->computeField(stress, tStep);
127 }
else if ( stress.
giveSize() == 9 ) {
128 answer = {stress[0], stress[1], stress[2], 0.5*(stress[3]+stress[6]), 0.5*(stress[4]+stress[7]), 0.5*(stress[5]+stress[8])};
129 }
else if ( stress.
giveSize() == 4 ) {
133 answer = {stress[0], stress[1], 0., 0., 0., 0.5*(stress[2]+stress[3])};
135 answer = {stress[0], 0., 0., 0., 0., 0.};
139 ms->letTempStressVectorBe(answer);
140 ms->letTempStrainVectorBe(strain);
141 ms->markOldTangent();
147StructuralFE2Material :: give3dMaterialStiffnessMatrix(MatResponseMode mode,
GaussPoint *gp,
TimeStep *tStep)
const
158 for(
int i = 0; i < 6; i++) {
164 answer.
setColumn((sigPert - sig) / h, i);
170 status->computeTangent(tStep);
171 const auto &ans9 = status->giveTangent();
210 FloatArray tempStrain = ms->giveTempStrainVector();
215 for (
int k = 1; k <= 6; ++k ) {
222 numericalATS.
times(1. / hh);
238StructuralFE2Material :: givePlaneStrainStiffMtrx(MatResponseMode mode,
GaussPoint *gp,
TimeStep *tStep)
const
246 auto eps =
FloatArrayF<6>(status->giveTempStrainVector())[{0, 1, 2, 5}];
247 auto sig =
FloatArrayF<6>(status->giveTempStressVector())[{0, 1, 2, 5}];
251 for(
int i = 0; i < 4; i++) {
257 answer.
setColumn((sigPert - sig) / h, i);
263 status->computeTangent(tStep);
264 return status->giveTangent();
275 ms->giveBC()->setPrescribedGradientVoigt(strain);
277 ms->giveRVE()->solveYourselfAt(tStep);
280 ms->giveBC()->computeField(stress, tStep);
283 updateStress = {stress[0], stress[1], 0., 0., 0., 0.5*(stress[2]+stress[3])};
286 updateStrain = {strain[0], strain[1], 0., 0., 0., strain[2]};
289 answer = {stress[0], stress[1], 0.5*(stress[2]+stress[3])};
292 ms->letTempStressVectorBe(updateStress);
293 ms->letTempStrainVectorBe(updateStrain);
294 ms->markOldTangent();
315 for (
int i=0; i < 3; i++) {
317 auto epsPert = epsRed;
321 answer.
setColumn((sigPert - sigRed) / h, i);
328 status->computeTangent(tStep);
329 tangent.
beSubMatrixOf(status->giveTangent(), {1,2,3}, {1,2,3});
341StructuralFE2MaterialStatus :: StructuralFE2MaterialStatus(
int rank,
GaussPoint * g,
const std :: string & inputfile) :
345 if ( !this->
createRVE(1, inputfile, rank) ) {
362StructuralFE2MaterialStatus :: createRVE(
int n,
const std :: string &inputfile,
int rank)
368 this->
rve->checkProblemConsistency();
369 this->
rve->initMetaStepAttributes( this->
rve->giveMetaStep(1) );
370 this->
rve->giveNextStep();
373 std :: ostringstream name;
374 name << this->
rve->giveOutputBaseFileName() <<
"-gp" << n;
379 this->
rve->letOutputBaseFileNameBe( name.str() );
383 OOFEM_ERROR(
"RVE doesn't have necessary boundary condition; should have a type of PrescribedGradientHomogenization as first b.c.");
390StructuralFE2MaterialStatus :: setTimeStep(
TimeStep *tStep)
399StructuralFE2MaterialStatus :: initTempStatus()
401 StructuralMaterialStatus :: initTempStatus();
405StructuralFE2MaterialStatus :: markOldTangent() { this->
oldTangent =
true; }
408StructuralFE2MaterialStatus :: computeTangent(
TimeStep *tStep)
422StructuralFE2MaterialStatus :: updateYourself(
TimeStep *tStep)
424 StructuralMaterialStatus :: updateYourself(tStep);
425 this->
rve->updateYourself(tStep);
426 this->
rve->terminate(tStep);
435 StructuralMaterialStatus :: saveContext(stream, mode);
436 this->
rve->saveContext(stream, mode);
443 StructuralMaterialStatus :: restoreContext(stream, mode);
444 this->
rve->restoreContext(stream, mode);
447double StructuralFE2MaterialStatus :: giveRveLength()
449 return sqrt(
bc->domainSize() );
452void StructuralFE2MaterialStatus :: copyStateVariables(
const MaterialStatus &iStatus)
464 StructuralMaterialStatus :: copyStateVariables(iStatus);
471 OOFEM_ERROR(
"Failed to cast StructuralFE2MaterialStatus.")
489 if ( ext_xMan != NULL ) {
491 std::vector<std::unique_ptr<EnrichmentItem>> eiList;
499 for (
int i = 1; i <= nEI; i++ ) {
504 auto &mir = dataReader.
giveInputRecord(DataReader :: IR_enrichItemRec, i);
508 std :: unique_ptr< EnrichmentItem >ei(
classFactory.createEnrichmentItem( name.c_str(), i, this_xMan, rve_domain ) );
509 if ( ei.get() == NULL ) {
510 OOFEM_ERROR(
"unknown enrichment item (%s)", name.c_str() );
513 ei->initializeFrom(mir);
514 ei->instanciateYourself(dataReader);
515 eiList.push_back( std :: move(ei) );
523 rve->forceEquationNumbering();
533 bool deallocateOld =
true;
534 rve->setDomain(1, newDomain, deallocateOld);
537 rve->giveNumericalMethod(NULL)->setDomain(newDomain);
539 rve->postInitialize();
542 rve->initMetaStepAttributes(
rve->giveMetaStep(1) );
552 double crackLength = 0.0;
558 std :: ostringstream name;
559 name << this->
rve->giveOutputBaseFileName() <<
"-gp" << num <<
"crackLength" << crackLength;
560 if ( this->domain->giveEngngModel()->isParallel() && this->domain->giveEngngModel()->giveNumberOfProcesses() > 1 ) {
561 name <<
"." << this->domain->giveEngngModel()->giveRank();
566 this->
rve->letOutputBaseFileNameBe( name.str() );
576 if ( xfemSolInt && statStruct ) {
582 int numDofsNew =
rve->giveNumberOfDomainEquations( 1, num );
587 xfemSolInt->xfemUpdatePrimaryField(*statStruct, tStep, u);
590 rve->giveNumericalMethod(NULL)->setDomain(newDomain);
600 int numExpModules =
rve->giveExportModuleManager()->giveNumberOfModules();
601 for (
int i = 1; i <= numExpModules; i++ ) {
604 if ( vtkxmlMod != NULL ) {
#define REGISTER_Material(class)
void SetEngngModel(EngngModel *ipEngngModel)
XfemManager * giveXfemManager()
InputRecord & giveInputRecord(InputRecordType, int recordId) override
Domain * giveDomain(int n)
virtual void appendInputRecords(DynamicDataReader &oDR)=0
Domain * giveDomain() const
Domain * domain
Link to domain object, useful for communicating with other FEM components.
Index giveSize() const
Returns the size of receiver.
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
void zero()
Zeroes all coefficients of receiver.
void setColumn(const FloatArrayF< N > &src, std::size_t c)
void beSubMatrixOf(const FloatMatrix &src, Index topRow, Index bottomRow, Index topCol, Index bottomCol)
void setColumn(const FloatArray &src, int c)
double computeFrobeniusNorm() const
void subtract(const FloatMatrix &a)
virtual MaterialStatus * giveStatus(GaussPoint *gp) const
void setDomain(Domain *ipDomain)
EngngModel * giveRVE() const
PrescribedGradientHomogenization * giveBC()
void setTimeStep(TimeStep *tStep)
Copies time step data to RVE.
StructuralFE2MaterialStatus(int rank, GaussPoint *g, const std ::string &inputfile)
bool createRVE(int n, const std ::string &inputfile, int rank)
Creates/Initiates the RVE problem.
PrescribedGradientHomogenization * bc
Boundary condition in RVE that performs the computational homogenization.
FloatMatrix & giveTangent()
std ::unique_ptr< EngngModel > rve
The RVE.
FloatArrayF< 6 > giveRealStressVector_3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) const override
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
FloatMatrixF< 3, 3 > givePlaneStressStiffMtrx(MatResponseMode mmode, GaussPoint *gp, TimeStep *tStep) const override
StructuralFE2Material(int n, Domain *d)
FloatArrayF< 3 > giveRealStressVector_PlaneStress(const FloatArrayF< 3 > &strain, GaussPoint *gp, TimeStep *tStep) const override
Default implementation relies on giveRealStressVector_StressControl.
StructuralMaterialStatus(GaussPoint *g)
Constructor. Creates new StructuralMaterialStatus with IntegrationPoint g.
FloatArray tempStrainVector
Temporary strain vector in reduced form (to find balanced state).
FloatArray tempStressVector
Temporary stress vector in reduced form (increments are used mainly in nonlinear analysis).
FloatArray stressVector
Equilibrated stress vector in reduced form.
FloatArray strainVector
Equilibrated strain vector in reduced form.
StructuralMaterial(int n, Domain *d)
virtual FloatArrayF< 4 > giveRealStressVector_PlaneStrain(const FloatArrayF< 4 > &strain, GaussPoint *gp, TimeStep *tStep) const
Default implementation relies on giveRealStressVector_3d.
static void giveReducedSymMatrixForm(FloatMatrix &answer, const FloatMatrix &full, MaterialMode matMode)
Converts the full unsymmetric Voigt matrix (4th order tensor) to reduced form.
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.
NodalRecoveryModel * givePrimVarSmoother()
Returns the smoother for primary variables (nodal averaging).
NodalRecoveryModel * giveSmoother()
Returns the internal smoother.
void clearEnrichmentItems()
Remove all enrichment items.
void appendEnrichmentItems(std ::vector< std ::unique_ptr< EnrichmentItem > > &iEIlist)
EnrichmentItem * giveEnrichmentItem(int n)
int giveNumberOfEnrichmentItems() const
double computeTotalCrackLength()
Compute the total length of all cracks in the domain.
double norm(const FloatArray &x)
std::unique_ptr< EngngModel > InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
ClassFactory & classFactory
#define _IFT_StructuralFE2Material_fileName
#define _IFT_StructuralFE2Material_useNumericalTangent