コード例 #1
0
// ===================================================
// Conversion Methods
// ===================================================
void
OneDFSIPhysicsLinear::fromUToW ( Real& W1, Real& W2, const Real& U1, const Real& U2, const UInt& iNode ) const
{
    W1 = U2 + celerity0 ( iNode ) * ( U1 - M_dataPtr->area0 ( iNode ) );

    W2 = U2 - celerity0 ( iNode ) * ( U1 - M_dataPtr->area0 ( iNode ) );

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 6320 ) << "[OneDFSIModel_Physics_Linear::fromUToW] Q " << U2 << "\n";
    debugStream ( 6320 ) << "[OneDFSIModel_Physics_Linear::fromUToW] W1 " << W1 << "\n";
    debugStream ( 6320 ) << "[OneDFSIModel_Physics_Linear::fromUToW] W2 " << W2 << "\n";
    debugStream ( 6320 ) << "[OneDFSIModel_Physics_Linear::fromUToW] celerity " << celerity0 ( iNode ) << "\n";
    debugStream ( 6320 ) << "[OneDFSIModel_Physics_Linear::fromUToW] ( _U1 - area0( iNode ) ) " << ( U1 - M_dataPtr->area0 ( iNode ) ) << "\n";
#endif
}
コード例 #2
0
ファイル: FSISolver.cpp プロジェクト: nuraiman/lifev
void
FSISolver::iterate()
{
    debugStream( 6220 ) << "============================================================\n";
    debugStream( 6220 ) << "Solving FSI at time " << M_data->dataFluid()->dataTime()->time() << " with FSI: " << M_data->method()  << "\n";
    debugStream( 6220 ) << "============================================================\n";

    // Update the system
    M_oper->updateSystem( );

    // We extract a copy to the solution (\todo{uselessly})
    vectorPtr_Type lambda(new vector_Type(M_oper->solution()));
    //M_oper->solutionPtr(lambda);//copy of a shared_ptr

    // the newton solver
    UInt maxiter = M_data->maxSubIterationNumber();
    UInt status = NonLinearRichardson( *lambda,
                                       *M_oper,
                                       M_data->absoluteTolerance(),
                                       M_data->relativeTolerance(),
                                       maxiter,
                                       M_data->errorTolerance(),
                                       M_data->NonLinearLineSearch(),
                                       M_out_res,
                                       M_data->dataFluid()->dataTime()->time() );

    // We update the solution
    M_oper->updateSolution( *lambda );

    if (status == EXIT_FAILURE)
    {
        std::ostringstream __ex;
        __ex << "FSISolver::iterate ( " << M_data->dataFluid()->dataTime()->time() << " ) Inners iterations failed to converge\n";
        throw std::logic_error( __ex.str() );
    }
    else
    {
        //M_oper->displayer().leaderPrint("FSI-  Number of inner iterations:              ", maxiter, "\n" );
        if (M_epetraWorldComm->MyPID() == 0)
        {
            M_out_iter << M_data->dataFluid()->dataTime()->time() << " " << maxiter;
        }
    }

    debugStream( 6220 ) << "FSISolver iteration at time " << M_data->dataFluid()->dataTime()->time() << " done\n";
    debugStream( 6220 ) << "============================================================\n";
    std::cout << std::flush;
}
コード例 #3
0
void
MultiscaleModelFSI1D::buildModel()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::buildModel() \n";
#endif

    // Display data
    //    if ( M_comm->MyPID() == 0 )
    //        M_data->showMe();

    M_solver->buildConstantMatrices();

    // Update previous solution
    copySolution ( *M_solution, *M_solution_tn );

#ifdef JACOBIAN_WITH_FINITEDIFFERENCE
    if ( M_couplings.size() > 0 )
    {
        updateLinearModel();
    }
#endif

}
コード例 #4
0
void
MultiscaleModelFSI1D::saveSolution()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::saveSolution() \n";
#endif

    // Update exporter solution removing ghost nodes
    copySolution ( *M_solution, *M_exporterSolution );

#ifdef HAVE_HDF5
    M_exporter->postProcess ( M_data->dataTime()->time() );

    if ( M_data->dataTime()->isLastTimeStep() )
    {
        M_exporter->closeFile();
    }
