Skip to content

Commit 5352bca

Browse files
committed
fixes for transient implicit PROBLEM
1 parent 1d37cec commit 5352bca

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Current (under development)
22

33
* ...
4+
* outputs from `WRITE_RESULTS` or `WRITE_MESH` in `vtu` or `vtk` for transient problems create a `.pvd` file
45
* instruction `PROBLEM_SOLVE` is not mandatory anymore, now FeenoX can guess where it should be called
56
* keyword `READ_DATA` to read variables and vectors from files
67
* `PROBLEM` can define `MESH` in a single line without an explicit `READ_MESH` instruction
7-
* Neo-hookean material model
8+
* neo-hookean material model
89
* MMS verification for mechanical with both sdef & ldef
910
* Saint Venant-Kirchoff material model for ldef
1011
* large deformation formulation for `mechanical`

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ TESTS_neutron_sn = \
117117

118118
TESTS_thermal = \
119119
tests/barra.sh \
120+
tests/bunny-thermal.sh \
120121
tests/encased_rod.sh \
121122
tests/thermal-1d.sh \
122123
tests/thermal-2d.sh \

doc/syntax-kate.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/sh
22
# take the output of this script as a kate syntax definition file for FeenoX
33
#
4+
# KDE 6:
5+
# mkdir -p $HOME/.local/share/org.kde.syntax-highlighting/syntax/
6+
# ./syntax-kate.sh > $HOME/.local/share/org.kde.syntax-highlighting/syntax/feenox.xml
7+
#
8+
# KDE 5:
49
# mkdir -p $HOME/.local/share/katepart5/syntax/
510
# ./syntax-kate.sh > $HOME/.local/share/katepart5/syntax/feenox.xml
611
#
@@ -88,7 +93,7 @@ cat << EOF
8893
8994
<itemDatas>
9095
<itemData name="Normal Text" defStyleNum="dsNormal"/>
91-
<itemData name="Keyword1" defStyleNum="dsKeyword"/>
96+
<itemData name="Keyword1" defStyleNum="dsKeyword" bold="1"/>
9297
<itemData name="Keyword2" defStyleNum="dsKeyword" color="#003300"/>
9398
<itemData name="Operator" defStyleNum="dsOperator" color="#666666"/>
9499
<itemData name="Identifier" defStyleNum="dsOthers" color="#663333" italic="1"/>

src/flow/run.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ int feenox_run(void) {
158158
feenox_special_var_value(done_transient) = 1;
159159
}
160160

161-
feenox_call(feenox_step(feenox.pde.instruction->next, NULL));
161+
// if we have an implicit PROBLEM, then we stay apple
162+
if (feenox.pde.instruction != NULL) {
163+
feenox_call(feenox_step(feenox.pde.instruction->next, NULL));
164+
}
162165

163166

164167
} else if (feenox.dae.dimension != 0) {

src/math/function.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,17 +488,26 @@ double feenox_function_eval(function_t *this, const double *const_x) {
488488

489489
// y is the returned value
490490
double y = 0;
491+
double x_copy[this->n_arguments];
492+
int copied = 0;
491493

492494
// implicit SOLVE_PROBLEM
493495
if (this->is_solution && feenox.pde.problem_solved == 0) {
496+
if (const_x != NULL) {
497+
// we might need to keep a copy of x
498+
for (int i = 0; i < this->n_arguments; i++) {
499+
x_copy[i] = const_x[i];
500+
}
501+
copied = 1;
502+
}
503+
494504
if (feenox_instruction_solve_problem(NULL) != FEENOX_OK) {
495505
feenox_runtime_error();
496506
}
497507
}
498508

499-
500509
// if x is null we assume it is a 3d-vector with zeroes
501-
const double *x = (const_x != NULL) ? const_x : zero;
510+
const double *x = copied ? (x_copy) : ((const_x != NULL) ? const_x : zero);
502511

503512
// check if we need to initialize
504513
if (this->initialized == 0) {

src/pdes/fem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ inline double *feenox_fem_compute_x_at_gauss(element_t *e, unsigned int q, int i
552552
feenox.fem.current_gauss_type = e->type;
553553
}
554554
if ((*x)[q] == NULL) {
555-
(*x)[q] = calloc(3, sizeof(double));
555+
feenox_check_alloc_null((*x)[q] = calloc(3, sizeof(double)));
556556
} else if (feenox.fem.cache_J) {
557557
return (*x)[q];
558558
}

0 commit comments

Comments
 (0)