Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/jrethore/ufreckles
21 April 2026, 21:14:19 UTC
  • Code
  • Branches (4)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/heads/v2.0
    • refs/heads/v2.1
    • refs/heads/v2.2
    No releases to show
  • 5ade5ef
  • /
  • GUI
  • /
  • run_fea_job.m
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:9a0eadaf703d20a10c8fc72693f77ea03470c3dc
origin badgedirectory badge
swh:1:dir:2b71b2425558968561c578446d06039515ad2774
origin badgerevision badge
swh:1:rev:c38c036275d400217c433acd624a7e968a09fb55
origin badgesnapshot badge
swh:1:snp:e93363e05fc035dd2687d48111453842fa57bff8

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: c38c036275d400217c433acd624a7e968a09fb55 authored by Julien Réthoré on 16 June 2025, 12:35:44 UTC
update june 2025
Tip revision: c38c036
run_fea_job.m
function run_fea_job(param,model)
clear functions
nmod=0;
param.onflight=1;
sizeim=param.roi([2,4])-param.roi([1,3])+1;
model.nscale=1;
LoadParameters(param);
LoadParameters(model,nmod);
save(fullfile('TMP','sample0_0.mat'),'sizeim')
save(fullfile('TMP','sample0.mat'),'sizeim')
LoadMask(nmod);
LoadMeshes(nmod);

filres=param.result_file;
%%
load(fullfile('TMP','0_mesh_0.mat'),'xo','yo','Nnodes')
extract=0;
selected=[];
load(strrep(param.result_file,'.res','.dat'),'-mat','selected')
if isempty(selected)

Fo=zeros(2*prod(Nnodes),1);
fromdic=0;
    indi=[];Up=[];
    for iz=1:size(model.zone,2)
        zone=model.zone(:,iz);
        switch zone{4}
            case 6
                loads=zone{7};
                nodes=zone{6};
                for ii=1:2
                    Fo(nodes+(ii-1)*prod(Nnodes))=loads(ii,2)/length(nodes);
                    up=loads(ii,1);
                    if ~isnan(up)
                        indi=[indi;nodes+(ii-1)*prod(Nnodes)];
                        Up(end+(1:length(nodes)))=up;
                    end
                end
            case 5
                if (zone{8}>0)
                    extract=1;
                end
        end
    end
    Up=Up(:);
else
    fromdic=1;
    load(strrep(param.result_file,'.res','.dat'),'-mat','U')
    indi=find(~selected);
    indi=[indi(:);indi(:)+prod(Nnodes)];
    Up=U(indi,:);
    
Fo=zeros(2*prod(Nnodes),size(Up,2));
    clear U
