Skip to content

Commit 51cf777

Browse files
authored
Merge pull request #122 from precice/calculix-adapter-v2.20.1
Release v2.20.1
2 parents 9057470 + a4581fd commit 51cf777

File tree

15 files changed

+458
-543
lines changed

15 files changed

+458
-543
lines changed

.github/workflows/ubuntu_build.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,26 @@ jobs:
1111
include:
1212
- os: ubuntu-20.04
1313
name: focal
14+
flags: -fallow-argument-mismatch
1415
- os: ubuntu-22.04
1516
name: jammy
1617
flags: -fallow-argument-mismatch
1718

1819
runs-on: ${{matrix.os}}
20+
container: precice/precice:develop
1921
continue-on-error: true
2022
env: # Versioning is "calculix-preciceX_2.YY-Z[...]" with X the major preCICE version, YY the minor CCX version and Z the package version
21-
PACKAGE_NAME: "calculix-precice2_2.20.0-1_amd64"
23+
PACKAGE_NAME: "calculix-precice3_2.20.1-1_amd64"
2224

2325
steps:
2426
- name: Update system
25-
run: sudo apt update && sudo apt upgrade -y
27+
run: |
28+
apt-get -qq update
29+
apt-get -qq install sudo
30+
sudo apt update && sudo apt upgrade -y
2631
- uses: actions/checkout@v2
2732
with:
2833
ref: ${{ github.ref }}
29-
- name: Get preCICE v2.4.0
30-
run: wget https://github.com/precice/precice/releases/download/v2.4.0/libprecice2_2.4.0_${{matrix.name}}.deb &&
31-
sudo apt install ./libprecice2_2.4.0_${{matrix.name}}.deb -y
3234
- name: install dependencies
3335
run: sudo apt install libarpack2-dev libspooles-dev libyaml-cpp-dev -y
3436
- name: Download CalculiX
@@ -43,8 +45,8 @@ jobs:
4345
run: sudo apt install lintian pandoc -y
4446
- name: Create Debian Package
4547
run: |
46-
mkdir -p "packaging/calculix-precice2_2.20.0-1_amd64/usr/bin" &&
47-
cp ./bin/ccx_preCICE ./packaging/calculix-precice2_2.20.0-1_amd64/usr/bin/ccx_preCICE &&
48+
mkdir -p "packaging/calculix-precice3_2.20.1-1_amd64/usr/bin" &&
49+
cp ./bin/ccx_preCICE ./packaging/calculix-precice3_2.20.1-1_amd64/usr/bin/ccx_preCICE &&
4850
cd packaging && pwd && bash ./make_deb.sh ${{matrix.name}}
4951
- name: Store Debian package artifact
5052
uses: actions/upload-artifact@v2

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
# Official repo for the clang-format hook
3+
- repo: https://github.com/pre-commit/mirrors-clang-format
4+
rev: 'v8.0.1'
5+
hooks:
6+
- id: clang-format
7+
files: "^adapter"
8+
# Official repo for default hooks
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: 'v4.3.0'
11+
hooks:
12+
- id: check-xml
13+
- id: check-merge-conflict
14+
- id: mixed-line-ending
15+
files: "^(adapter|README.md)"
16+
- id: trailing-whitespace
17+
args: [--markdown-linebreak-ext=md]
18+
files: "^(adapter|README.md)"
19+
- id: end-of-file-fixer
20+
files: "^(adapter|README.md)"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ $(OBJDIR)/%.o : %.c
8484
$(OBJDIR)/%.o : %.f
8585
$(FC) $(FFLAGS) -c $< -o $@
8686
$(OBJDIR)/%.o : adapter/%.c
87-
$(CC) $(CFLAGS) -c $< -o $@
87+
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
8888
$(OBJDIR)/%.o : adapter/%.cpp
89-
g++ -std=c++11 $(YAML_INCLUDE) -c $< -o $@ $(LIBS)
89+
g++ -std=c++11 $(CFLAGS) $(INCLUDES) -c $< -o $@ $(LIBS)
9090
#$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(LIBS)
9191

9292
# Source files in the $(CCX) folder

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ The adapter was initially developed for conjugate heat transfer (CHT) simulation
44

55
The latest version of the adapter is based on **CalculiX version 2.20.**
66
Legacy versions of the adapter for older versions of CalculiX are supported on various branches. Branches for CalculiX version older than 2.15 require **preCICE v1.x**, whereas newer versions rely on **preCICE v2.x**.
7-
7+
88
## Start here
99

