-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply ground motion input as nodal acceleration constraint #715
base: develop
Are you sure you want to change the base?
Changes from all commits
13f5194
a413321
46853d0
3d10bf6
322e0f5
55a83de
febbb12
f8d2d3b
5e8cd12
d1c4ce3
204ba5d
ab93903
417d5c9
8bc5af4
b25481b
fc7b3b0
b241669
7a347f5
b558937
3de4f5e
e683b36
0f1a961
6676dbc
05c2acc
34c848d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2015, ben-strasser | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of fast-cpp-csv-parser nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifndef MPM_ACCELERATION_CONSTRAINT_H_ | ||
#define MPM_ACCELERATION_CONSTRAINT_H_ | ||
|
||
//! Alias for JSON | ||
#include "json.hpp" | ||
using Json = nlohmann::json; | ||
|
||
#include "function_base.h" | ||
|
||
namespace mpm { | ||
|
||
//! AccelerationConstraint class to store acceleration constraint on a set | ||
//! \brief AccelerationConstraint class to store a constraint on a set | ||
//! \details AccelerationConstraint stores the constraint as a static value | ||
class AccelerationConstraint { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a general constraint class from which this could be derived? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently, no. But I do agree that we should implement a general constraint from which this one and others ( |
||
public: | ||
// Constructor | ||
//! \param[in] setid set id | ||
//! \param[in] acceleration_fn Math function if defined | ||
//! \param[in] dir Direction of constraint load | ||
//! \param[in] acceleration Constraint acceleration | ||
AccelerationConstraint( | ||
int setid, const std::shared_ptr<mpm::FunctionBase>& acceleration_fn, | ||
unsigned dir, double acceleration) | ||
: setid_{setid}, | ||
acceleration_fn_{acceleration_fn}, | ||
dir_{dir}, | ||
acceleration_{acceleration} {}; | ||
|
||
// Set id | ||
int setid() const { return setid_; } | ||
|
||
// Direction | ||
unsigned dir() const { return dir_; } | ||
|
||
// Return acceleration | ||
double acceleration(double current_time) const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. inline this function |
||
// Static load when no math function is defined | ||
double scalar = (this->acceleration_fn_ != nullptr) | ||
? (this->acceleration_fn_)->value(current_time) | ||
: 1.0; | ||
return acceleration_ * scalar; | ||
} | ||
|
||
private: | ||
// ID | ||
int setid_; | ||
// Math function | ||
std::shared_ptr<mpm::FunctionBase> acceleration_fn_; | ||
// Direction | ||
unsigned dir_; | ||
// Acceleration | ||
double acceleration_; | ||
}; | ||
} // namespace mpm | ||
#endif // MPM_ACCELERATION_CONSTRAINT_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.