Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
01279f6
Move fcType to separate header and source files
michelebucelli Jun 24, 2026
0fb860b
Move evaluation of inverse Fourier transform to fcType methods
michelebucelli Jun 26, 2026
ba5234c
Distribution of fcType members encapsulated in fcType::distribute
michelebucelli Jun 26, 2026
6f460ab
Introduce getter method fcType::dimension
michelebucelli Jun 26, 2026
bc6813c
Move fft into fcType, and cleaner separation of fcType input from fil…
michelebucelli Jun 26, 2026
4740316
Make data members of fcType private
michelebucelli Jun 26, 2026
a371f0a
Add cmType::bcast overload for unsigned integers
michelebucelli Jun 26, 2026
e3f4436
Rename fcType to FourierInterpolation, and rename its data members fo…
michelebucelli Jun 26, 2026
03c2247
Update and expand documentation of FourierInterpolation
michelebucelli Jun 28, 2026
1dfbc49
Use exceptions for correctness checks in FourierInterpolation
michelebucelli Jun 28, 2026
219380e
Fix documentation and remove todo comment
michelebucelli Jun 28, 2026
5097084
Expand comment
michelebucelli Jun 28, 2026
f75f325
Replace leftover throw with svmp::raise in FourierInterpolation
michelebucelli Jun 29, 2026
8c53818
Remove duplicate unused file test_fft.h
michelebucelli Jun 29, 2026
44a3f77
Fix typo in documentation
michelebucelli Jun 29, 2026
8d5ec8d
Update and expand unit tests for Fourier interpolation
michelebucelli Jun 29, 2026
31262f0
Miscellaneous cleanup of FourierInterpolation
michelebucelli Jun 29, 2026
ae0d17d
Add correctness checks to FourierInterpolation::from_fourier_coeffici…
michelebucelli Jun 29, 2026
1bbbef1
Change for loop counter to unsigned int
michelebucelli Jun 29, 2026
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
3 changes: 2 additions & 1 deletion Code/Source/solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ set(CSRCS
PetscLinearAlgebra.h PetscLinearAlgebra.cpp
TrilinosLinearAlgebra.h TrilinosLinearAlgebra.cpp
Tensor4.h Tensor4.cpp
Vector.h Vector.cpp
Vector.h Vector.cpp
fourier_interpolation.cpp

lapack_defs.h

Expand Down
5 changes: 5 additions & 0 deletions Code/Source/solver/CmMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ void cmType::bcast(const CmMod& cm_mod, Vector<int>& data) const
MPI_Bcast(data.data(), data.size(), cm_mod::mpint, cm_mod.master, com());
}

/// @brief bcast unsigned int
void cmType::bcast(const CmMod &cm_mod, unsigned int *data) const {
MPI_Bcast(data, 1, cm_mod::mpuint, cm_mod.master, com());
}

