Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/gsDynamicSolvers/gsDynamicBathe.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** @file gsDynamicBathe.h

@brief Class to perform time integration of second-order structural dynamics systems using the Explicit Euler method
@brief Class to perform time integration of second-order structural dynamics systems using the Bathe method

For the Bathe method, see:
Bathe, K. J., & Baig, M. M. I. (2005).
On a composite implicit time integration procedure for nonlinear dynamics.
Computers & Structures, 83(31-32), 2513-2524.

This file is part of the G+Smo library.

Expand All @@ -9,9 +14,6 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
Expand Down
3 changes: 0 additions & 3 deletions src/gsDynamicSolvers/gsDynamicExplicitEuler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
Expand Down
5 changes: 1 addition & 4 deletions src/gsDynamicSolvers/gsDynamicImplicitEuler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @file gsDynamicImplicitEuler.h

@brief Class to perform time integration of second-order structural dynamics systems using the Explicit Euler method
@brief Class to perform time integration of second-order structural dynamics systems using the Implicit Euler method

This file is part of the G+Smo library.

Expand All @@ -9,9 +9,6 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/gsDynamicSolvers/gsDynamicNewmark.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** @file gsDynamicNewmark.h

@brief Class to perform time integration of second-order structural dynamics systems using the Explicit Euler method
@brief Class to perform time integration of second-order structural dynamics systems using the Newmark method

For the Newmark method, see:
Newmark, N. M. (1959).
A method of computation for structural dynamics.
Journal of the engineering mechanics division, 85(3), 67-94.

This file is part of the G+Smo library.

Expand All @@ -9,9 +14,6 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
Expand Down
5 changes: 1 addition & 4 deletions src/gsDynamicSolvers/gsDynamicRK4.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @file gsDynamicRK4.h

@brief Class to perform time integration of second-order structural dynamics systems using the Explicit Euler method
@brief Class to perform time integration of second-order structural dynamics systems using the Runge-Kutta 4 method

This file is part of the G+Smo library.

Expand All @@ -9,9 +9,6 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
Expand Down
10 changes: 6 additions & 4 deletions src/gsDynamicSolvers/gsDynamicWilson.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** @file gsDynamicWilson.h

@brief Class to perform time integration of second-order structural dynamics systems using the Explicit Euler method
@brief Class to perform time integration of second-order structural dynamics systems using the Wilson-theta method

For the Wilson-theta method, see:
Wilson, E. L., Farhoomand, I., & Bathe, K. J. (1972).
Nonlinear dynamic analysis of complex structures.
Earthquake Engineering & Structural Dynamics, 1(3), 241-252.

This file is part of the G+Smo library.

Expand All @@ -9,9 +14,6 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
Expand Down
99 changes: 77 additions & 22 deletions src/gsDynamicSolvers/gsDynamicXBraid.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** @file gsDynamicImplicitEuler.h
/** @file gsDynamicXBraid.h

@brief Class to perform time integration of second-order structural dynamics systems using the Explicit Euler method
@brief This class provides an interface to XBraid for time integration methods deriving from \ref gsDynamicBase

For more information about XBraid, please check \ref gsXBraid or

[XBraid on GitHub] https://github.com/XBraid/xbraid/
[XBraid cite] XBraid: Parallel multigrid in time. http://llnl.gov/casc/xbraid.

This file is part of the G+Smo library.

Expand All @@ -9,16 +14,16 @@
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Author(s): H.M. Verhelst (2019-..., TU Delft)

TODO (June 2023):
* Change inputs to const references!
*/

#pragma once
#include <gsStructuralAnalysis/src/gsDynamicSolvers/gsDynamicBase.h>
#include <gsXBraid/gsXBraid.h>
#include <gsIO/gsOptionList.h>

#ifdef gsXBraid_ENABLED
#include <gsXBraid/gsXBraid.h>
#endif

