AssemblyPolicyNavierStokesPicard.cpp 3.18 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//@HEADER
/*
*******************************************************************************

    Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
    Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University

    This file is part of LifeV.

    LifeV is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    LifeV is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with LifeV.  If not, see <http://www.gnu.org/licenses/>.

*******************************************************************************
*/
//@HEADER

/*!
    @file AssemblyPolicyNavierStokesPicard class
    @brief This class contains all the informations necessary
           to assemble a Navier-Stokes problem using a
           semi implicit scheme

    @author Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
    @date 17-12-2012
 */

#include <lifev/navier_stokes/solver/NavierStokesSolver/AssemblyPolicyNavierStokesPicard.hpp>

#include <string>
#include <lifev/core/util/LifeChrono.hpp>
41
// #include <lifev/navier_stokes/algorithm/PreconditionerPCD.hpp>
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

namespace LifeV
{

void
AssemblyPolicyNavierStokesPicard::initAssembly ( Teuchos::ParameterList& list )
{
    AssemblyPolicyStokes::initAssembly ( list );

    LifeChrono assemblyChrono;
    assemblyChrono.start();

    displayer().leaderPrint ( "Creating the mass matrix... " );
    map_Type solutionMap ( uFESpace()->map() + pFESpace()->map() );
    M_massMatrix.reset ( new matrix_Type ( solutionMap ) );
    M_massMatrix->zero();
    M_assembler->addMass ( *M_massMatrix, 1.0 );
    M_massMatrix->globalAssemble();
    displayer().leaderPrint ( "done\n" );

    assemblyChrono.stop();
    displayer().leaderPrintMax ("Matrices assembly time: ", assemblyChrono.diff(), " s.\n");
}

void
AssemblyPolicyNavierStokesPicard::assembleSystem ( matrixPtr_Type systemMatrix,
                                                   vectorPtr_Type rhs,
                                                   vectorPtr_Type solution,
                                                   preconditionerPtr_Type preconditioner )
{
    AssemblyPolicyStokes::assembleSystem ( systemMatrix, rhs, solution, preconditioner );

    bdf()->updateRHSContribution ( timestep() );
    *rhs += *M_massMatrix * bdf()->rhsContributionFirstDerivative();

    double alpha = bdf()->coefficientFirstDerivative ( 0 ) / timestep();
    *systemMatrix += *M_massMatrix * alpha;

    vector_Type beta ( systemMatrix->map(), Repeated );
    beta += *solution;
    M_assembler->addConvection ( *systemMatrix, 1.0, beta );

grandper's avatar
astyle    
grandper committed
84
85
86
87
88
    //    if ( preconditioner->preconditionerType() == "PCD" )
    //    {
    //        PreconditionerPCD* pcdPtr = dynamic_cast<PreconditionerPCD*> ( preconditioner.get() );
    //        pcdPtr->updateBeta ( beta );
    //    }
89
90
91
}

} // namespace LifeV