Skip to content

Add functionality for volumetric multiscale coupling to micro-mechanics simulations #135

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

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
dc01332
Updates for macro-micro call
kalupaika Jan 17, 2024
6ce3ef1
Merge branch 'develop' into multiscale-update
IshaanDesai Apr 1, 2024
7e1c1b7
Reintroduce parts that seemed to be deleted unintentionally
IshaanDesai Apr 1, 2024
342df26
Formatting
IshaanDesai Apr 1, 2024
8521dfe
Merge branch 'precice:develop' into multiscale-update
kalupaika Apr 10, 2024
c70bb78
volumetric coupling update
kalupaika Apr 17, 2024
32fc350
Revert .gitignore because make clean takes care of it, and move examp…
IshaanDesai Jul 11, 2024
33d08a6
Revert to CalculiX 2.20, because the adapter only works with this ver…
IshaanDesai Jul 11, 2024
355cdd4
Revert CalculiX header file to 2.20
IshaanDesai Jul 11, 2024
f23833d
Remove unnecessary files which resulted from duplication
IshaanDesai Jul 11, 2024
6329a47
Revert files which only had size change
IshaanDesai Jul 11, 2024
a9a0127
Adding necessary definitions in Fortran part, and code formatting
IshaanDesai Jul 12, 2024
54bf8cb
Formatting .c files
IshaanDesai Jul 12, 2024
fcf72c9
Put old things back into CCXHelpers.c
IshaanDesai Aug 7, 2024
b932313
Compile with nonlingeo_precice.c and formatting
IshaanDesai Aug 7, 2024
1c3febc
Revert nonlingeo_precice.c to old state
IshaanDesai Aug 7, 2024
cde18e9
Re-add functions which read and write modal checkpoints
IshaanDesai Aug 7, 2024
0c32ca5
Apply clang-format to linstatic_precice.c
IshaanDesai Aug 7, 2024
cef5846
Revert Makefile to older state
IshaanDesai Aug 7, 2024
9552f6a
First compiling version
IshaanDesai Aug 8, 2024
06be8bb
Add call to linstatic_precice to ccx_2.20.c
IshaanDesai Aug 8, 2024
c3c8b46
Add functionality to write variables rve_id, mod_id, and ruc_size to …
IshaanDesai Aug 14, 2024
a56a7cf
Handle pointers to strain and stress data consistently in the linear …
IshaanDesai Aug 15, 2024
38fa1b8
Trying to get gauss point coorindates from the FORTRAN side
IshaanDesai Aug 19, 2024
7dc1468
Working version of the subroutine getelementgausspointcoords.f and re…
IshaanDesai Aug 22, 2024
b36a968
Working version for a linear static problem
IshaanDesai Nov 5, 2024
bfc0f58
Remove debugging print statements
IshaanDesai Nov 6, 2024
3755875
Revert to older clang-format to test things
IshaanDesai Nov 6, 2024
fdf8be0
Remove print statement at the end of freeing data, and formatting
IshaanDesai Nov 6, 2024
020c9d0
Merge branch 'develop' into multiscale-update
IshaanDesai Nov 7, 2024
55319c3
Merge branch 'develop' into multiscale-update
IshaanDesai Nov 7, 2024
9b7bdb4
Fix error in getting Gauss point coordinates for C3D8 elements
IshaanDesai Nov 18, 2024
afde186
Remove old 2D-3D mapping functions that were added by mistake
IshaanDesai Nov 18, 2024
af14bb4
Cleaning up functions which may have been remnants of resolving merge…
IshaanDesai Nov 18, 2024
6aa96aa
Further reverting of unnecesarily pushed changes
IshaanDesai Nov 18, 2024
1229dea
Add the file getgausspointscoords.f again
IshaanDesai Nov 18, 2024
49f880b
Adding back functions which were deleted unintentionally
IshaanDesai Nov 18, 2024
a5d92b8
Revert more inadvertantly done changes
IshaanDesai Nov 18, 2024
3784b38
Reverting some unnuecessary changes in the preCICE Interface functions
IshaanDesai Nov 18, 2024
6e405ea
Remove print statements for debugging
IshaanDesai Nov 19, 2024
69bbeb0
Merge branch 'develop' into multiscale-update
IshaanDesai Nov 19, 2024
65cf38b
Revert changes to Makefile
IshaanDesai Feb 17, 2025
8018a03
Refactor and clean up functionality to get strains from CalculiX
IshaanDesai Feb 17, 2025
1a46209
Remove the file getstrain.f as the subroutine in it is not used
IshaanDesai Feb 17, 2025
8b9de3b
Remove duplicate helper function
IshaanDesai Feb 17, 2025
ee111d7
Reinstate Elemtype
IshaanDesai Feb 17, 2025
e72c59c
Merge branch 'develop' into multiscale-update
IshaanDesai Feb 18, 2025
cef7a03
Remove NASMAT specific variable from the reading and writing function…
IshaanDesai Mar 20, 2025
e3ca91a
Reverting changes that are added inadvertently
IshaanDesai Mar 20, 2025
5531833
Reinstating some of the variables and functions which were inadverten…
IshaanDesai Mar 21, 2025
d5674d3
Reverting unintended changes
IshaanDesai Mar 21, 2025
ef54706
Revert more unnecessarily made changes
IshaanDesai Mar 21, 2025
9277fe1
Reverting more changes
IshaanDesai Mar 21, 2025
8842923
Revert changes to fix function headers
IshaanDesai Mar 21, 2025
d21da28
Removing variables that are not used
IshaanDesai Mar 21, 2025
d846919
Merge branch 'develop' into multiscale-mech
IshaanDesai Mar 21, 2025
5c2c66c
Use correct naming terminology for subroutine to set stress tensor
IshaanDesai Mar 21, 2025
1df5061
Move functionality to set stiffness matrix and stress tensor values i…
IshaanDesai Mar 23, 2025
31d9552
Use singular form for the word Element in function names, to make the…
IshaanDesai Mar 24, 2025
2b679fe
Use appropriate functionality to identify element type for element me…
IshaanDesai Mar 25, 2025
85a265f
Rework Gauss points coord loop for C3D4 and C3D8 elements
IshaanDesai Mar 26, 2025
3278c16
FIRST WORKING VERSION with C3D4 elements and a 3D notch geometry
IshaanDesai Mar 28, 2025
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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ else
CC = mpicc
endif

