MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
mast_thermoelastic_load.cpp
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include "catch.hpp"
21 
22 #include "test_helpers.h"
23 
24 // MAST includes
25 #include "base/parameter.h"
28 
35 TEST_CASE("create_thermoelastic_load",
36  "[thermoelastic],[load]")
37 {
38  MAST::Parameter temperature("T", 482.222);
39  MAST::Parameter ref_temperature("T0", 0.0);
40 
41  MAST::ConstantFieldFunction temperature_f("temperature", temperature);
42  MAST::ConstantFieldFunction ref_temperature_f("ref_temperature", ref_temperature);
43 
44  MAST::BoundaryConditionBase temperature_load(MAST::TEMPERATURE); // Initialize a thermoelastic load
45 
46  REQUIRE( temperature_load.type() == MAST::TEMPERATURE );
47 
48  temperature_load.add(temperature_f); // Add the field function defining the temperature to the thermoelastic load object
49  temperature_load.add(ref_temperature_f); // Add the field function defining the reference temperature to the thermoelastic load object
50 
51  REQUIRE( temperature_load.contains("temperature") );
52  REQUIRE( temperature_load.contains("ref_temperature") );
53  REQUIRE( temperature_load.depends_on(temperature) );
54  REQUIRE( temperature_load.depends_on(ref_temperature) );
55 
56  REQUIRE_NOTHROW( temperature_load.get<MAST::FieldFunction<Real>>("temperature") );
57  REQUIRE_NOTHROW( temperature_load.get<MAST::FieldFunction<Real>>("ref_temperature") );
58 }
This is a scalar function whose value can be changed and one that can be used as a design variable in...
Definition: parameter.h:35
void add(MAST::FunctionBase &f)
adds the function to this card and returns a reference to it.
bool contains(const std::string &nm) const
checks if the card contains the specified property value
TEST_CASE("create_thermoelastic_load", "[thermoelastic],[load]")
NOTE: In this test, we aren&#39;t really checking anything new that wasn&#39;t already checked in the functio...
const ValType & get(const std::string &nm) const
returns a constant reference to the specified function
MAST::BoundaryConditionType type() const
virtual bool depends_on(const MAST::FunctionBase &f) const
returns true if the property card depends on the function f