60void NumberOfNodalPrescribedTractionPressureAssembler :: vectorFromElement(
FloatArray &vec,
Element &element,
TimeStep *tStep, ValueModeType mode)
const
62 static_cast< CBSElement &
>( element ).computeNumberOfNodalPrescribedTractionPressureContributions(vec, tStep);
65void IntermediateConvectionDiffusionAssembler :: vectorFromElement(
FloatArray &vec,
Element &element,
TimeStep *tStep, ValueModeType mode)
const
68 static_cast< CBSElement &
>( element ).computeConvectionTermsI(vec, tStep);
69 static_cast< CBSElement &
>( element ).computeDiffusionTermsI(vec_p, tStep);
73void PrescribedVelocityRhsAssembler :: vectorFromElement(
FloatArray &vec,
Element &element,
TimeStep *tStep, ValueModeType mode)
const
75 static_cast< CBSElement &
>( element ).computePrescribedTermsI(vec, tStep);
78void DensityPrescribedTractionPressureAssembler :: vectorFromElement(
FloatArray &vec,
Element &element,
TimeStep *tStep, ValueModeType mode)
const
80 static_cast< CBSElement &
>( element ).computePrescribedTractionPressure(vec, tStep);
86 static_cast< CBSElement &
>( element ).computeDensityRhsVelocityTerms(vec, tStep);
87 static_cast< CBSElement &
>( element ).computeDensityRhsPressureTerms(vec_p, tStep);
93 static_cast< CBSElement &
>( element ).computeCorrectionRhs(vec, tStep);
98 static_cast< CBSElement &
>( element ).computePressureLhs(answer, tStep);
137 EngngModel :: initializeFrom(ir);
179 std::shared_ptr<Field> _velocityField = std::make_shared<MaskedPrimaryField>(FT_Velocity, &this->
velocityField, mask);
198CBS :: giveReynoldsNumber()
204double CBS :: giveTheta1() {
return this->
theta1; }
206double CBS :: giveTheta2() {
return this->
theta2; }
209CBS :: giveTractionPressure(
Dof *dof)
216 OOFEM_ERROR(
"prescribed traction pressure requested for dof with no BC");
224CBS :: giveSolutionStepWhenIcApply(
bool force)
226 if (
master && (!force)) {
227 return master->giveSolutionStepWhenIcApply();
289 lhs->buildInternalStructure(
this, 1,
pnum);
301 mss->buildInternalStructure(
this, 1,
vnum);
342 this->
applyIC(_stepWhenIcApply);
373 for (
int i = 1; i <= momneq; i++ ) {
384 for (
int i = 1; i <= presneq_prescribed; i++ ) {
389 velocityVector = prevVelocityVector;
400 pressureVector.
add(prevPressureVector);
413 velocityVector.
add(prevVelocityVector);
415 for (
int i = 1; i <= momneq; i++ ) {
443CBS :: giveUnknownDictHashIndx(ValueModeType mode,
TimeStep *tStep)
452 EngngModel :: updateYourself(tStep);
467 for (
auto &elem : domain->giveElements() ) {
468 elem->updateInternalState(tStep);
477 EngngModel :: saveContext(stream, mode);
489 EngngModel :: restoreContext(stream, mode);
499CBS :: checkConsistency()
507 if ( !
dynamic_cast< CBSElement *
>( elem.get() ) ) {
508 OOFEM_WARNING(
"Element %d has no CBS base", elem->giveLabel());
513 EngngModel :: checkConsistency();
518 for (
auto &bc: domain->
giveBcs() ) {
531 for (
auto &ic : domain->
giveIcs() ) {
533 ic->scale(VM_Total, 1. /
uscale);
548CBS :: updateDomainLinks()
550 EngngModel :: updateDomainLinks();
561 if ( type == V_u || type == V_v || type == V_w ) {
563 }
else if ( type == P_f ) {
581 for (
auto &elem : this->
giveDomain(1)->giveElements() ) {
592 if (
id == V_u ||
id == V_v ||
id == V_w ) {
593 return this->
vnum.askNewEquationNumber();
594 }
else if (
id == P_f ) {
595 return this->
pnum.askNewEquationNumber();
605CBS :: giveNewPrescribedEquationNumber(
int domain,
DofIDItem id)
607 if (
id == V_u ||
id == V_v ||
id == V_w ) {
609 }
else if (
id == P_f ) {
653void CBS :: printOutputAt(FILE *file,
TimeStep *tStep)
657 for (
auto &domain: this->domainList ) {
658 domCount += domain->giveOutputManager()->testTimeStepOutput(tStep);
661 if ( domCount == 0 ) {
665 fprintf( File,
"\nOutput for time % .8e \n\n", tStep->giveTime() / this->giveVariableScale(
VST_Time) );
666 for (
auto &domain: this->domainList ) {
667 fprintf(file,
"\nOutput for domain %3d\n", domain->giveNumber() );
668 domain->giveOutputManager()->doDofManOutput(file, tStep);
669 domain->giveOutputManager()->doElementOutput(file, tStep);
#define _IFT_CBS_scaleflag
#define _IFT_CBS_mindeltat
#define REGISTER_EngngModel(class)
virtual double computeCriticalTimeStep(TimeStep *tStep)=0
Calculates critical time step.
void updateInternalState(TimeStep *tStep) override
FloatArray nodalPrescribedTractionPressureConnectivity
PressureEquationNumbering pnum
LinSystSolverType solverType
double dscale
Density scale.
NumericalMethod * giveNumericalMethod(MetaStep *mStep) override
Returns reference to receiver's numerical method.
std ::unique_ptr< MaterialInterface > materialInterface
VelocityEquationNumbering vnumPrescribed
TimeStep * giveSolutionStepWhenIcApply(bool force=false) override
int consistentMassFlag
Consistent mass flag.
int giveNumberOfDomainEquations(int, const UnknownNumberingScheme &num) override
void applyIC(TimeStep *tStep)
std ::unique_ptr< SparseMtrx > mss
Sparse consistent mass.
FloatArray prescribedTractionPressure
double lscale
Length scale.
std ::unique_ptr< SparseLinearSystemNM > nMethod
Numerical method used to solve the problem.
DofDistributedPrimaryField pressureField
Pressure field.
SparseMtrxType sparseMtrxType
double Re
Reynolds number.
double deltaT
Time step and its minimal value.
VelocityEquationNumbering vnum
FloatArray deltaAuxVelocity
FloatArray mm
Lumped mass matrix.
DofDistributedPrimaryField velocityField
Velocity field.
double uscale
Velocity scale.
double giveVariableScale(VarScaleType varId) override
Returns the scale factor for given variable type.
double theta1
Integration constants.
PressureEquationNumbering pnumPrescribed
void updateInternalState(TimeStep *tStep)
std ::unique_ptr< SparseMtrx > lhs
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Implementation for assembling external forces vectors in standard monolithic FE-problems.
DofIDItem giveDofID() const
virtual int __givePrescribedEquationNumber()=0
virtual void printSingleOutputAt(FILE *file, TimeStep *tStep, char ch, ValueModeType mode, double scale=1.0)
std ::vector< std ::unique_ptr< GeneralBoundaryCondition > > & giveBcs()
std ::vector< std ::unique_ptr< Element > > & giveElements()
std ::vector< std ::unique_ptr< InitialCondition > > & giveIcs()
virtual void updateYourself(TimeStep *tStep)
void giveLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s, IntArray *dofIds=NULL) const
int giveNumberOfTimeStepWhenIcApply()
Returns the time step number, when initial conditions should apply.
std ::vector< std ::unique_ptr< Domain > > domainList
List of problem domains.
virtual TimeStep * giveCurrentStep(bool force=false)
void assembleVectorFromElements(FloatArray &answer, TimeStep *tStep, const VectorAssembler &va, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms=NULL)
EngngModelContext * giveContext()
Context requesting service.
std ::unique_ptr< TimeStep > previousStep
Previous time step.
int equationNumberingCompleted
Equation numbering completed flag.
MetaStep * giveCurrentMetaStep()
Returns current meta step.
int ndomains
Number of receiver domains.
Domain * giveDomain(int n)
std ::unique_ptr< TimeStep > currentStep
Current time step.
EngngModel * master
Master e-model; if defined receiver is in maintained (slave) mode.
std ::unique_ptr< TimeStep > stepWhenIcApply
Solution step when IC (initial conditions) apply.
void registerField(FieldPtr eField, FieldType key)
void zero()
Zeroes all coefficients of receiver.
void add(const FloatArray &src)
int forceEquationNumbering(int id) override
FluidModel(int i, EngngModel *master)
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Implementation for assembling external forces vectors in standard monolithic FE-problems.
Callback class for assembling CBS pressure matrices.
void incrementStateCounter()
Updates solution state counter.
double giveTimeIncrement()
Returns solution step associated time increment.
int giveNumber()
Returns receiver's number.
TimeStep * givePreviousStep()
Returns pointer to previous solution step.
double getUtime()
Returns total user time elapsed in seconds.
virtual int giveRequiredNumberOfDomainEquation() const
#define _IFT_EngngModel_lstype
#define _IFT_EngngModel_smtype
#define OOFEM_WARNING(...)
#define OOFEM_LOG_INFO(...)
FloatArrayF< N > min(const FloatArrayF< N > &a, const FloatArrayF< N > &b)
VarScaleType
Type determining the scale corresponding to particular variable.
FloatArrayF< N > assemble(const FloatArrayF< M > &x, int const (&c)[M])
Assemble components into zero matrix.
FloatArrayF< N > max(const FloatArrayF< N > &a, const FloatArrayF< N > &b)
ClassFactory & classFactory