opm-common
Loading...
Searching...
No Matches
MaterialStateTPSA.hpp
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 Copyright 2025 NORCE AS
5
6 This file is part of the Open Porous Media project (OPM).
7
8 OPM is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
12
13 OPM is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with OPM. If not, see <http://www.gnu.org/licenses/>.
20
21 Consult the COPYING file in the top-level source directory of this
22 module for the precise wording of the license and the list of
23 copyright holders.
24*/
25#ifndef TPSA_MATERIAL_STATE_HPP
26#define TPSA_MATERIAL_STATE_HPP
27
30#include <opm/material/materialstates/GenericMaterialState.hpp>
31
32#include <array>
33
34
35namespace Opm {
36
37template <class Scalar>
39{
40 using ParentType = GenericMaterialState<Scalar>;
41
42public:
46 MaterialStateTPSA() : ParentType()
47 {
48 Valgrind::SetUndefined(rotation_);
49 Valgrind::SetUndefined(solidPressure_);
50 }
51
57 const Scalar rotation(unsigned dirIdx) const
58 {
59 return rotation_[dirIdx];
60 }
61
65 const Scalar solidPressure() const
66 {
67 return solidPressure_;
68 }
69
75 void setRotation(unsigned dirIdx, const Scalar value)
76 {
78 Valgrind::SetUndefined(rotation_[dirIdx]);
79
80 rotation_[dirIdx] = value;
81 }
82
88 void setSolidPressure(const Scalar value)
89 {
91 Valgrind::SetUndefined(solidPressure_);
92
93 solidPressure_ = value;
94 }
95
101 template <class MaterialState>
102 void assign(const MaterialState& ms)
103 {
104 // Assign parent class variables
106
107 // Assign rotation
108 for (unsigned dirIdx = 0; dirIdx < 3; ++dirIdx) {
109 rotation_[dirIdx] = Opm::decay<Scalar>(ms.rotation(dirIdx));
110 }
111
112 // Assign solid pressure
113 solidPressure_ = Opm::decay<Scalar>(ms.solidPressure());
114 }
115
119 void checkDefined() const
120 {
121 Valgrind::CheckDefined(rotation_);
122 Valgrind::CheckDefined(solidPressure_);
123 }
124
125protected:
126 std::array<Scalar, 3> rotation_{};
127 Scalar solidPressure_{};
128}; // class MaterialStateTPSA
129
130} // namespace Opm
131
132#endif
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Some templates to wrap the valgrind client request macros.
OPM_HOST_DEVICE void SetUndefined(const T &value)
Make the memory on which an object resides undefined in valgrind runs.
Definition Valgrind.hpp:174
OPM_HOST_DEVICE bool CheckDefined(const T &value)
Make valgrind complain if any of the memory occupied by an object is undefined.
Definition Valgrind.hpp:76
GenericMaterialState()
Constructor.
Definition GenericMaterialState.hpp:43
void assign(const MaterialState &ms)
Assign from another material state container.
Definition GenericMaterialState.hpp:83
void checkDefined() const
Instruct Valgrind to check the definedness of all attributes of this class.
Definition MaterialStateTPSA.hpp:119
void setSolidPressure(const Scalar value)
Set solid pressure.
Definition MaterialStateTPSA.hpp:88
MaterialStateTPSA()
Constructor.
Definition MaterialStateTPSA.hpp:46
const Scalar rotation(unsigned dirIdx) const
Return direction (x-, y- or z-) component of rotation.
Definition MaterialStateTPSA.hpp:57
void assign(const MaterialState &ms)
Assign from another material state container.
Definition MaterialStateTPSA.hpp:102
const Scalar solidPressure() const
Return solid pressure.
Definition MaterialStateTPSA.hpp:65
void setRotation(unsigned dirIdx, const Scalar value)
Set a direction (x-, y- or z-) component of rotation.
Definition MaterialStateTPSA.hpp:75
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30