end
C=sparse(indi,1:length(indi),1,2*prod(Nnodes),length(indi));
L=1;
Nddl=2*prod(Nnodes);
tips=zeros(size(model.zone,2),2);
cracks=[];
if extract
    roi=param.roi;
    freenodes=ones(length(xo),1);
    xo=xo+roi(1)-1;
    yo=yo+roi(3)-1;
    L=zeros(prod(Nnodes),1);
    modes=1:2;
    harms=0:7;
    nu=model.material_parameters.nu;
    kappa=(3-4*nu);
    zo=xo+1i*yo;
    nwi=length(modes)*length(harms);
    nw=0;
    ntip=0;
    for iz=1:size(model.zone,2)
        zone=model.zone(:,iz);
        if zone{4}==5
            if (zone{8}>0)
                tips(iz,1)=ntip+1;
                indc=zone{10};
                cnodes=indc{1};
                ztip=zo(cnodes(1,1));
                tt=-diff(zo(cnodes(1:2,1)));
                tt=tt/abs(tt);
                rtip=mean(abs(zo(indc{2})-ztip));
                in=abs(zo-ztip)<=rtip;
                in(indc{2})=1;
                freenodes(in)=0;
                zzone=(zo(in)-ztip)*tt';
                idin=1:prod(Nnodes);
                idin=idin(in);
                for ip=1:length(zzone)
                    if any(cnodes(:,1)==idin(ip))
                        zzone(ip)=abs(zzone(ip))*exp(1i*pi);
                    end
                    if any(cnodes(:,2)==idin(ip))
                        zzone(ip)=abs(zzone(ip))*exp(-1i*pi);
                    end
                end
                phi=Williams(zzone,modes,harms,kappa);
                phi=phi*tt;
                L(in,nw+(1:size(phi,2)))=phi;
                ntip=ntip+1;
                nw=nw+nwi;
                if  (zone{9}>0)
                    tips(iz,2)=ntip+1;
                    ztip=zo(cnodes(end,1));
                    tt=diff(zo(cnodes(end+(-1:0),1)));
                    tt=tt/abs(tt);
                    rtip=mean(abs(zo(indc{3})-ztip));
                    in=abs(zo-ztip)<=rtip;
                    in(indc{3})=1;
                    freenodes(in)=0;
                    zzone=(zo(in)-ztip)*tt';
                    idin=1:prod(Nnodes);
                    idin=idin(in);
                    for ip=1:length(zzone)
                        if any(cnodes(:,1)==idin(ip))
                            zzone(ip)=abs(zzone(ip))*exp(-1i*pi);
                        end
                        if any(cnodes(:,2)==idin(ip))
                            zzone(ip)=abs(zzone(ip))*exp(1i*pi);
                        end
                    end
                    phi=Williams(zzone,modes,harms,kappa);
                    phi=phi*tt;
                    L(in,nw+(1:size(phi,2)))=phi;
                    nw=nw+size(phi,2);
                    ntip=ntip+1;
                end
            end
            
        end
    end
    nfree=sum(freenodes);
    indK=2*nfree+(1:size(L,2));
    Ln=sparse(find(freenodes),1:nfree,1,prod(Nnodes),nfree);
    L=[real(L);imag(L)];
    L=[blkdiag(Ln,Ln),L];
    Nddl=size(L,2);
end
%%
LoadMat(nmod);
CreateGradBasisFunction(1,nmod);
K=AssembleStiffnessMatrix(1,nmod);
Kc=[L'*(K*L),L'*C;C'*L,sparse(size(C,2),size(C,2))];
Fc=[L'*Fo;Up];
X=Kc\Fc;
U=L*X(1:Nddl,:);
Fl=K*U;
if extract
    Ks=X(indK,:);
else
    Ks=[];
end
%%
for iim=1:size(U,2)
UpdateInternalState(nmod,U(:,iim),iim);
end
load(fullfile('TMP',sprintf('%d_params',nmod)),'param');
model=param;
%%
for iz=1:size(model.zone,2)
    uu=zeros(2,size(U,2));
    ff=zeros(2,size(U,2));
    zone=model.zone(:,iz);
    switch zone{4}
        case 6
            nodes=zone{6};
            for ii=1:2
                indo=nodes+(ii-1)*prod(Nnodes);
                ff(ii,:)=sum(Fl(indo,:),1);
                uu(ii,:)=mean(U(indo,:),1);
            end
            model.zone{7,iz}=[uu;ff];
    end
end
load(fullfile('TMP','params'),'param');
load(fullfile('TMP','0_mesh_0'),'Nnodes','Nelems','xo','yo','conn','elt','ng','rflag','rint');
try
    tips(~(cell2mat(model.zone(4,:))==5),:)=[];
    model.zone(:,~((cell2mat(model.zone(4,:))==5)|(cell2mat(model.zone(4,:))==6)))=[];
    cracks=find(cell2mat(model.zone(4,:))==5);
catch
end
save(filres,'U','Fl','Ks','tips','cracks','Nnodes','Nelems','xo','yo','param','model','nmod','conn','elt','rint','ng','rflag','-v7.3');
if fromdic
    ReferenceImage(nmod);
    param.iter_max=2;
    param.analysis='correlation';
    LoadParameters(param)
    [U1]=Solve2D(U,1,nmod);
    copyfile(fullfile('TMP','0_error_0.mat'),strrep(filres,'.res','-error.res'));
    save(filres,'param','-append')
    postproVTK([filres,''],0);
else
    postproVTK([filres,''],0,0);
end

end

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API