#endif

#ifdef HAVE_MATLAB_POSTPROCESSING
    //Matlab post-processing
    M_solver->postProcess ( *M_exporterSolution, M_data->dataTime()->time() );
#endif

}
コード例 #5
0
ファイル: boundaryConditions.hpp プロジェクト: chknipp/lifev
FSIOperator::fluidBchandlerPtr_Type BCh_monolithicFluid (FSIOperator& _oper, bool const& isOpen = true)
{
    // Boundary conditions for the fluid velocity
    debugStream ( 10000 ) << "Boundary condition for the fluid\n";

    if (! _oper.isFluid() )
    {
        return FSIOperator::fluidBchandlerPtr_Type();
    }

    FSIOperator::fluidBchandlerPtr_Type BCh_fluid ( new FSIOperator::fluidBchandler_Type );

    BCFunctionBase bcf      (fZero);
    BCFunctionBase in_flow  (/*uInterpolated*/u2normal/*aortaPhisPress*/);
    //    BCFunctionBase out_flow (fZero);
    //BCFunctionBase in_flow  (LumpedHeart::outPressure);

    BCFunctionBase out_press (FlowConditions::outPressure0);
    BCFunctionBase bcfw0 (w0);

    // if(!isOpen)
    //   BCh_fluid->addBC("InFlow" , INLET,  Natural, Full, bcf,3);


    BCh_fluid->addBC ("OutFlow", OUTLET,  Natural,  Normal, out_press);
    //BCh_fluid->addBC("OutFlow", INOUTEDGE,  EssentialEdges,  Full, bcf,3);

    return BCh_fluid;
}
コード例 #6
0
ファイル: Parser.cpp プロジェクト: Danniel-UCAS/lifev
// ===================================================
// Methods
// ===================================================
const Real&
Parser::evaluate ( const ID& id )
{
    if ( M_evaluate )
    {
        M_results.clear();
        stringIterator_Type start, end;

        for ( UInt i (0); i < M_strings.size(); ++i )
        {
            start = M_strings[i].begin();
            end   = M_strings[i].end();
#ifdef HAVE_BOOST_SPIRIT_QI
#ifdef ENABLE_SPIRIT_PARSER
            qi::phrase_parse ( start, end, M_calculator, ascii::space, M_results );
#else
            std::cerr << "!!! ERROR: The Boost Spirit parser has been disabled !!!" << std::endl;
            std::exit ( EXIT_FAILURE );
#endif /* ENABLE_SPIRIT_PARSER */
#else
            std::cerr << "!!! ERROR: Boost version < 1.41 !!!" << std::endl;
            std::exit ( EXIT_FAILURE );
#endif
        }
        M_evaluate = false;
    }

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 5030 ) << "Parser::evaluate          results[ " << id << "]: " << M_results[id] << "\n";
#endif

    return M_results[id];
}
コード例 #7
0
void
MultiscaleModelFSI1D::setupLinearModel()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::setupLinearModel( ) \n";
#endif

    // Define bcFunction for linear problem
    M_bcBaseDelta.setFunction ( boost::bind ( &MultiscaleModelFSI1D::bcFunctionDelta, this, _1 ) );

    // The linear BCHandler is a copy of the original BCHandler with the LinearSolution instead of the true solution
    //M_LinearBC.reset( new bc_Type( *M_bc->handler() ) ); // COPY CONSTRUCTOR NOT WORKING

    //Set left and right BC + default BC
    M_linearBC->setBC ( OneDFSI::left, OneDFSI::first, M_bc->handler()->bc ( OneDFSI::left )->type ( OneDFSI::first ),
                        M_bc->handler()->bc ( OneDFSI::left )->bcFunction ( OneDFSI::first ) );

    M_linearBC->setBC ( OneDFSI::right, OneDFSI::first, M_bc->handler()->bc ( OneDFSI::right )->type ( OneDFSI::first ),
                        M_bc->handler()->bc ( OneDFSI::right )->bcFunction ( OneDFSI::first ) );

    M_linearBC->setDefaultBC();

    // Solution for the linear problem (this does not change anything in the solver)
    M_solver->setupSolution ( *M_linearSolution );
    M_linearBC->setSolution ( M_linearSolution );
    M_linearBC->setFluxSource ( M_flux, M_source );
}
コード例 #8
0
void
MultiscaleModelMultiscale::updateModel()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8110 ) << "MultiscaleModelMultiscale::updateModel() \n";
#endif

    for ( multiscaleModelsContainerConstIterator_Type i = M_modelsList.begin(); i != M_modelsList.end(); ++i )
    {
        ( *i )->updateModel();
    }

    for ( multiscaleCouplingsContainerConstIterator_Type i = M_couplingsList.begin(); i != M_couplingsList.end(); ++i )
    {
        ( *i )->updateCoupling();

        if ( M_algorithm->type() != Explicit )
        {
            ( *i )->extrapolateCouplingVariables();
        }
        else
        {
            ( *i )->initializeCouplingVariables();
        }
    }
}
コード例 #9
0
void
MultiscaleModelFSI1D::solve ( bc_Type& bc, solution_Type& solution, const std::string& solverType )
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::solve() \n";
#endif

    // Re-initialize solution
    copySolution ( *M_solution_tn, solution );

    // Subiterate to respect CFL
    UInt subiterationNumber (1);
    Real timeStep = M_data->dataTime()->timeStep();

    Real CFL = M_solver->computeCFL ( solution, M_data->dataTime()->timeStep() );
    if ( CFL > M_data->CFLmax() )
    {
        subiterationNumber = std::ceil ( CFL / M_data->CFLmax() );
        timeStep /= subiterationNumber;
    }

    if ( M_comm->MyPID() == 0 )
        std::cout << solverType << "  Number of subiterations                  " << subiterationNumber
                  << " ( CFL = " << CFL* timeStep / M_data->dataTime()->timeStep() << " )" << std::endl;

    for ( UInt i (1) ; i <= subiterationNumber ; ++i )
    {
        updateBCPhysicalSolverVariables();
        M_physics->setArea_tn ( *solution["A"] );
        M_solver->updateRHS ( solution, timeStep );
        M_solver->iterate ( bc, solution, M_data->dataTime()->previousTime() + i * timeStep, timeStep );
    }
}
コード例 #10
0
ファイル: boundaryConditions.hpp プロジェクト: chknipp/lifev
FSIOperator::fluidBchandlerPtr_Type BCh_monolithicFluid (FSIOperator& _oper, bool const& /*isOpen=true*/)
{
    // Boundary conditions for the fluid velocity
    debugStream ( 10000 ) << "Boundary condition for the fluid\n";

    if (! _oper.isFluid() )
    {
        return FSIOperator::fluidBchandlerPtr_Type();
    }

    FSIOperator::fluidBchandlerPtr_Type BCh_fluid ( new FSIOperator::fluidBchandler_Type );

    BCFunctionBase bcf      (fZero);
    BCFunctionBase in_flow  (uInterpolated);
    //    BCFunctionBase out_flow (fZero);

    BCFunctionBase out_press3 (FlowConditions::outPressure0);

    BCFunctionBase InletVect (aneurismFluxInVectorial);
    //BCFunctionBase bcfw0 (w0);

    //Inlets
    BCh_fluid->addBC ("InFlow" , INLET,  EssentialVertices, Full, InletVect, 3);

    //Outlets

    //Absorbing BC seemed not to work
    //Absorbing BC on outlet 2and3 caused instabilities
    BCh_fluid->addBC ("out3", OUTLET, Natural,  Normal, out_press3);
    //BCh_fluid->addBC("out3", OUTLET, Natural,  Normal, bcf);

    return BCh_fluid;
}
コード例 #11
0
ファイル: Factory.hpp プロジェクト: nuraiman/lifev
    /**
     * Unregister a product
     *
     * @param id
     * @sa registerProduct
     * @return true if unregistration went fine, false otherwise
     */
    bool unregisterProduct( const identifier_Type& id )
    {
#ifdef HAVE_LIFEV_DEBUG
        debugStream( 2200 ) << "Unregistered type with id : " << id << "\n";
#endif
        return M_associations.erase( id ) == 1;
    }
