Skip to content

Commit 11a9f79

Browse files
authored
Merge pull request #6 from precice/develop
Update adapter.py conform preCICE v2.0 and Code_Aster v14.4
2 parents 9b0ac3e + 5d640f0 commit 11a9f79

File tree

3 files changed

+294
-305
lines changed

3 files changed

+294
-305
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# preCICE-adapter for the CSM code Code_Aster
22

3-
This adapter was implemented as part of the [master thesis of Lucia Cheung](https://www5.in.tum.de/pub/Cheung2016_Thesis.pdf) in cooperation with [SimScale](https://www.simscale.com/). Currently only conjugate heat transfer is supported.
3+
This adapter was implemented as part of the [master thesis of Lucia Cheung](https://www5.in.tum.de/pub/Cheung2016_Thesis.pdf) in cooperation with [SimScale](https://www.simscale.com/). Currently only conjugate heat transfer is supported.
44

5-
A documentation is available in the `cht` subfolder.
5+
The adapter currently supports preCICE v1.4.1 and Code_Aster v14.4. The following tutorials are available.
6+
7+
* Flow over plate OpenFoam-Code_Aster ([wiki](https://github.com/precice/code_aster-adapter/wiki/Flow-over-plate-Code_Aster-Tutorial))
8+
9+
A documentation is available in the `cht` subfolder, and in the [wiki](https://github.com/precice/code_aster-adapter/wiki).

cht/adapter.comm

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ from adapter import *
1010
# Note: In the OpenFOAM and CalculiX adapters, this is read from a command line argument (--precice-participant),
1111
# but I don't know how to pass my own argument to as_run
1212
participantName = os.environ["PRECICE_PARTICIPANT"]
13+
tutorial_root = os.environ["TUTORIAL_ROOT"]
1314

1415
# ==========================================================================================
1516
# Include file in UNITE 90: PreCICE setup (config.comm)
@@ -33,7 +34,7 @@ isSteadyState = ("steady-state" in settings["simulation"]) and (settings["simula
3334
# Include case definition.comm.
3435
# Defines: MESH, MODEL, BC[], MAT[], MATS
3536
INCLUDE(UNITE=91)
36-
37+
3738
# ==========================================================================================
3839
# Create and initialize the adapter
3940
# ==========================================================================================
@@ -62,13 +63,13 @@ while adapter.isCouplingOngoing():
6263

6364
adapter.writeCheckpoint()
6465
adapter.readCouplingData()
65-
66+
6667
# ======================================================================================
6768
# Solve
6869
# ======================================================================================
69-
70+
7071
if isSteadyState:
71-
72+
7273
if participant["non-linear"]:
7374
TEMP = THER_NON_LINE(
7475
MODELE=MODEL,
@@ -92,12 +93,12 @@ while adapter.isCouplingOngoing():
9293
)
9394

9495
else:
95-
96+
9697
STEP = DEFI_LIST_REEL(
9798
DEBUT=time,
9899
INTERVALLE=(_F(JUSQU_A=time+dt, NOMBRE=1))
99100
)
100-
101+
101102
if participant["non-linear"]:
102103
TEMP = THER_NON_LINE(
103104
MODELE=MODEL,
@@ -134,11 +135,10 @@ while adapter.isCouplingOngoing():
134135
# Output if necessary
135136
k += 1
136137
if k % settings["simulation"]["output-frequency"] == 0:
137-
filename = "output-" + str(k) + ".rmed"
138-
DEFI_FICHIER(FICHIER=filename, UNITE=80)
139-
IMPR_RESU(FORMAT='MED', RESU=_F(RESULTAT=TEMP))
140-
call(["mv", filename, settings["base-path"] + "/" + participant["directory"]])
141-
DEFI_FICHIER(ACTION='LIBERER', UNITE=80)
138+
filename = "REPE_OUT/output-" + str(k) + ".rmed"
139+
DEFI_FICHIER(FICHIER=filename, UNITE=80+k, TYPE='BINARY')
140+
IMPR_RESU(FORMAT='MED', UNITE=80+k, RESU=_F(RESULTAT=TEMP))
141+
DEFI_FICHIER(ACTION='LIBERER', UNITE=80+k)
142142

143143
# Use current solution as initial condition for the next time step
144144
if time > 0:
@@ -153,7 +153,7 @@ while adapter.isCouplingOngoing():
153153

154154
DETRUIRE(CONCEPT=_F(NOM=TEMP))
155155
DETRUIRE(CONCEPT=_F(NOM=T))
156-
156+
157157
if not isSteadyState:
158158
DETRUIRE(CONCEPT=_F(NOM=STEP))
159159

0 commit comments

Comments
 (0)