FFLAGS = -Wall -O3 -fopenmp $(INCLUDES) ${ADDITIONAL_FFLAGS}
FFLAGS = -Wall -O3 -fopenmp -fallow-argument-mismatch $(INCLUDES) ${ADDITIONAL_FFLAGS}
# Note for GCC 10 or newer: add -fallow-argument-mismatch in the above flags
FC = mpifort
# FC = mpif90
Expand All @@ -73,8 +73,8 @@ include $(CCX)/Makefile.inc
SCCXMAIN = ccx_$(CCX_VERSION).c

# Append additional sources
SCCXC += nonlingeo_precice.c dyna_precice.c CCXHelpers.c PreciceInterface.c
SCCXF += getflux.f getkdeltatemp.f
SCCXC += nonlingeo_precice.c dyna_precice.c CCXHelpers.c PreciceInterface.c linstatic_precice.c
SCCXF += getflux.f getkdeltatemp.f getc3d8elementgausspointcoords.f getc3d4elementgausspointcoords.f



Expand Down
47 changes: 47 additions & 0 deletions adapter/CCXHelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ void getSurfaceElementsAndFaces(ITG setID, ITG *ialset, ITG *istartset, ITG *ien
}
}

void getElementsIDs(ITG setID, ITG *ialset, ITG *istartset, ITG *iendset, ITG *elements)
{

ITG i, k = 0;

for (i = istartset[setID] - 1; i < iendset[setID]; i++) {
elements[k] = ialset[i];
k++;
}
}

void getNodeCoordinates(ITG *nodes, ITG numNodes, int dim, double *co, double *v, int mt, double *coordinates)
{

Expand Down Expand Up @@ -409,6 +420,18 @@ int getXloadIndexOffset(enum xloadVariable xloadVar)
}
}

void getElementStrain(int strainIdx, int numIPTotal, double *eei, double *strainData)
{
int i, idx;
// Loop through all element and respective gauss points
for (i = 0; i < numIPTotal; i++) {
idx = i * 6 + strainIdx; //TODO: Add explanation for 6
strainData[i * 3] = eei[idx];
strainData[i * 3 + 1] = eei[idx + 1];
strainData[i * 3 + 2] = eei[idx + 2];
}
}

void setXload(double *xload, int *xloadIndices, double *values, int numValues, enum xloadVariable xloadVar)
{
ITG i;
Expand Down Expand Up @@ -470,6 +493,30 @@ void setNodeDisplacements(double *displacements, ITG numNodes, int dim, int *xbo
}
}

void setElementStiffness(int stiffnessIdx, int numIPTotal, double *stiffnessData, double *xstiff)
{
int i, idx;
// Loop through all element and respective gauss points
for (i = 0; i < numIPTotal; i++) {
idx = i * 27 + stiffnessIdx; //TODO: Add explanation for 27
xstiff[idx] = stiffnessData[i * 3];
xstiff[idx + 1] = stiffnessData[i * 3 + 1];
xstiff[idx + 2] = stiffnessData[i * 3 + 2];
}
}