10-
Go to the [adapter documentation](https://precice.org/adapter-calculix-overview.html)
10+
Go to the [adapter documentation](https://precice.org/adapter-calculix-overview.html)
1111

1212
## References
1313

1414
[1] Lucia Cheung Yau. Conjugate heat transfer with the multiphysics coupling library precice. Master’s thesis, Department of Informatics, Technical University of Munich, 2016.
1515

16-
[2] Benjamin Uekermann, Hans-Joachim Bungartz, Lucia Cheung Yau, Gerasimos Chourdakis and Alexander Rusch. Official preCICE Adapters for Standard Open-Source Solvers. In Proceedings of the _7th GACM Colloquium on Computational Mechanics for Young Scientists from Academia_, 2017.
16+
[2] Benjamin Uekermann, Hans-Joachim Bungartz, Lucia Cheung Yau, Gerasimos Chourdakis and Alexander Rusch. Official preCICE Adapters for Standard Open-Source Solvers. In Proceedings of the _7th GACM Colloquium on Computational Mechanics for Young Scientists from Academia_, 2017.
1717

1818
## License
1919

adapter/2D3DCoupling.cpp

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <cstdlib>
1414
#include <map>
1515
#include <vector>
16-
#include "precice/SolverInterfaceC.h"
16+
#include "precice/preciceC.h"
1717

1818
namespace MappingHelper {
1919

@@ -55,7 +55,7 @@ static void setDoubleArrayZero(double *values, const int length, const int dim)
5555
}
5656
}
5757

58-
Mapping2D3D *createMapping(const double *nodeCoordinates, int num3Dnodes, int nodesMeshID)
58+
Mapping2D3D *createMapping(const double *nodeCoordinates, int num3Dnodes, char *nodesMeshName)
5959
{
6060

6161
Mapping2D3D *map = (Mapping2D3D *) malloc(sizeof(Mapping2D3D));
@@ -100,7 +100,7 @@ Mapping2D3D *createMapping(const double *nodeCoordinates, int num3Dnodes, int no
100100

101101
// Setup preCICE mesh
102102
map->preciceNodesIDs = (int *) malloc(map->num2DNodes * sizeof(int));
103-
precicec_setMeshVertices(nodesMeshID, map->num2DNodes, map->pos2D, map->preciceNodesIDs);
103+
precicec_setMeshVertices(nodesMeshName, map->num2DNodes, map->pos2D, map->preciceNodesIDs);
104104

105105
// Initialize buffers
106106
map->bufferScalar2D = (double *) malloc(map->num2DNodes * sizeof(double));
@@ -127,25 +127,19 @@ void freeMapping(Mapping2D3D *map)
127127
free(map);
128128
}
129129

130-
void consistentScalarRead(Mapping2D3D *map, int dataID)
130+
void consistentScalarRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt)
131131
{
132-
precicec_readBlockScalarData(dataID,
133-
map->num2DNodes,
134-
map->preciceNodesIDs,
135-
map->bufferScalar2D);
132+
precicec_readData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, dt, map->bufferScalar2D);
136133

137134
// For each 3D point, copy the 2D counterpart
138135
for (int i = 0; i < map->num3DNodes; ++i) {
139136
map->bufferScalar3D[i] = map->bufferScalar2D[map->mapping3D2D[i]];
140137
}
141138
}
142139

143-
void consistentVectorRead(Mapping2D3D *map, int dataID)
140+
void consistentVectorRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt)
144141
{
145-
precicec_readBlockVectorData(dataID,
146-
map->num2DNodes,
147-
map->preciceNodesIDs,
148-
map->bufferVector2D);
142+
precicec_readData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, dt, map->bufferVector2D);
149143

150144
// For each 3D point, copy the 2D counterpart, component-wise
151145
for (int i = 0; i < map->num3DNodes; ++i) {
@@ -154,25 +148,19 @@ void consistentVectorRead(Mapping2D3D *map, int dataID)
154148
}
155149
}
156150

157-
void conservativeScalarRead(Mapping2D3D *map, int dataID)
151+
void conservativeScalarRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt)
158152
{
159-
precicec_readBlockScalarData(dataID,
160-
map->num2DNodes,
161-
map->preciceNodesIDs,
162-
map->bufferScalar2D);
153+
precicec_readData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, dt, map->bufferScalar2D);
163154

164155
// For each 3D point, take a fraction of the value in 2D
165156
for (int i = 0; i < map->num3DNodes; ++i) {
166157
map->bufferScalar3D[i] = map->bufferScalar2D[map->mapping3D2D[i]] / map->numParentNodes[map->mapping3D2D[i]];
167158
}
168159
}
169160

170-
void conservativeVectorRead(Mapping2D3D *map, int dataID)
161+
void conservativeVectorRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt)
171162
{
172-
precicec_readBlockVectorData(dataID,
173-
map->num2DNodes,
174-
map->preciceNodesIDs,
175-
map->bufferVector2D);
163+
precicec_readData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, dt, map->bufferVector2D);
176164

177165
// For each 3D point, take a fraction of the value in 2D
178166
for (int i = 0; i < map->num3DNodes; ++i) {
@@ -181,7 +169,7 @@ void conservativeVectorRead(Mapping2D3D *map, int dataID)
181169
}
182170
}
183171

