Directory: | ./ |
---|---|
File: | Model/elasticCurvedBeamModel.cpp |
Date: | 2024-04-14 07:32:34 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 28 | 28 | 100.0% |
Branches: | 5 | 10 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // ______ ______ _ _ _____ ______ | ||
2 | // | ____| ____| | (_)/ ____| | ____| | ||
3 | // | |__ | |__ | | _| (___ ___| |__ | ||
4 | // | __| | __| | | | |\___ \ / __| __| | ||
5 | // | | | |____| |____| |____) | (__| |____ | ||
6 | // |_| |______|______|_|_____/ \___|______| | ||
7 | // Finite Elements for Life Sciences and Engineering | ||
8 | // | ||
9 | // License: LGL2.1 License | ||
10 | // FELiScE default license: LICENSE in root folder | ||
11 | // | ||
12 | // Main authors: | ||
13 | // | ||
14 | |||
15 | // System includes | ||
16 | |||
17 | // External includes | ||
18 | |||
19 | // Project includes | ||
20 | #include "Model/elasticCurvedBeamModel.hpp" | ||
21 | |||
22 | namespace felisce | ||
23 | { | ||
24 |
2/4✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
4 | ElasticCurvedBeamModel::ElasticCurvedBeamModel():Model() |
25 | { | ||
26 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | m_name = "Elastic Curved Beam Model"; |
27 | 4 | } | |
28 | |||
29 | 8 | ElasticCurvedBeamModel::~ElasticCurvedBeamModel() | |
30 | { | ||
31 | 8 | m_dispTimeRHS.destroy(); | |
32 | 8 | m_seqDispTimeRHS.destroy(); | |
33 | } | ||
34 | |||
35 | 4 | void ElasticCurvedBeamModel::initializeDerivedModel() | |
36 | { | ||
37 | |||
38 | // todo : initialize solution for solver. | ||
39 | // _linearProblem[0]->set_U_0(_U_0); | ||
40 | |||
41 | // First assembling loop in iteration 0 to build static matrix. | ||
42 | //_linearProblem[iProblem]->assembleMatrixRHS(_rankProc); | ||
43 | |||
44 | // save static matrix in matrix _A. | ||
45 | //_linearProblem[iProblem]->copyMatrixRHS(); | ||
46 | 4 | } | |
47 | |||
48 | |||
49 | 120 | void ElasticCurvedBeamModel::forward() | |
50 | { | ||
51 | // Write solution for postprocessing (if required) | ||
52 | 120 | writeSolution(); | |
53 | |||
54 | // Advance time step. | ||
55 | 120 | updateTime(); | |
56 | |||
57 | // Print time information | ||
58 | 120 | printNewTimeIterationBanner(); | |
59 | |||
60 | //Assembly loop on elements. | ||
61 | 120 | m_linearProblem[0]->assembleMatrixRHSBD(MpiInfo::rankProc()); | |
62 | |||
63 | //Apply boundary conditions. | ||
64 | 120 | m_linearProblem[0]->finalizeEssBCTransient(); | |
65 | |||
66 | 120 | m_linearProblem[0]->applyBC(FelisceParam::instance().essentialBoundaryConditionsMethod, MpiInfo::rankProc()); | |
67 | |||
68 | 120 | m_dispTimeRHS.copyFrom(m_linearProblem[0]->solution()); | |
69 | |||
70 | |||
71 | //Solve linear system. | ||
72 | 120 | m_linearProblem[0]->solve(MpiInfo::rankProc(), MpiInfo::numProc()); | |
73 | |||
74 | // computation of the time RHS | ||
75 | // 2 * X^n - X^(n-1) | ||
76 | 120 | m_dispTimeRHS.axpby(2., -1., m_linearProblem[0]->solution()); | |
77 | |||
78 | 120 | m_linearProblem[0]->gatherSolution(); | |
79 | 120 | m_linearProblem[0]->gatherVector(m_dispTimeRHS, m_seqDispTimeRHS); | |
80 | 120 | } | |
81 | |||
82 | 4 | void ElasticCurvedBeamModel::setExternalVec(){ | |
83 | 4 | m_dispTimeRHS.duplicateFrom(m_linearProblem[0]->solution()); | |
84 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | m_dispTimeRHS.set(0.); |
85 | 4 | m_seqDispTimeRHS.duplicateFrom(m_linearProblem[0]->sequentialSolution()); | |
86 |
1/2✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 | m_seqDispTimeRHS.set(0.); |
87 | |||
88 | 4 | m_linearProblem[0]->pushBackExternalVec(m_seqDispTimeRHS); | |
89 | 4 | } | |
90 | } | ||
91 |