void setElementStress(int stressIdx, int numIPTotal, double *stressData, double *stx)
{
int i, idx;
// Loop through all element and respective gauss points
for (i = 0; i < numIPTotal; i++) {
idx = i * 6 + stressIdx; //TODO: Add explanation for 6
stx[idx] = stressData[i * 3];
stx[idx + 1] = stressData[i * 3 + 1];
stx[idx + 2] = stressData[i * 3 + 2];
}
}

bool isSteadyStateSimulation(ITG *nmethod)
{
return *nmethod == 1;
Expand Down
44 changes: 43 additions & 1 deletion adapter/CCXHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ enum CouplingDataType { TEMPERATURE,
DISPLACEMENTS,
DISPLACEMENTDELTAS,
VELOCITIES,
POSITIONS };
POSITIONS,
STRAIN1TO3,
STRAIN4TO6,
STRESS1TO3,
STRESS4TO6,
CMAT1,
CMAT2,
CMAT3,
CMAT4,
CMAT5,
CMAT6,
CMAT7 };

/**
* @brief Type of element used for faces mesh, where we assume only one type of element is used.
Expand Down Expand Up @@ -102,6 +113,16 @@ ITG getNumSetElements(ITG setID, ITG *istartset, ITG *iendset);
*/
void getSurfaceElementsAndFaces(ITG setID, ITG *ialset, ITG *istartset, ITG *iendset, ITG *elements, ITG *faces);

/**
* @brief Gets the element IDs given a set ID
* @param setID: input set id
* @param ialset: CalculiX variable
* @param istartset: CalculiX variable
* @param iendset: CalculiX variable
* @param elements: output element IDs
*/
void getElementsIDs(ITG setID, ITG *ialset, ITG *istartset, ITG *iendset, ITG *elements);

/**
* @brief Gets the coordinates of a list of input node IDs
* @param nodes: input node IDs
Expand Down Expand Up @@ -241,6 +262,15 @@ void getXbounIndices(ITG *nodes, ITG numNodes, int nboun, int *ikboun, int *ilbo
*/
void getXforcIndices(ITG *nodes, ITG numNodes, int nforc, int *ikforc, int *ilforc, int *xforcIndices);

/**
* @brief Gets the strain values at each Gauss point of each element
* @param strainIdx: CalculiX variable for the index of the strain values
* @param numIPTotal: CalculiX variable for the number of elements
* @param eei: CalculiX array for the element integration information
* @param strainData: CalculiX array for the strain values
*/
void getElementStrain(int strainIdx, int numIPTotal, double *eei, double *strainData);

/**
* @brief Modifies the values of a DFLUX or FILM boundary condition
* @param xload: CalculiX array for the loads
Expand Down Expand Up @@ -317,6 +347,18 @@ void setNodeForces(double *forces, ITG numNodes, int dim, int *xforcIndices, dou
*/
void setNodeDisplacements(double *displacements, ITG numNodes, int dim, int *xbounIndices, double *xboun);

/**
* @brief Modifies the values of stress of the elements at the interface
* @param TODO
*/
void setElementStiffness(int stiffnessIdx, int numIPTotal, double *stiffnessData, double *xstiff);

/**
* @brief Modifies the values of stress of the elements at the interface
* @param TODO
*/
void setElementStress(int stressIdx, int numIPTotal, double *stressData, double *stx);

/**
* @brief Returns whether it is a steady-state simulation based on the value of nmethod
* @param nmethod: CalculiX variable with information regarding the type of analysis
Expand Down
4 changes: 4 additions & 0 deletions adapter/ConfigReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ void ConfigReader_Read(char const *configFilename, char const *participantName,
interface.facesMeshName = strdup(config["participants"][participantName]["interfaces"][i]["mesh"].as<std::string>().c_str());
}

if (config["participants"][participantName]["interfaces"][i]["elements"]) {
interface.elementsMeshName = strdup(config["participants"][participantName]["interfaces"][i]["elements"].as<std::string>().c_str());
}

std::string patchName = config["participants"][participantName]["interfaces"][i]["patch"].as<std::string>();
std::transform(patchName.begin(), patchName.end(), patchName.begin(), toupper);
interface.patchName = strdup(patchName.c_str());
Expand Down
1 change: 1 addition & 0 deletions adapter/ConfigReader.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
typedef struct InterfaceConfig {
char * facesMeshName;
char * nodesMeshName;
char * elementsMeshName;
char * patchName;
int map;
int numWriteData;
Expand Down
Loading