184-
void consistentScalarWrite(Mapping2D3D *map, int dataID)
172+
void consistentScalarWrite(Mapping2D3D *map, const char *meshName, const char *dataName)
185173
{
186174
// For each 2D point, write the average of the relevant 3D points,
187175
// in two steps: sum then divide
@@ -197,13 +185,10 @@ void consistentScalarWrite(Mapping2D3D *map, int dataID)
197185
map->bufferScalar2D[i2d] /= map->numParentNodes[i2d];
198186
}
199187

200-
precicec_writeBlockScalarData(dataID,
201-
map->num2DNodes,
202-
map->preciceNodesIDs,
203-
map->bufferScalar2D);
188+
precicec_writeData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, map->bufferScalar2D);
204189
}
205190

206-
void consistentVectorWrite(Mapping2D3D *map, int dataID)
191+
void consistentVectorWrite(Mapping2D3D *map, const char *meshName, const char *dataName)
207192
{
208193
// For each 2D point, write the average of the relevant 3D points,
209194
// in two steps: sum then divide
@@ -220,13 +205,10 @@ void consistentVectorWrite(Mapping2D3D *map, int dataID)
220205
map->bufferVector2D[2 * i2d + 1] /= map->numParentNodes[i2d];
221206
}
222207

223-
precicec_writeBlockVectorData(dataID,
224-
map->num2DNodes,
225-
map->preciceNodesIDs,
226-
map->bufferVector2D);
208+
precicec_writeData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, map->bufferVector2D);
227209
}
228210

229-
void conservativeScalarWrite(Mapping2D3D *map, int dataID)
211+
void conservativeScalarWrite(Mapping2D3D *map, const char *meshName, const char *dataName)
230212
{
231213
// For each 2D point, write the sum of the relevant 3D points,
232214
setDoubleArrayZero(map->bufferScalar2D, map->num2DNodes, 1);
@@ -237,13 +219,10 @@ void conservativeScalarWrite(Mapping2D3D *map, int dataID)
237219
map->bufferScalar2D[map->mapping3D2D[i]] += map->bufferScalar3D[i];
238220
}
239221

240-
precicec_writeBlockScalarData(dataID,
241-
map->num2DNodes,
242-
map->preciceNodesIDs,
243-
map->bufferScalar2D);
222+
precicec_writeData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, map->bufferScalar2D);
244223
}
245224

246-
void consservativeVectorWrite(Mapping2D3D *map, int dataID)
225+
void conservativeVectorWrite(Mapping2D3D *map, const char *meshName, const char *dataName)
247226
{
248227
// For each 2D point, write the sum of the relevant 3D points,
249228
setDoubleArrayZero(map->bufferVector2D, map->num2DNodes, 2);
@@ -254,8 +233,5 @@ void consservativeVectorWrite(Mapping2D3D *map, int dataID)
254233
map->bufferVector2D[2 * map->mapping3D2D[i] + 1] += map->bufferVector3D[3 * i + 1];
255234
}
256235

257-
precicec_writeBlockVectorData(dataID,
258-
map->num2DNodes,
259-
map->preciceNodesIDs,
260-
map->bufferVector2D);
236+
precicec_writeData(meshName, dataName, map->num2DNodes, map->preciceNodesIDs, map->bufferVector2D);
261237
}

adapter/2D3DCoupling.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ typedef struct {
3333

3434
} Mapping2D3D;
3535

36-
Mapping2D3D *createMapping(const double *nodeCoordinates, int num3Dnodes, int nodesMeshID);
36+
Mapping2D3D *createMapping(const double *nodeCoordinates, int num3Dnodes, char *nodesMeshName);
3737
void freeMapping(Mapping2D3D *);
38-
void consistentScalarRead(Mapping2D3D *map, int dataID);
39-
void consistentVectorRead(Mapping2D3D *map, int dataID);
40-
void conservativeScalarRead(Mapping2D3D *map, int dataID);
41-
void conservativeVectorRead(Mapping2D3D *map, int dataID);
42-
void consistentScalarWrite(Mapping2D3D *map, int dataID);
43-
void consistentVectorWrite(Mapping2D3D *map, int dataID);
44-
void conservativeScalarWrite(Mapping2D3D *map, int dataID);
45-
void conservativeVectorWrite(Mapping2D3D *map, int dataID);
38+
void consistentScalarRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt);
39+
void consistentVectorRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt);
40+
void conservativeScalarRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt);
41+
void conservativeVectorRead(Mapping2D3D *map, const char *meshName, const char *dataName, const double dt);
42+
void consistentScalarWrite(Mapping2D3D *map, const char *meshName, const char *dataName);
43+
void consistentVectorWrite(Mapping2D3D *map, const char *meshName, const char *dataName);
44+
void conservativeScalarWrite(Mapping2D3D *map, const char *meshName, const char *dataName);
45+
void conservativeVectorWrite(Mapping2D3D *map, const char *meshName, const char *dataName);
4646

4747
#endif

adapter/OutputBuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ void BufferClear(outputBuffer *buffer)
9191
unsigned BufferStoredStates(outputBuffer *buffer)
9292
{
9393
return buffer->states.size();
94-
}
94+
}

0 commit comments

Comments
 (0)