コード例 #12
0
// ===================================================
// Constructors & Destructor
// ===================================================
MultiscaleModelMultiscale::MultiscaleModelMultiscale() :
    multiscaleModel_Type       (),
    M_commManager              (),
    M_modelsList               (),
    M_couplingsList            (),
    M_algorithm                ()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8110 ) << "MultiscaleModelMultiscale::MultiscaleModelMultiscale() \n";
#endif

    M_type = Multiscale;

    multiscaleAlgorithmFactory_Type::instance().registerProduct ( Aitken,                    &createMultiscaleAlgorithmAitken );
    multiscaleAlgorithmFactory_Type::instance().registerProduct ( Broyden,                   &createMultiscaleAlgorithmBroyden );
    multiscaleAlgorithmFactory_Type::instance().registerProduct ( Explicit,                  &createMultiscaleAlgorithmExplicit );
    multiscaleAlgorithmFactory_Type::instance().registerProduct ( Newton,                    &createMultiscaleAlgorithmNewton );

    multiscaleCouplingFactory_Type::instance().registerProduct (  BoundaryCondition,         &createMultiscaleCouplingBoundaryCondition );
    multiscaleCouplingFactory_Type::instance().registerProduct (  MeanNormalStress,          &createMultiscaleCouplingMeanNormalStress );
    multiscaleCouplingFactory_Type::instance().registerProduct (  MeanNormalStressArea,      &createMultiscaleCouplingMeanNormalStressArea );
    multiscaleCouplingFactory_Type::instance().registerProduct (  MeanNormalStressValve,     &createMultiscaleCouplingMeanNormalStressValve );
    multiscaleCouplingFactory_Type::instance().registerProduct (  MeanTotalNormalStress,     &createMultiscaleCouplingMeanTotalNormalStress );
    multiscaleCouplingFactory_Type::instance().registerProduct (  MeanTotalNormalStressArea, &createMultiscaleCouplingMeanTotalNormalStressArea );
}
コード例 #13
0
FSIOperator::solidBchandlerPtr_Type BCh_solidInvLin (FSIOperator& _oper)
{

    if (! _oper.isSolid() )
    {
        return FSIOperator::solidBchandlerPtr_Type();
    }

    // Boundary conditions for the solid displacement
    debugStream ( 10000 ) << "Boundary condition for the inverse linear solid\n";
    FSIOperator::solidBchandlerPtr_Type BCh_solidLinInv ( new FSIOperator::solidBchandler_Type );

    BCFunctionBase bcf (fZero);

    BCh_solidLinInv->addBC ("Base",      2, Essential, Full, bcf,  3);
    BCh_solidLinInv->addBC ("EdgesIn",    20, EssentialVertices, Full, bcf,  3);

    //     if (_oper.method() == "steklovPoincare")
    //     {
    //         steklovPoincare *SPOper = dynamic_cast<steklovPoincare *>(&_oper);
    //         SPOper->setSolidInvLinInterfaceStress((LifeV::Vector&) _oper.residual());

    //         BCh_solidLinInv->addBC("Interface", 100, Natural, Full,
    //                                *SPOper->bcvSolidInvLinInterfaceStress(), 3);
    //     }
    //     else
    //     {
    //         exactJacobian  *EJOper = dynamic_cast<exactJacobian *>(&_oper);
    //         EJOper->setDerFluidLoadToStructure(_oper.fluid().residual());
    //         BCh_solidLinInv->addBC("Interface", 1, Natural,   Full,
    //                             *EJOper->bcvDerFluidLoadToStructure(), 3);
    //     }

    return BCh_solidLinInv;
}
コード例 #14
0
ファイル: Factory.hpp プロジェクト: nuraiman/lifev
    /**
     * Register a product.
     *
     * A product is composed of an identifier (typically a
     * std::string) and a functor that will create the associated
     * object.
     *
     * @param id identifier for the object to be registered
     * @param creator the functor that will create the registered
     * object
     *
     * @return true if registration went fine, false otherwise
     */
    bool registerProduct( const identifier_Type& id, creator_Type creator )
    {
#ifdef HAVE_LIFEV_DEBUG
        debugStream( 2200 ) << "Registered type with id : " << id << "\n";
#endif
        return M_associations.insert( typename productId_Type::value_type( id, creator ) ).second;
    }