/// @brief gather int array
void cmType::gather(const CmMod& cm_mod, const int* send_data, int send_count, int* recv_data, int recv_count, int root) const
{
Expand Down
3 changes: 3 additions & 0 deletions Code/Source/solver/CmMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ using MpiCommWorldType = MPI_Comm;
const decltype(MPI_CXX_BOOL) mplog = MPI_CXX_BOOL;
//const decltype(MPI_LOGICAL) mplog = MPI_LOGICAL;
const decltype(MPI_INTEGER) mpint = MPI_INTEGER;
const decltype(MPI_UNSIGNED) mpuint = MPI_UNSIGNED;
const decltype(MPI_DOUBLE_PRECISION) mpreal = MPI_DOUBLE_PRECISION;
const decltype(MPI_CHARACTER) mpchar = MPI_CHARACTER;
};
Expand Down Expand Up @@ -83,6 +84,8 @@ class cmType {
void bcast(const CmMod& cm_mod, int* data) const;
void bcast(const CmMod& cm_mod, Vector<int>& data) const;

void bcast(const CmMod &cm_mod, unsigned int *data) const;

void bcast(const CmMod& cm_mod, Array<int>& data, const std::string& name="") const;

// Gather operations
Expand Down
49 changes: 7 additions & 42 deletions Code/Source/solver/ComMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
// are defined here.

#ifndef COMMOD_H
#define COMMOD_H
#define COMMOD_H

#include "Array.h"
#include "Array3.h"
#include "SolutionStates.h"
#include "CepMod.h"
#include "ChnlMod.h"
#include "CmMod.h"
#include "CoupledBoundaryCondition.h"
#include "Parameters.h"
#include "RobinBoundaryCondition.h"
#include "CoupledBoundaryCondition.h"
#include "SolutionStates.h"
#include "Timer.h"
#include "Vector.h"
#include "fourier_interpolation.h"

#include "DebugMsg.h"

Expand All @@ -43,42 +44,6 @@

class LinearAlgebra;

/// @brief Fourier coefficients that are used to specify unsteady BCs
//
class fcType
{
public:

bool defined() { return n != 0; };

// If this is a ramp function
bool lrmp = false;

// Number of Fourier coefficient
int n = 0;

// No. of dimensions (scalar or vector)
int d = 0;

// Initial value
Vector<double> qi;

// Time derivative of linear part
Vector<double> qs;

// Period
double T = 0.0;

// Initial time
double ti = 0.0;

// Imaginary part of coefficint
Array<double> i;

// Real part of coefficint
Array<double> r;
};

/// @brief Moving boundary data structure (used for general BC)
//
class MBType
Expand Down Expand Up @@ -194,7 +159,7 @@ class bcType
//
// This is declare ALLOCATABLE in MOD.f.
//
fcType gt;
FourierInterpolation gt;

// Neu: RCR
rcrType RCR;
Expand Down Expand Up @@ -306,7 +271,7 @@ class bfType
Array<double> bx;

// Time dependant (unsteady imposed value)
fcType bt;
FourierInterpolation bt;

// General (unsteady and spatially dependent combination)
MBType bm;
Expand Down Expand Up @@ -334,7 +299,7 @@ class fibStrsType
double eta_n = 0.0;

// Unsteady time-dependent values
fcType gt;
FourierInterpolation gt;
};

/// @brief Structural domain type
Expand Down
17 changes: 17 additions & 0 deletions Code/Source/solver/Core/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,23 @@ class DependencyException : public CoreException {
}
};

class FileNotFoundException : public CoreException {
public:
FileNotFoundException(const std::string &file_name, const char *file = "",
int line = 0, const char *function = "")
: CoreException("Could not open file " + file_name, StatusCode::IOError,
file, line, function) {}
};

class FileFormatException : public CoreException {
public:
FileFormatException(const std::string &file_name, const std::string &message,
const char *file = "", int line = 0,
const char *function = "")
: CoreException("Error parsing file " + file_name + ". " + message,
StatusCode::IOError, file, line, function) {}
};

