Claude/check fortran stiffness 01 fc wd zx w goy s9 bwg74n88os - #8
Open
daisy20170101 wants to merge 17 commits into
Open
daisy20170101 wants to merge 17 commits into
daisy20170101 wants to merge 17 commits into
Conversation
1. trimode_finder: Fix index mapping for barycentric coordinates - MATLAB uses 2-element vectors where p(1)=y, p(2)=z - Fortran uses 3-element vectors where p(2)=y, p(3)=z - Changed p2(2)-p3(2) to p2(3)-p3(3) for z-coordinate differences - Changed p3(2)-p1(2) to p3(3)-p1(3) in b calculation 2. tdstress_harfunc: Fix transformation matrix construction - Changed from row-based (A(i,:)=vec) to column-based (A(:,i)=vec) - Now consistent with tdstress_fs which uses columns 3. debug_nikkhoo.f90: Fix matrix construction for debug output - Changed to column-based matrix matching sub_nikkhoo.f90 - coord_trans uses transpose(A), so columns are required
… points
Changes:
1. Added ieee_arithmetic module for NaN generation
2. Changed casez_log (trimode=0) handling to return NaN for all strain
components, matching MATLAB TDstressFS.m behavior:
- MATLAB sets: exx(casezLog,1) = nan; etc.
- Points on triangle edges are singular and have undefined strain
- Previous implementation tried to average configurations which
produced unreliable results
This fix, combined with the previous trimode_finder index mapping fix,
should resolve discrepancies between Fortran and MATLAB implementations.
- Move debug/test files to debug/ subfolder: - debug_matlab.m, debug_nikkhoo.f90 - Makefile.debug, compile_test.sh, test_nikkhoo.f90 - Update README_NIKKHOO.md with new folder structure and documentation of bug fixes applied
Implements parallel triangular stiffness matrix calculation similar to TriGreen/calc_trigreen.f90 but using Nikkhoo & Walter (2015) method: - calc_nikkhoo.f90: Main program with MPI distribution and OpenMP parallelization - m_nikkhoo_green.f90: Parameter module (material properties, geometry) - Makefile: Build system for parallel compilation - runcompile_nikkhoo.sh: Alternative compilation script Features: - Hybrid MPI+OpenMP parallelization for large meshes - Dynamic load balancing across MPI processes - Silent/production versions of strain calculation routines - Output format compatible with TriGreen (nikkhoo_<rank>.bin) Usage: make mpirun -np <nprocs> ./calc_nikkhoo
- Replace custom isnan_check function with intrinsic ieee_is_nan - Add 'use, intrinsic :: ieee_arithmetic' to calc_nikkhoo_allcell - Remove unused isnan_check function definition
- Flip sign of z coordinates when reading mesh vertices (mesh has positive z, half-space solution requires negative z) - Change output file prefix from 'nikkhoo_' to 'trigreen_' for compatibility with existing TriBIE workflow
…' of https://github.com/daisy20170101/TriBIE into claude/check-fortran-stiffness-01FCWdZxWGoyS9BWG74n88os flip z coordinates
- Remove incorrect reimplementations of strain functions from calc_nikkhoo.f90 - Use validated nikkhoo_walter module's tdstress_hs function directly - Comment out 123 debug write statements in sub_nikkhoo.f90 for production use - Update Makefile and runcompile_nikkhoo.sh to compile sub_nikkhoo.f90 as dependency
Add comment markers to continuation lines of commented-out multi-line write statements to prevent Fortran compilation errors.
- runcompile_nikkhoo.sh: Accept command line argument (gfortran/mpi) - Makefile: Add FC variable override and 'make gfortran' convenience target - Updated help messages in both files
…' of https://github.com/daisy20170101/TriBIE into claude/check-fortran-stiffness-01FCWdZxWGoyS9BWG74n88os
- Remove verbose write statements during deallocation that caused delays - Add allocated() checks before deallocate calls - Add stat= parameter to handle deallocation errors gracefully - Remove unused timing variables (dealloc_start_time, dealloc_end_time)
…' of https://github.com/daisy20170101/TriBIE into claude/check-fortran-stiffness-01FCWdZxWGoyS9BWG74n88os update trigreen deallocation
1. Move input validation outside OpenMP loop: - Pre-validate parm_nu, ss, ds, op once before entering nested loops - Eliminates millions of redundant isnan() checks 2. Add dynamic OpenMP scheduling: - Changed from default static to SCHEDULE(DYNAMIC, 10) - Better load balancing for non-uniform dstuart() computation costs 3. Reduce diagnostic output: - Remove verbose write statements inside OMP CRITICAL sections - Remove per-process status messages that serialized execution - Use OMP ATOMIC instead of OMP CRITICAL for error flag Expected improvement: 20-40% runtime reduction
…' of https://github.com/daisy20170101/TriBIE into claude/check-fortran-stiffness-01FCWdZxWGoyS9BWG74n88os update parallelization and structure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
update stiffness with Nikkhoo