namespace gismo
{

Expand All @@ -38,7 +43,16 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >

virtual ~gsDynamicXBraid() {};

#ifdef gsXBraid_ENABLED
/// Constructor
///
/// @param[in] solver A dynamic solver
/// @param[in] comm The MPI communication channel
/// @param[in] tstart The start time of the simulation
/// @param[in] tend The end time of the simulation
/// @param[in] numDofs The number of degrees of freedom
/// @param[in] numSteps The number time steps to perform
///
gsDynamicXBraid(
const gsDynamicBase<T> * solver,
const gsMpiComm& comm,
Expand All @@ -54,9 +68,33 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
defaultOptions();
m_callback = [](const index_t&,const T&,const gsVector<T>&,const gsVector<T>&,const gsVector<T>&){return;}; // set empty callback
}
#else
/// Constructor
///
/// @param[in] solver A dynamic solver
/// @param[in] comm The MPI communication channel
/// @param[in] tstart The start time of the simulation
/// @param[in] tend The end time of the simulation
/// @param[in] numDofs The number of degrees of freedom
/// @param[in] numSteps The number time steps to perform
///
gsDynamicXBraid(
const gsDynamicBase<T> * solver,
const gsMpiComm& comm,
const T& tstart,
const T& tend,
const index_t numDofs,
index_t numSteps = 10)
{
GISMO_ERROR("XBraid needs to be enabled to use the gsDynamicXBraid interface")
}
#endif

// Member functions
public:
/**
* @brief Dets the default options
*/
void defaultOptions()
{
// see gsXBraid/filedata/pde/heat2d_square_ibvp1.xml
Expand Down Expand Up @@ -87,6 +125,9 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
m_options.addSwitch("extraVerbose", "Extra verbosity", 0);
}

/**
* @brief Initializes the class
*/
void initialize()
{
// see gsXBraid/examples/xbraid_heatEquation_example.cpp
Expand Down Expand Up @@ -114,7 +155,8 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
else this->SetRelTol(m_options.getReal("relTol"));
}

/// Initializes a vector
#ifdef gsXBraid_ENABLED
/// See \ref gsXBraid for the documentation
braid_Int Init(braid_Real t, braid_Vector *u_ptr) override
{
gsMatrix<T>* u = new gsMatrix<T>(3*m_numDofs, 1);
Expand All @@ -132,11 +174,31 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
*u_ptr = (braid_Vector) u;
return braid_Int(0);
}
#endif

/**
* @brief Access the options of the class
*
* @return The options stored in the class
*/
gsOptionList & options() { return m_options; }

/**
* @brief Set the class options
*
* @param[in] options The options to be set
*/
void setOptions(gsOptionList options) {m_options.update(options,gsOptionList::addIfUnknown); };

/// Performs a single step of the parallel-in-time multigrid
/**
* @brief Provide a callback function to be executed after the simulation
*
* @param[in] callback The callback function
*/
void setCallback(callback_type callback) const {m_callback = callback;}

#ifdef gsXBraid_ENABLED
/// See \ref gsXBraid for the documentation
braid_Int Step(braid_Vector u, braid_Vector ustop, braid_Vector fstop, BraidStepStatus &status) override
{
gsVector<T>* u_ptr = (gsVector<T>*) u;
Expand Down Expand Up @@ -190,7 +252,7 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
return braid_Int(0);
}

/// Computes the spatial norm of the given vector
/// See \ref gsXBraid for the documentation
braid_Int SpatialNorm( braid_Vector u,
braid_Real *norm_ptr) override
{
Expand All @@ -200,16 +262,14 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
return braid_Int(0);
}

/// Sets the size of the MPI communication buffer
/// See \ref gsXBraid for the documentation
braid_Int BufSize(braid_Int *size_ptr, BraidBufferStatus &status) override
{
*size_ptr = sizeof(T)*(m_numDofs*3+2); // +2 comes from rows, cols of the solution vector u.
return braid_Int(0);
}

void setCallback(callback_type callback) const {m_callback = callback;}

/// Handles access for input/output
/// See \ref gsXBraid for the documentation
braid_Int Access(braid_Vector u, BraidAccessStatus &status) override
{
gsVector<T>* u_ptr = (gsVector<T>*) u;
Expand All @@ -222,7 +282,7 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
return braid_Int(0);
}

/// Performs spatial coarsening
/// See \ref gsXBraid for the documentation
/*
NOTE: This routine is not implemented. How to do it:
1. Make the Coarsen and Refine routines virtual
Expand All @@ -238,7 +298,7 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
return braid_Int(0);
}

// Performs spatial refinement
/// See \ref gsXBraid for the documentation
braid_Int Refine(braid_Vector cu, braid_Vector *fu_ptr, BraidCoarsenRefStatus &status) override
{
gsMatrix<T> *cu_ptr = (gsMatrix<T>*) cu;
Expand All @@ -247,7 +307,7 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
*fu_ptr = (braid_Vector) fu;
return braid_Int(0);
}

#endif

// Class members
protected:
Expand All @@ -256,11 +316,6 @@ class gsDynamicXBraid : public gsXBraid< gsMatrix<T> >
index_t m_numDofs;
gsOptionList m_options;
mutable callback_type m_callback;

};

} // namespace gismo

#ifndef GISMO_BUILD_LIB
#include GISMO_HPP_HEADER(gsDynamicImplicitEuler.hpp)
#endif
} // namespace gismo