void StructuralEngngModel :: updateInternalState(TimeStep *stepN) { int j, nnodes; Domain *domain; for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); nnodes = domain->giveNumberOfDofManagers(); if ( requiresUnknownsDictionaryUpdate() ) { for ( j = 1; j <= nnodes; j++ ) { this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN); } } if ( internalVarUpdateStamp != stepN->giveSolutionStateCounter() ) { int nelem = domain->giveNumberOfElements(); for ( j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(stepN); } internalVarUpdateStamp = stepN->giveSolutionStateCounter(); } } }
void NonStationaryTransportProblem :: updateInternalState(TimeStep *stepN) { int j, idomain, nelem; Domain *domain; for ( idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); if ( requiresUnknownsDictionaryUpdate() ) { //update temperature vector UnknownsField->update( VM_Total, stepN, * ( this->UnknownsField->giveSolutionVector(stepN) ) ); //update Rhs vector UnknownsField->update(VM_RhsTotal, stepN, bcRhs); } if ( internalVarUpdateStamp != stepN->giveSolutionStateCounter() ) { nelem = domain->giveNumberOfElements(); for ( j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(stepN); } internalVarUpdateStamp = stepN->giveSolutionStateCounter(); } } }
void LinearStability :: terminateLinStatic(TimeStep *stepN) { Domain *domain = this->giveDomain(1); FILE *File; int j; File = this->giveOutputStream(); stepN->setTime(0.); fprintf(File, "\nOutput for time % .3e \n\n", stepN->giveTargetTime() ); fprintf(File, "Linear static:\n\n"); int nnodes = domain->giveNumberOfDofManagers(); if ( requiresUnknownsDictionaryUpdate() ) { for ( j = 1; j <= nnodes; j++ ) { this->updateDofUnknownsDictionary(domain->giveDofManager(j), stepN); } } for ( j = 1; j <= nnodes; j++ ) { domain->giveDofManager(j)->updateYourself(stepN); domain->giveDofManager(j)->printOutputAt(File, stepN); } # ifdef VERBOSE VERBOSE_PRINT0("Updated nodes & sides ", nnodes) # endif Element *elem; int nelem = domain->giveNumberOfElements(); for ( j = 1; j <= nelem; j++ ) { elem = domain->giveElement(j); elem->updateInternalState(stepN); elem->updateYourself(stepN); elem->printOutputAt(File, stepN); } # ifdef VERBOSE VERBOSE_PRINT0("Updated Elements ", nelem) # endif fprintf(File, "\n"); /* * // save context if required * // default - save only if ALWAYS is set ( see cltypes.h ) * * if ((domain->giveContextOutputMode() == COM_Always ) || * (domain->giveContextOutputMode() == COM_Required )) { * this->saveContext(NULL); * } * else if (domain->giveContextOutputMode() == COM_UserDefined ) { * if (stepN->giveNumber()%domain->giveContextOutputStep() == 0) * this->saveContext(NULL); * } */ this->printReactionForces(stepN, 1); }
void StructuralEngngModel :: updateInternalState(TimeStep *tStep) { for ( auto &domain: domainList ) { if ( requiresUnknownsDictionaryUpdate() ) { for ( auto &dman : domain->giveDofManagers() ) { this->updateDofUnknownsDictionary(dman.get(), tStep); } } for ( auto &bc : domain->giveBcs() ) { ActiveBoundaryCondition *abc; if ( ( abc = dynamic_cast< ActiveBoundaryCondition * >(bc.get()) ) ) { int ndman = abc->giveNumberOfInternalDofManagers(); for ( int j = 1; j <= ndman; j++ ) { this->updateDofUnknownsDictionary(abc->giveInternalDofManager(j), tStep); } } } if ( internalVarUpdateStamp != tStep->giveSolutionStateCounter() ) { for ( auto &elem : domain->giveElements() ) { elem->updateInternalState(tStep); } internalVarUpdateStamp = tStep->giveSolutionStateCounter(); } } }
void NLTransientTransportProblem :: createPreviousSolutionInDofUnknownsDictionary(TimeStep *tStep) { //Copy the last known temperature to be a previous solution for ( auto &domain: domainList ) { if ( requiresUnknownsDictionaryUpdate() ) { for ( auto &node : domain->giveDofManagers() ) { for ( Dof *dof: *node ) { double val = dof->giveUnknown(VM_Total, tStep); //get number on hash=0(current) dof->updateUnknownsDictionary(tStep->givePreviousStep(), VM_Total, val); } } } } }
void CBS :: updateInternalState(TimeStep *tStep) { for ( auto &domain: domainList ) { if ( requiresUnknownsDictionaryUpdate() ) { for ( auto &dman : domain->giveDofManagers() ) { this->updateDofUnknownsDictionary(dman.get(), tStep); } } for ( auto &elem : domain->giveElements() ) { elem->updateInternalState(tStep); } } }
void NLTransientTransportProblem :: updateInternalState(TimeStep *tStep) { for ( auto &domain: domainList ) { if ( requiresUnknownsDictionaryUpdate() ) { for ( auto &dman : domain->giveDofManagers() ) { //update dictionary entry or add a new pair if the position is missing this->updateDofUnknownsDictionary(dman.get(), tStep); } } for ( auto &elem : domain->giveElements() ) { elem->updateInternalState(tStep); } } }
void NonStationaryTransportProblem :: updateInternalState(TimeStep *tStep) { for ( auto &domain: domainList ) { if ( requiresUnknownsDictionaryUpdate() ) { //update temperature vector UnknownsField->update( VM_Total, tStep, * ( this->UnknownsField->giveSolutionVector(tStep) ), EModelDefaultEquationNumbering() ); //update Rhs vector UnknownsField->update(VM_RhsTotal, tStep, bcRhs, EModelDefaultEquationNumbering()); } if ( internalVarUpdateStamp != tStep->giveSolutionStateCounter() ) { for ( auto &elem : domain->giveElements() ) { elem->updateInternalState(tStep); } internalVarUpdateStamp = tStep->giveSolutionStateCounter(); } } }
void StructuralEngngModel :: updateInternalState(TimeStep *tStep) { int nnodes; Domain *domain; for ( int idomain = 1; idomain <= this->giveNumberOfDomains(); idomain++ ) { domain = this->giveDomain(idomain); nnodes = domain->giveNumberOfDofManagers(); if ( requiresUnknownsDictionaryUpdate() ) { for ( int j = 1; j <= nnodes; j++ ) { this->updateDofUnknownsDictionary(domain->giveDofManager(j), tStep); } } int nbc = domain->giveNumberOfBoundaryConditions(); for ( int i = 1; i <= nbc; ++i ) { GeneralBoundaryCondition *bc = domain->giveBc(i); ActiveBoundaryCondition *abc; if ( ( abc = dynamic_cast< ActiveBoundaryCondition * >(bc) ) ) { int ndman = abc->giveNumberOfInternalDofManagers(); for ( int j = 1; j <= ndman; j++ ) { this->updateDofUnknownsDictionary(abc->giveInternalDofManager(j), tStep); } } } if ( internalVarUpdateStamp != tStep->giveSolutionStateCounter() ) { int nelem = domain->giveNumberOfElements(); for ( int j = 1; j <= nelem; j++ ) { domain->giveElement(j)->updateInternalState(tStep); } internalVarUpdateStamp = tStep->giveSolutionStateCounter(); } } }
void SUPG :: solveYourselfAt(TimeStep *tStep) { int neq = this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering() ); FloatArray *solutionVector = NULL, *prevSolutionVector = NULL; FloatArray externalForces(neq); this->internalForces.resize(neq); if ( tStep->isTheFirstStep() ) { TimeStep *stepWhenIcApply = tStep->givePreviousStep(); if ( materialInterface ) { materialInterface->initialize(); } this->applyIC(stepWhenIcApply); //if (this->fsflag) this->updateDofManActivityMap(tStep); } if ( !requiresUnknownsDictionaryUpdate() ) { VelocityPressureField->advanceSolution(tStep); solutionVector = VelocityPressureField->giveSolutionVector(tStep); prevSolutionVector = VelocityPressureField->giveSolutionVector( tStep->givePreviousStep() ); } if ( initFlag ) { if ( !requiresUnknownsDictionaryUpdate() ) { //previousAccelerationVector.resize(neq); accelerationVector.resize(neq); solutionVector->resize(neq); prevSolutionVector->resize(neq); } incrementalSolutionVector.resize(neq); lhs.reset( classFactory.createSparseMtrx(sparseMtrxType) ); if ( !lhs ) { OOFEM_ERROR("sparse matrix creation failed"); } lhs->buildInternalStructure( this, 1, EModelDefaultEquationNumbering() ); if ( materialInterface ) { this->updateElementsForNewInterfacePosition(tStep); } initFlag = 0; } else if ( requiresUnknownsDictionaryUpdate() ) { // rebuild lhs structure and resize solution vector incrementalSolutionVector.resize(neq); lhs->buildInternalStructure( this, 1, EModelDefaultEquationNumbering() ); } if ( !requiresUnknownsDictionaryUpdate() ) { *solutionVector = *prevSolutionVector; } //previousAccelerationVector=accelerationVector; // evaluate element supg and sppg stabilization coeffs this->evaluateElementStabilizationCoeffs(tStep); // // predictor // if ( requiresUnknownsDictionaryUpdate() ) { this->updateDofUnknownsDictionary_predictor(tStep); } else { this->updateSolutionVectors_predictor(* solutionVector, accelerationVector, tStep); } if ( tStep->giveNumber() != 1 ) { if ( materialInterface ) { //if (this->fsflag) updateDofManVals(tStep); #ifdef SUPG_IMPLICIT_INTERFACE #ifdef TIME_REPORT Timer timer; timer.startTimer(); #endif materialInterface->updatePosition( this->giveCurrentStep() ); updateElementsForNewInterfacePosition(tStep); #ifdef TIME_REPORT timer.stopTimer(); OOFEM_LOG_INFO("SUPG info: user time consumed by updating interfaces: %.2fs\n", timer.getUtime(); ); #endif #else //updateElementsForNewInterfacePosition (tStep); #endif //if (this->fsflag) this->updateDofManActivityMap(tStep); } }
IRResultType SUPG :: initializeFrom(InputRecord *ir) { IRResultType result; // Required by IR_GIVE_FIELD macro result = FluidModel :: initializeFrom(ir); if ( result != IRRT_OK ) { return result; } IR_GIVE_FIELD(ir, rtolv, _IFT_SUPG_rtolv); atolv = 1.e-15; IR_GIVE_OPTIONAL_FIELD(ir, atolv, _IFT_SUPG_atolv); stopmaxiter = ir->hasField(_IFT_SUPG_stopmaxiter); maxiter = 200; IR_GIVE_OPTIONAL_FIELD(ir, maxiter, _IFT_SUPG_maxiter); int val = 0; IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_EngngModel_lstype); solverType = ( LinSystSolverType ) val; val = 0; IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_EngngModel_smtype); sparseMtrxType = ( SparseMtrxType ) val; IR_GIVE_FIELD(ir, deltaT, _IFT_SUPG_deltat); deltaTF = 0; IR_GIVE_OPTIONAL_FIELD(ir, deltaTF, _IFT_SUPG_deltatFunction); IR_GIVE_OPTIONAL_FIELD(ir, consistentMassFlag, _IFT_SUPG_cmflag); alpha = 0.5; IR_GIVE_OPTIONAL_FIELD(ir, alpha, _IFT_SUPG_alpha); val = 0; IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_SUPG_scaleflag); equationScalingFlag = val > 0; if ( equationScalingFlag ) { IR_GIVE_FIELD(ir, lscale, _IFT_SUPG_lscale); IR_GIVE_FIELD(ir, uscale, _IFT_SUPG_uscale); IR_GIVE_FIELD(ir, dscale, _IFT_SUPG_dscale); double vref = 1.0; // reference viscosity Re = dscale * uscale * lscale / vref; } else { lscale = uscale = dscale = 1.0; Re = 1.0; } if ( requiresUnknownsDictionaryUpdate() ) { VelocityPressureField.reset( new DofDistributedPrimaryField(this, 1, FT_VelocityPressure, 1) ); } else { VelocityPressureField.reset( new PrimaryField(this, 1, FT_VelocityPressure, 1) ); } val = 0; IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_SUPG_miflag); if ( val == 1 ) { this->materialInterface.reset( new LEPlic( 1, this->giveDomain(1) ) ); this->materialInterface->initializeFrom(ir); // export velocity field FieldManager *fm = this->giveContext()->giveFieldManager(); IntArray mask; mask = {V_u, V_v, V_w}; std :: shared_ptr< Field > _velocityField( new MaskedPrimaryField ( FT_Velocity, this->VelocityPressureField.get(), mask ) ); fm->registerField(_velocityField, FT_Velocity); //fsflag = 0; //IR_GIVE_OPTIONAL_FIELD (ir, fsflag, _IFT_SUPG_fsflag, "fsflag"); } else if ( val == 2 ) { // positive coefficient scheme level set alg this->materialInterface.reset( new LevelSetPCS( 1, this->giveDomain(1) ) ); this->materialInterface->initializeFrom(ir); } return IRRT_OK; }