Skip to content
Merged
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
12 changes: 6 additions & 6 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/checkout@v6

- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.9.3
uses: prefix-dev/setup-pixi@v0.9.4
with:
environments: dashboard

Expand All @@ -46,17 +46,17 @@ jobs:
cmake --version
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..

- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CMakeCache
path: ${{ env.FANS_BUILD_DIR }}/CMakeCache.txt
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CMakeLogs
path: '${{ env.FANS_BUILD_DIR }}/CMakeFiles/*.log'
- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CompileCommands
Expand All @@ -75,7 +75,7 @@ jobs:
run: |
su -c "ctest" ${{ env.FANS_MPI_USER }}

- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} CTest logs
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Run pytest checks on HDF5 output
run: pixi run -e dashboard pytest

- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} PyTest logs
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ jobs:
uses: actions/checkout@v6

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4

- name: Login to DockerHub
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push fans-ci image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: ${{ github.workspace }}
file: docker/Dockerfile
Expand All @@ -42,7 +42,7 @@ jobs:
build-args: UBUNTU_VERSION=${{ matrix.ubuntu-version }}

- name: Build and push fans-dev image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v7
with:
context: ${{ github.workspace }}
file: docker/Dockerfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pixi_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ jobs:
uses: actions/checkout@v6

- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.9.3
uses: prefix-dev/setup-pixi@v0.9.4
with:
environments: default

- name: Run pytest checks on HDF5 output
run: pixi run test

- name: Upload test logs
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.os }} test-logs
path: test/output/*.log

- uses: actions/upload-artifact@v5
- uses: actions/upload-artifact@v7
if: failure()
with:
name: ${{ matrix.os }} PyTest logs
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# FANS Changelog

## v0.6.2

- Fix bug demanding a leading slash in the datasetname and exiting ungracefully [#123](https://github.com/DataAnalyticsEngineering/FANS/pull/123)

## v0.6.1

- Adds support to write integration point data to disk [#117](https://github.com/DataAnalyticsEngineering/FANS/pull/117)
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.21)
# ##############################################################################

project(FANS
VERSION 0.6.1
VERSION 0.6.2
LANGUAGES C CXX
)

Expand Down
3 changes: 3 additions & 0 deletions include/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class Reader {
json materialProperties;
double TOL;
json errorParameters;
int ls_max_iter{5};
double ls_tol{1e-2};
bool extrapolate_displacement{true};
json microstructure;
int n_it;
vector<LoadCase> load_cases;
Expand Down
1 change: 0 additions & 1 deletion include/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ void Solver<howmany, n_str>::postprocess(Reader &reader, int load_idx, int time_
}
reader.writeData("homogenized_tangent", load_idx, time_idx, homogenized_tangent.data(), dims, 2);
}
extrapolateDisplacement(); // prepare v_u for next time step
}

template <int howmany, int n_str>
Expand Down
53 changes: 33 additions & 20 deletions include/solverCG.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SolverCG : public Solver<howmany, n_str> {
RealArray s_real;
RealArray d_real;
RealArray rnew_real;
double alpha_warm{0.1};

void internalSolve();
void LineSearchSecant();
Expand Down Expand Up @@ -64,6 +65,7 @@ void SolverCG<howmany, n_str>::internalSolve()
printf("\n# Start FANS - Conjugate Gradient Solver \n");

bool islinear = this->matmanager->all_linear;
alpha_warm = 0.1;

s_real.setZero();
d_real.setZero();
Expand Down Expand Up @@ -117,33 +119,44 @@ void SolverCG<howmany, n_str>::internalSolve()
template <int howmany, int n_str>
void SolverCG<howmany, n_str>::LineSearchSecant()
{
double err = 10.0;
int MaxIter = 5;
double tol = 1e-2;
int _iter = 0;
double alpha_new = 0.0001;
double alpha_old = 0;

double r1pd;
double rpd = dotProduct(v_r_real, d_real);
double err = 10.0;
const int MaxIter = this->reader.ls_max_iter;
const double tol = this->reader.ls_tol;
int _iter = 0;
double alpha_prev = 0.0;
double alpha_curr = alpha_warm;

while (((_iter < MaxIter) && (err > tol))) {
double rpd = dotProduct(v_r_real, d_real);
v_u_real += d_real * alpha_curr;
this->updateMixedBC();
this->template compute_residual<0>(rnew_real, v_u_real);
double r1pd = dotProduct(rnew_real, d_real);

double denom, alpha_next;
while (_iter < MaxIter && err > tol) {
denom = r1pd - rpd;
if (fabs(denom) < 1e-14 * (fabs(r1pd) + fabs(rpd)))
break;

alpha_next = alpha_curr - r1pd * (alpha_curr - alpha_prev) / denom;
if (alpha_next <= 0.0)
alpha_next = 0.5 * (alpha_prev + alpha_curr);
err = fabs(alpha_next - alpha_curr);

v_u_real += d_real * (alpha_next - alpha_curr);
alpha_prev = alpha_curr;
rpd = r1pd;
alpha_curr = alpha_next;
_iter++;

v_u_real += d_real * (alpha_new - alpha_old);
this->updateMixedBC();
this->template compute_residual<0>(rnew_real, v_u_real);
r1pd = dotProduct(rnew_real, d_real);

alpha_old = alpha_new;
alpha_new *= rpd / (rpd - r1pd);

err = fabs(alpha_new - alpha_old);
_iter++;
}
v_u_real += d_real * (alpha_new - alpha_old);
v_r_real = rnew_real;
alpha_warm = (_iter == MaxIter && err > tol) ? 0.1 : alpha_curr;
v_r_real = rnew_real;
if (this->world_rank == 0)
printf("line search iter %i, alpha %f - error %e - ", _iter, alpha_new, err);
printf("line search iter %i, alpha %f - error %e - ", _iter, alpha_curr, err);
}

template <int howmany, int n_str>
Expand Down
Loading
Loading