コード例 #15
0
ファイル: boundaryConditions.hpp プロジェクト: chknipp/lifev
FSIOperator::solidBchandlerPtr_Type BCh_monolithicSolid (FSIOperator& _oper)
{

    if (! _oper.isSolid() )
    {
        return FSIOperator::solidBchandlerPtr_Type();
    }

    // Boundary conditions for the solid displacement
    debugStream ( 10000 ) << "Boundary condition for the solid\n";
    FSIOperator::solidBchandlerPtr_Type BCh_solid ( new FSIOperator::solidBchandler_Type );

    BCFunctionBase bcf (fZero);

    BCh_solid->addBC ("Top",   RING, Essential, Full, bcf,  3);
    BCh_solid->addBC ("Base",  RING2, Essential, Full, bcf,  3);

    aortaVelIn::S_timestep = _oper.dataFluid()->dataTime()->timeStep();
    BCFunctionBase hyd (fZero);
    BCFunctionBase young (E);
    //robin condition on the outer wall
    _oper.setRobinOuterWall (hyd, young);
    BCh_solid->addBC ("OuterWall", OUTERWALL, Robin, Normal, _oper.bcfRobinOuterWall() );

    return BCh_solid;
}
コード例 #16
0
ファイル: bbstream.cpp プロジェクト: Xaymar/BlitzNext
float bbReadFloat(bbStream* s)
{
	if (debug)
		debugStream(s);
	float n = 0;
	s->read((char*)&n, 4);
	return n;
}
コード例 #17
0
ファイル: bbstream.cpp プロジェクト: Xaymar/BlitzNext
int bbReadInt(bbStream* s)
{
	if (debug)
		debugStream(s);
	int n = 0;
	s->read((char*)&n, 4);
	return n;
}
コード例 #18
0
ファイル: bbstream.cpp プロジェクト: Xaymar/BlitzNext
int bbReadByte(bbStream* s)
{
	if (debug)
		debugStream(s);
	int n = 0;
	s->read((char*)&n, 1);
	return n;
}
コード例 #19
0
ファイル: bbstream.cpp プロジェクト: Xaymar/BlitzNext
void bbCopyStream(bbStream* s, bbStream* d, int buff_size)
{
	if (debug) {
		debugStream(s);
		debugStream(d);
		if (buff_size < 1 || buff_size > 1024 * 1024)
			ThrowRuntimeException("Illegal buffer size");
	}
	char* buff = new char[buff_size];
	while (s->eof() == 0 && d->eof() == 0) {
		int n = s->read(buff, buff_size);
		d->write(buff, n);
		if (n < buff_size)
			break;
	}
	delete buff;
}
コード例 #20
0
ファイル: bbstream.cpp プロジェクト: Xaymar/BlitzNext
void bbWriteLine(bbStream* s, BBStr* t)
{
	if (debug)
		debugStream(s);
	s->write(t->data(), t->size());
	s->write("\r\n", 2);
	delete t;
}
コード例 #21
0
Real
BCInterfaceFunctionParser< PhysicalSolverType >::functionTimeSpaceID( const Real& t, const Real& x, const Real& y, const Real& z, const ID& id )
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream( 5021 ) << "BCInterfaceFunction::functionTimeSpaceID: " << "\n";
    debugStream( 5021 ) << "                                                           x: " << x << "\n";
    debugStream( 5021 ) << "                                                           y: " << y << "\n";
    debugStream( 5021 ) << "                                                           z: " << z << "\n";
    debugStream( 5021 ) << "                                                           t: " << t << "\n";
    debugStream( 5021 ) << "                                                          id: " << id << "\n";