inline void ExceptionRuntime::install_terminate_handler()
{
std::set_terminate([]() {
Expand Down
3 changes: 1 addition & 2 deletions Code/Source/solver/bf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ void set_bf_l(ComMod& com_mod, bfType& lBf, mshType& lM, const SolutionStates& s
f = lBf.b;

} else if (utils::btest(lBf.bType, enum_int(BodyForceType::bfType_ustd))) {
Vector<double> rtmp(1);
ifft(com_mod, lBf.bt, f, rtmp);
f = lBf.bt.value(com_mod.time);

} else if (utils::btest(lBf.bType, enum_int(BodyForceType::bfType_gen))) {
bfl.resize(idof,nNo);
Expand Down
85 changes: 4 additions & 81 deletions Code/Source/solver/distribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,44 +644,10 @@ void dist_bc(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, bcType& lBc
}

// Communicating time-dependent BC data
//
// lBc.gt is declare ALLOCATABLE in MOD.f but we don't
// want to use pointers so use the define() method
// to check if it has data define.
//
bool flag = lBc.gt.defined();
cm.bcast(cm_mod, &flag);

if (flag) {
if (is_slave) {
// [NOTE] This is allocated in ComMod.
//lBc.gt = new fcType;
}

cm.bcast(cm_mod, &lBc.gt.lrmp);
cm.bcast(cm_mod, &lBc.gt.d);
cm.bcast(cm_mod, &lBc.gt.n);

int j = lBc.gt.d;
int i = lBc.gt.n;

if (is_slave) {
lBc.gt.qi.resize(j);
lBc.gt.qs.resize(j);
lBc.gt.r.resize(j,i);
lBc.gt.i.resize(j,i);
}

cm.bcast(cm_mod, &lBc.gt.ti);
cm.bcast(cm_mod, &lBc.gt.T);
cm.bcast(cm_mod, lBc.gt.qi);
cm.bcast(cm_mod, lBc.gt.qs);
cm.bcast(cm_mod, lBc.gt.r);
cm.bcast(cm_mod, lBc.gt.i);
}
lBc.gt.distribute(cm_mod, cm);

// Communicating moving BC data
flag = lBc.gm.defined();
bool flag = lBc.gm.defined();
cm.bcast(cm_mod, &flag);

if (flag) {
Expand Down Expand Up @@ -917,31 +883,7 @@ void dist_bf(ComMod& com_mod, const CmMod& cm_mod, const cmType& cm, bfType& lBf
}

// Communicating time-dependent BF data
flag = lBf.bt.defined();
cm.bcast(cm_mod, &flag);
if (flag) {
if (is_slave) {
//ALLOCATE(lBf.bt)
}
cm.bcast(cm_mod, &lBf.bt.lrmp);
cm.bcast(cm_mod, &lBf.bt.d);
cm.bcast(cm_mod, &lBf.bt.n);

if (is_slave) {
int j = lBf.bt.d;
int i = lBf.bt.n;
lBf.bt.qi.resize(j);
lBf.bt.qs.resize(j);
lBf.bt.r.resize(j,i);
lBf.bt.i.resize(j,i);
}
cm.bcast(cm_mod, &lBf.bt.ti);
cm.bcast(cm_mod, &lBf.bt.T);
cm.bcast(cm_mod, lBf.bt.qi);
cm.bcast(cm_mod, lBf.bt.qs);
cm.bcast(cm_mod, lBf.bt.r);
cm.bcast(cm_mod, lBf.bt.i);
}
lBf.bt.distribute(cm_mod, cm);

// Communicating moving BF data
//
Expand Down Expand Up @@ -1731,26 +1673,7 @@ void dist_mat_consts(const ComMod& com_mod, const CmMod& cm_mod, const cmType& c
cm.bcast(cm_mod, &lStM.Tf.g);

} else if (utils::btest(lStM.Tf.fType, static_cast<int>(BoundaryConditionType::bType_ustd))) {
cm.bcast(cm_mod, &lStM.Tf.gt.lrmp);
cm.bcast(cm_mod, &lStM.Tf.gt.d);
cm.bcast(cm_mod, &lStM.Tf.gt.n);

if (cm.slv(cm_mod)) {
int j = lStM.Tf.gt.d;
int i = lStM.Tf.gt.n;
lStM.Tf.gt.qi.resize(j);
lStM.Tf.gt.qs.resize(j);
lStM.Tf.gt.r.resize(j,i);
lStM.Tf.gt.i.resize(j,i);
}

cm.bcast(cm_mod, &lStM.Tf.gt.ti);
cm.bcast(cm_mod, &lStM.Tf.gt.T);

cm.bcast(cm_mod, lStM.Tf.gt.qi, "lStM.Tf.gt.qi");
cm.bcast(cm_mod, lStM.Tf.gt.qs, "lStM.Tf.gt.qs");
cm.bcast(cm_mod, lStM.Tf.gt.r, "lStM.Tf.gt.r");
cm.bcast(cm_mod, lStM.Tf.gt.i, "lStM.Tf.gt.i");
lStM.Tf.gt.distribute(cm_mod, cm);
}

// Broadcast directional stress distribution parameters
Expand Down
Loading
Loading