#endif

    M_parser->setVariable( "t", t );
    M_parser->setVariable( "x", x );
    M_parser->setVariable( "y", y );
    M_parser->setVariable( "z", z );

    this->dataInterpolation();

#ifdef HAVE_LIFEV_DEBUG
    debugStream( 5021 ) << "                                                evaluate(" << M_mapID[id] << ") : " << M_parser->evaluate( M_mapID[id] ) << "\n";
#endif

    return M_parser->evaluate( M_mapID[id] );
}
コード例 #22
0
Real
MultiscaleModelFSI1D::boundaryDeltaArea ( const multiscaleID_Type& boundaryID, bool& solveLinearSystem )
{
    bcSide_Type bcSide = flagConverter ( boundaryID );

    solveLinearModel ( solveLinearSystem );

    Real A      = M_solver->boundaryValue ( *M_solution, OneDFSI::A, bcSide );
    Real Adelta = M_solver->boundaryValue ( *M_linearSolution, OneDFSI::A, bcSide );

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::boundaryDeltaArea( boundaryID, solveLinearSystem ) \n";
    debugStream ( 8130 ) << "A:          " << A <<  "\n";
    debugStream ( 8130 ) << "Adelta:     " << Adelta <<  "\n";
#endif

    return (Adelta - A) / M_bcDelta;
}
コード例 #23
0
void
MultiscaleModelFSI1D::updateSolution()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::updateSolution() \n";
#endif

}
コード例 #24
0
void
MultiscaleModelFSI1D::setupModel()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::setupModel() \n";
#endif

    //FEspace
    setupFESpace();

    //Setup solution
    M_solver->setupSolution ( *M_solution );
    M_solver->setupSolution ( *M_solution_tn );

    //Set default BC (has to be called after setting other BC)
    M_bc->handler()->setDefaultBC();
    M_bc->setPhysicalSolver ( M_solver );
    M_bc->setSolution ( M_solution );
    M_bc->setFluxSource ( M_flux, M_source );

    //Post-processing
#ifdef HAVE_HDF5
    M_exporter->setMeshProcId ( M_exporterMesh, M_comm->MyPID() );

    DOF tmpDof ( *M_exporterMesh, M_feSpace->refFE() );
    std::vector<Int> myGlobalElements ( tmpDof.globalElements ( *M_exporterMesh ) );
    MapEpetra map ( -1, myGlobalElements.size(), &myGlobalElements[0], M_comm );
    M_solver->setupSolution ( *M_exporterSolution, map, true );

    M_exporter->addVariable ( IOData_Type::ScalarField, "Area ratio (fluid)", M_feSpace, (*M_exporterSolution) ["AoverA0minus1"], static_cast <UInt> ( 0 ) );
    M_exporter->addVariable ( IOData_Type::ScalarField, "Flow rate (fluid)",  M_feSpace, (*M_exporterSolution) ["Q"],    static_cast <UInt> ( 0 ) );
    //M_exporter->addVariable( IOData_Type::ScalarField, "W1",               M_feSpace, (*M_exporterSolution)["W1"],   static_cast <UInt> ( 0 ), M_feSpace->dof().numTotalDof() );
    //M_exporter->addVariable( IOData_Type::ScalarField, "W2",               M_feSpace, (*M_exporterSolution)["W2"],   static_cast <UInt> ( 0 ), M_feSpace->dof().numTotalDof() );
    M_exporter->addVariable ( IOData_Type::ScalarField, "Pressure (fluid)",   M_feSpace, (*M_exporterSolution) ["P"],    static_cast <UInt> ( 0 ) );
#endif

#ifdef HAVE_MATLAB_POSTPROCESSING
    M_solver->resetOutput ( *M_exporterSolution );
#endif

    //Setup solution
    initializeSolution();

#ifdef JACOBIAN_WITH_FINITEDIFFERENCE
    if ( M_couplings.size() > 0 )
    {
        createLinearBC();
        updateLinearBC ( *M_solution );
        setupLinearModel();

        // Initialize the linear solution
        copySolution ( *M_solution, *M_linearSolution );
    }
#endif

}
コード例 #25
0
Real
MultiscaleModelFSI1D::boundaryDeltaMeanTotalNormalStress ( const multiscaleID_Type& boundaryID, bool& solveLinearSystem )
{
    bcSide_Type bcSide = flagConverter ( boundaryID );

    solveLinearModel ( solveLinearSystem );

    Real T      = M_solver->boundaryValue ( *M_solution, OneDFSI::T, bcSide );
    Real Tdelta = M_solver->boundaryValue ( *M_linearSolution, OneDFSI::T, bcSide );

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8130 ) << "MultiscaleModelFSI1D::boundaryDeltaTotalStress( boundaryID, solveLinearSystem ) \n";
    debugStream ( 8130 ) << "T:          " << T <<  "\n";
    debugStream ( 8130 ) << "Tdelta:     " << Tdelta <<  "\n";
#endif

    return (Tdelta - T) / M_bcDelta;
}
コード例 #26
0
ファイル: bbstream.cpp プロジェクト: Xaymar/BlitzNext
void bbWriteString(bbStream* s, BBStr* t)
{
	if (debug)
		debugStream(s);
	int n = t->size();
	s->write((char*)&n, 4);
	s->write(t->data(), t->size());
	delete t;
}
コード例 #27
0
void
MultiscaleModelMultiscale::saveSolution()
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 8110 ) << "MultiscaleModelMultiscale::saveSolution() \n";
#endif

    for ( multiscaleModelsContainerConstIterator_Type i = M_modelsList.begin(); i != M_modelsList.end(); ++i )
    {
        ( *i )->saveSolution();
    }

    for ( multiscaleCouplingsContainerConstIterator_Type i = M_couplingsList.begin(); i != M_couplingsList.end(); ++i )
    {
        ( *i )->saveSolution();
    }

    // Save the framework numbering
    if ( M_globalData->dataTime()->isFirstTimeStep() )
    {
        // File name
        std::string filename = multiscaleProblemFolder + multiscaleProblemPrefix + "_Model_" + number2string ( M_ID ) + "_" + number2string ( multiscaleProblemStep ) + ".mfile";

        // Remove the old file if present
        if ( M_comm->MyPID() == 0 )
        {
            std::remove ( filename.c_str() );
        }

        M_comm->Barrier();

        // Open the file
        std::ofstream output;
        output.open ( filename.c_str(), std::ios::app );

        // Models list
        for ( multiscaleModelsContainerConstIterator_Type i = M_modelsList.begin(); i != M_modelsList.end(); ++i )
            if ( ( *i )->communicator()->MyPID() == 0 )
            {
                output << "Model ID: " << ( *i )->ID() << ", Name: " << ( *i )->modelName() << std::endl;
            }

        M_comm->Barrier();

        // Couplings list
        if ( M_comm->MyPID() == 0 )
            for ( multiscaleCouplingsContainerConstIterator_Type i = M_couplingsList.begin(); i != M_couplingsList.end(); ++i )
            {
                output << "Coupling ID: " << ( *i )->ID() << ", Name: " << ( *i )->couplingName() << std::endl;
            }

        // Close the file
        output.close();
    }
}
コード例 #28
0
void
BCInterfaceFunctionParser< OneDFSIBCHandler, OneDFSISolver >::setData ( const std::shared_ptr< BCInterfaceData >& data )
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream ( 5022 ) << "BCInterfaceFunction::setData" << "\n";
#endif

    setupParser ( data );
}
コード例 #29
0
void
BCInterfaceFunctionParser< PhysicalSolverType >::setData( const BCInterfaceData1D& data )
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream( 5022 ) << "BCInterfaceFunction::setData" << "\n";
#endif

    setupParser( data );
}
コード例 #30
0
Real
BCInterfaceFunctionParser< PhysicalSolverType >::functionTime( const Real& t )
{

#ifdef HAVE_LIFEV_DEBUG
    debugStream( 5021 ) << "BCInterfaceFunction::functionTime: " << "\n";
    debugStream( 5021 ) << "                                                           t: " << t << "\n";
#endif

    M_parser->setVariable( "t", t );

    this->dataInterpolation();

#ifdef HAVE_LIFEV_DEBUG
    debugStream( 5021 ) << "                                                evaluate( 0 ) : " << M_parser->evaluate( 0 ) << "\n";
#endif

    return M_parser->evaluate( 0 );
}